This is an example contract being used in the docs. You can read more about it here
This workspace consists of two members:
my-first-contract/
├─ contract/ # The smart contract (WASM target)
└─ data-driver/ # JSON <-> RKYV translator (WASM target for frontends/indexers)
- Rustup
make- Wasm-pack
- Wasm-tools
cargo install --locked wasm-pack
cargo install --locked --version 1.207.0 wasm-toolsmake- Contract WASM:
./target/wasm32-unknown-unknown/release/my_first_contract.wasm - Data‑driver WASM:
./target/wasm32-unknown-unknown/release/my_first_contract_dd.wasm
A minimal counter contract with three calls:
read_value: input()→ outputu32increment: input()→ output()init: inputu32→ output()
A WASM library that converts JSON <-> RKYV bytes for the contract’s ABI surface.
- Functions
read_value: input(); outputu32increment: input(); output()init: inputu32; output()
- Events
INIT: payloadu32
The driver is no_std and exports an FFI suitable for JS host code (see features = "js" build).