Korale

AI smart contract developer for Casper.

About

Korale is a platform that uses AI to develop smart contracts for Casper. Currently it supports CEP18 tokens generation.

The platform is currently in beta and is invite-only. If you are interested in using the platform, please sign up for the waitlist.

AI

Currently available AI models are finally good enough to generate pieces of code, that can be used in production. Projects that use AI to generate code combines multiple techniques to build larger and more complex systems. Any LLM can write working code for a very simple task, but the real challenge are large and complex systems.

Korale uses GPT-4o mini. Even it is not the best model available, it is the cheapest one, that still can write good code. Our goal is making this technology widely available.

Code compilation and AI response take a lot of time. This is why this process will not be an instant for the next few years. For a single Description, Korale does up to 20 interactions with the AI model and similar number of compilations. The whole process can stretch even up to 10 minutes.

How it works

Given a token Description, Korale can turn it into a working smart contract. It does it in three steps:
- interface generation,
- implementation generation,
- tests generation.

On every step the code is compiled, to validate, it does not contain syntax errors. If it does, the step is repeated until the correct code is generated.

The Interface Generation phase uses provided Description to write a Rust trait that represents smart contract entry points. It also defines the storage layout. Submodules to be included at this stage.

The Implementation Generation phase uses the Description and the Interface to write the smart contract logic. Errors and Events are generated here.

The Tests Generation phase uses the Description and the Interface to write the smart contract tests. Note that AI doesn't know how the Implementation looks like. This way it can generate tests that are independent of the Implementation. This is a very important feature because it allows to test the Implementation against the Interface. This step can be successful only if generated Tests passes. If they don't, the step runs again and new Tests are generated.