Mist Toolchain & CLI
Complete reference for mistc ā the Mist smart contract compiler, linter, deployer, and debugging toolchain.
Installation
mistc is included in the Rivellum node distribution. To compile from source:
cargo build --release -p mistc
The binary is at target/release/mistc.
Commands
mistc compile ā Compile to Bundle
Runs the full compilation pipeline and outputs a deployment bundle:
mistc compile counter.mist -o counter.bundle.json
The bundle contains the VIR program, PVI graph, metadata, and code hash ā everything needed for on-chain deployment.
Flags:
-o, --output <FILE>ā Output path (default: stdout)
mistc build ā Full Build with All Artifacts
Compiles and writes all intermediate artifacts to a directory:
mistc build counter.mist -o build/
Produces:
build/
āāā counter.bundle.json # Full deployment bundle
āāā counter.pvi.json # Standalone PVI graph
āāā counter.analysis.json # Static analysis report
āāā counter.fees.json # Fee breakdown
Flags:
-o, --output-dir <DIR>ā Output directory (default:build/)
mistc check ā Syntax Check
Parses the source and reports syntax errors without full compilation:
mistc check counter.mist
Fast feedback for syntax issues (indentation, unknown keywords, unterminated strings).
mistc lint ā Full Lint
Runs parse + type check + static analysis (everything except PVI lowering):
mistc lint counter.mist
Reports type errors, conservation violations, locked funds, and other static analysis issues. Use this as your primary development feedback tool.
mistc fmt ā Format Source
Reformats a Mist file with canonical indentation:
# Preview formatted output
mistc fmt counter.mist
# Format in place
mistc fmt counter.mist --write
Flags:
-w, --writeā Overwrite the source file in place
mistc fees ā Fee Analysis
Shows a detailed breakdown of deployment and execution fees:
# Human-readable output
mistc fees counter.mist
# Per-function analysis
mistc fees counter.mist --function increment
# JSON output
mistc fees counter.mist --json
Flags:
--function <NAME>ā Analyze fees for a specific function--jsonā Output as JSON
Fee tiers:
| Tier | Threshold | Deploy Fee |
|---|---|---|
| Simple | ⤠50 instructions, ⤠5 functions | 0.1 RIVL |
| Medium | ⤠200 instructions, ⤠20 functions | 0.5 RIVL |
| Complex | Above Medium | 2.0 RIVL |
mistc parse ā Dump AST
Outputs the parsed AST for debugging:
mistc parse counter.mist
mistc inspect ā Inspect PVI Graph
Pretty-prints the PVI graph structure from a compiled bundle:
mistc inspect counter.bundle.json
Shows node types, edges, amounts, asset types, and flow structure.
mistc explain ā Error Code Explainer
Displays a detailed explanation for any Mist error code:
mistc explain MIST_E_LOCKED_FUNDS
mistc explain UVL_F002
mistc explain FEE_W_HIGH_FEE
All error codes:
| Category | Codes |
|---|---|
| Static analysis | MIST_E_LOCKED_FUNDS, MIST_E_CONSERVATION, MIST_E_SPLIT_SUM, MIST_E_SPLIT_PERCENTAGE, MIST_E_SPLIT_MIXED, MIST_E_MINT_AUTHORITY, MIST_E_BURN_INVALID, MIST_E_NON_DETERMINISTIC, MIST_E_UNUSED_VAULT, MIST_E_TOO_MANY_PATHS, MIST_E_DIRECT_BALANCE_MUTATION, MIST_E_NON_DETERMINISTIC_FEE, MIST_E_UNBOUNDED_LOOP |
| Warnings | MIST_W_UNREACHABLE, MIST_W_OVERLAPPING_CONDITIONS |
| UVL settlement | UVL_F001 through UVL_F014 |
| Fee diagnostics | FEE_E_ZERO_FEE, FEE_E_CONSERVATION_MISMATCH, FEE_E_OVERSIZED_DEPLOY, FEE_W_HIGH_FEE, FEE_W_COMPLEX_DEPLOY |
mistc deploy ā Deploy Contract
Deploys a compiled bundle to the network:
mistc deploy counter.bundle.json
mistc deploy counter.bundle.json --rpc https://rpc.rivellum.network
Flags:
--rpc <URL>ā RPC endpoint (default:https://rpc.rivellum.network)
mistc call ā Call Contract Function
Calls a function on a deployed contract:
mistc call <contract_id> increment '[]'
mistc call <contract_id> transfer '["0xabc...", 1000]'
mistc call <contract_id> get_count '[]' --rpc https://rpc.rivellum.network
Arguments:
<contract_id>ā The deployed contract's on-chain ID<function_name>ā Function to call<args_json>ā JSON array of arguments
Flags:
--rpc <URL>ā RPC endpoint
mistc receipt ā Fetch Execution Receipt
Retrieves and displays an execution receipt:
mistc receipt <receipt_id>
mistc receipt <receipt_id> --pvi # Include PVI graph
mistc receipt <receipt_id> --explain # Explain any errors
Flags:
--rpc <URL>ā RPC endpoint--pviā Include PVI graph in output--explainā If the receipt contains an error, explain it
mistc replay ā Deterministic Replay
Replays an execution from a replay bundle to verify determinism:
mistc replay replay_bundle.json
The replay re-executes the contract with the same inputs and verifies that the PVI commitment, state root, and all other commitments match. Used for auditing and dispute resolution.
mistc repro-export ā Export Reproduction Bundle
Creates a self-contained bundle for reproducing a specific execution:
mistc repro-export \
--contract my_contract.mist \
--receipt <receipt_id> \
--rpc https://rpc.rivellum.network \
-o repro_bundle.json
The output contains everything needed to replay: the contract source, execution receipt, host environment parameters, and account balances.
mistc attest ā Sign Bundle
Signs a bundle with a Dilithium3 post-quantum key for proof-of-origin:
mistc attest my_contract.bundle.json \
-k my_key.pem \
-o my_contract.attested.json
mistc verify-bundle ā Verify Attestation
Verifies the Dilithium3 signature on an attested bundle:
mistc verify-bundle my_contract.attested.json
mistc init ā Scaffold New Project
Creates a new Mist project directory with a starter contract:
mistc init my_project
Generates:
my_project/
āāā src/
ā āāā main.mist
āāā mist.toml (if applicable)
mistc test ā Run Tests
Runs embedded tests in the current directory:
mistc test
mistc test ./src
Typical Development Workflow
# 1. Create project
mistc init my_defi_app
cd my_defi_app
# 2. Write contract
# Edit src/main.mist
# 3. Check syntax quickly
mistc check src/main.mist
# 4. Full lint (types + static analysis)
mistc lint src/main.mist
# 5. Review fees
mistc fees src/main.mist --json
# 6. Full build
mistc build src/main.mist
# 7. Inspect PVI graph
mistc inspect build/main.bundle.json
# 8. Deploy to testnet
mistc deploy build/main.bundle.json
# 9. Call functions
mistc call <contract_id> init '[]'
mistc call <contract_id> increment '[]'
# 10. Check receipt
mistc receipt <receipt_id> --pvi --explain
RPC API Endpoints
For programmatic deployment without the CLI:
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/mist/deploy | Deploy a contract bundle |
POST | /v1/mist/call/<id> | Call a contract function |
GET | /v1/mist/receipts | List recent receipts |
GET | /v1/mist/receipts/<id> | Get specific receipt |
GET | /v1/mist/pvi/<id> | Get PVI graph for a receipt |
POST | /v1/mist/replay_inputs | Get replay inputs for a receipt |
GET | /v1/mist/contract/<id> | Get contract metadata |
GET | /prefabs | List prefab contracts |
GET | /prefabs/manifest | Get prefab manifest |
GET | /prefabs/<name> | Get specific prefab |
Deploy Example
curl -X POST https://rpc.rivellum.network/v1/mist/deploy \
-H 'Content-Type: application/json' \
-d '{
"bytecode": "<base64_encoded_bundle_json>",
"sender": "0x1234..."
}'
Call Example
curl -X POST https://rpc.rivellum.network/v1/mist/call/0xcontract_id \
-H 'Content-Type: application/json' \
-d '{
"function": "transfer",
"args": ["0xrecipient...", 1000],
"sender": "0xsender..."
}'