Skip to content

Smart Contracts

Smart Contracts are a key feature of Dusk, playing a fundamental role at the protocol level. Specifically, both transferring the native currency and staking functionalities are implemented as genesis contracts.

The Dusk smart contract platform is a tailor made basis for specific applications who want to leverage native zero-knowledge proof capabilities and privacy features. Any developer can make extensive use of these features but also develop just about any kind of smart contract they desire like with other chains. On top of that, the Dusk core team continues to develop and integrate smart contracts themselves into the Dusk ecosystem, especially the development of financial market infrastructure products such as Zedger and the self-sovereign identity system Citadel.

This Smart Contracts section guides you through the different aspects of smart contract development on Dusk and how you can start developing your own contracts on Dusk.

What is a Smart Contract?

A smart contract is a self-executing digital agreement whose terms and conditions are directly written into lines of code. Even though the concept of smart contracts has been introduced in 1994, it became more popular after the creation of general purpose blockchains. The reason is that storing smart contracts on a blockchain ensures transparency, security, and immutability.

Smart contracts on Dusk

Dusk offers robust support for smart contracts, as developers can leverage the features offered by Rusk, specifically execution-core and rusk-abi. The rusk-abi serves as an entrypoint to be able to interact with the lower level underlying VM, which is called Piecrust.

Theoretically, developers can use any programming language that compiles to WebAssembly (WASM), but we strongly recommend developers to use Rust due to its extensive support in our ecosystem.

In order to deploy a smart contract, developers only need to compile their contracts to WASM together with exposing the functions to the host.

Comparison

Here is a simplified comparison between Dusk and other smart contracts platforms:

FeatureEVMCosmWasmSolanaDusk
Main Programming LanguageSolidityRustRustRust
Transaction ModelsAccount-basedAccount-basedAccount-basedUTXO and account-based
Compiling TargetEVM bytecodeWASMBPFWASM
VMEVMNoSealevelPiecrust

Examples

There are several smart contracts examples available, which can be used for reference.