Quickstart
This takes core’s apps/kv-store from source to a method call on a local
cluster, then packs it the way a real cluster installs it. Everything runs from
a checkout of core; the
tutorial writes an app of your own and explains each step.
-
Install the tools. Rust with the
wasm32-wasip2target (core’srust-toolchain.tomllists it),meroctl, andmerodfor the local cluster:Terminal window rustup target add wasm32-wasip2cargo install --locked --path crates/meroctlcargo install --locked --path crates/merod -
Test the app on the real engine, with no node. The tests build the crate into a component and run it with
TestApp(calimero-sdk’stestingfeature):Terminal window cargo test --manifest-path apps/kv-store/Cargo.toml -
Build the component:
Terminal window meroctl app build apps/kv-store --out kv_store.wasmIt compiles the crate for
wasm32-wasip2, makes it acalimero:appcomponent and lifts the ABI the macros wrote into itscalimero:abisection. -
Start a development cluster:
merod localin the background, one node on127.0.0.1:2501(enough to build an app;--nodes 3runs three, as Calimero Cloud does, on2501-2503), in the release’s Docker image (Docker must be running;--localruns themerodonPATH), mock attestation, state in~/.calimero/meroctl/local/.meroctlsaves it as the nodelocal(trusting its mock quote), the default when you have none:Terminal window meroctl local upmeroctl local status # whether it runs, and its nodesmeroctl local downstops it; its state stays for the nextup(--freshstarts empty). -
Sign in. Sign up with a passkey kept in a file, which only a development cluster accepts:
Terminal window meroctl login --dev-passkey ./dev-passkey.json --name aliceloginsigns up when the file does not exist yet, and signs in with it after. The sign-up makes an account and no organization. -
Create an instance and call it. On a development cluster
--pathuploads a raw component; naming no organization, the instance goes in your only one, or (you are in none yet) in a new one made with it:Terminal window meroctl instance create --name my-kv --path kv_store.wasm --alias my-kvmeroctl call -i my-kv set --args '{"key": "hello", "value": "world"}'meroctl call -i my-kv get --args '{"key": "hello"}' --viewThe view answers the value with the log index it read and a receipt the answering node signed:
{ "index": <n>, "result": "world", "receipt": { … } }Methods and arguments are the ABI’s camelCase names (
getResult,updateIfExists), and au64travels as a decimal string:Terminal window meroctl call -i my-kv len --view # result: "1"meroctl call -i my-kv getResult --args '{"key": "x"}' --view# refused: 422 APP_ERROR, code NotFound, fields { "key": "x" }meroctl instance watch my-kv --limit 1 # the Inserted event -
Pack it as a signed release. A real cluster installs
.mpkpackages from its registry, never a raw component.meroctl app packwrites the manifest, signs it (here with the development key; see Packaging & signing for your own) and packs the archive. A development cluster takes it as an upload too:Terminal window meroctl app pack --wasm kv_store.wasm --package com.example.kv \--app-version 0.1.0 --out dist/com.example.kv-0.1.0.mpkmeroctl package install --path dist/com.example.kv-0.1.0.mpkmeroctl instance create --name kv-pkg --package com.example.kv --alias kv-pkg