Skip to content

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.

from a Rust crate to a running app1 · Rust cratecdylib + calimero-sdk#[app::state] struct#[app::logic] impl#[app::event] / errorcargo test: TestAppon the real engine2 · componentmeroctl app buildcargo build --release wasm32-wasip2lift calimero:abi→ app.wasm(+ compute.wasm)3 · signed .mpkmeroctl app packmanifest.json: package, appVersion, sha256 of app.wasmsigned: JCS+Ed25519→ pkg-1.0.0.mpk4 · on the clusterinstall the package: signature, digest imports ⊆ world prepare (wasmtime)create an app: init as the owner, in an organizationdevelopment cluster only: meroctl context create --path app.wasmevery call, at run timeclient → any node → app's leader: handle(kind, method, args) on the componentOk → writes + events become one entry in the app's Raft log; followers apply the diff, never re-runErr or trap → nothing written, no events; a view reads state and writes nothing
  1. Install the tools. Rust with the wasm32-wasip2 target (core’s rust-toolchain.toml lists it), meroctl, and merod for the local cluster:

    Terminal window
    rustup target add wasm32-wasip2
    cargo install --locked --path crates/meroctl
    cargo install --locked --path crates/merod
  2. 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’s testing feature):

    Terminal window
    cargo test --manifest-path apps/kv-store/Cargo.toml
  3. Build the component:

    Terminal window
    meroctl app build apps/kv-store --out kv_store.wasm

    It compiles the crate for wasm32-wasip2, makes it a calimero:app component and lifts the ABI the macros wrote into its calimero:abi section.

  4. Start a development cluster: merod local in the background, one node on 127.0.0.1:2501 (enough to build an app; --nodes 3 runs three, as Calimero Cloud does, on 2501-2503), in the release’s Docker image (Docker must be running; --local runs the merod on PATH), mock attestation, state in ~/.calimero/meroctl/local/. meroctl saves it as the node local (trusting its mock quote), the default when you have none:

    Terminal window
    meroctl local up
    meroctl local status # whether it runs, and its nodes

    meroctl local down stops it; its state stays for the next up (--fresh starts empty).

  5. 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 alice

    login signs up when the file does not exist yet, and signs in with it after. The sign-up makes an account and no organization.

  6. Create an instance and call it. On a development cluster --path uploads 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-kv
    meroctl call -i my-kv set --args '{"key": "hello", "value": "world"}'
    meroctl call -i my-kv get --args '{"key": "hello"}' --view

    The 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 a u64 travels 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
  7. Pack it as a signed release. A real cluster installs .mpk packages from its registry, never a raw component. meroctl app pack writes 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.mpk
    meroctl package install --path dist/com.example.kv-0.1.0.mpk
    meroctl instance create --name kv-pkg --package com.example.kv --alias kv-pkg