Skip to content

Dilithia Contract Tools

CLI and Docker tooling for the full smart contract lifecycle on Dilithia: scaffolding, compilation, deployment, upgrades, and runtime interaction.

How Dilithia Smart Contracts Work

Dilithia smart contracts are written in Rust and compiled to WebAssembly (WASM). The compiled .wasm binary is submitted to the network via a signed JSON-RPC transaction. Once deployed, other accounts can interact with the contract by sending calls (state-changing, signed transactions) or queries (read-only, unsigned).

Rust source  -->  cargo build (wasm32)  -->  .wasm artifact  -->  deploy tx  -->  on-chain contract

Contracts use the vendored dilithia-sdk crate generated by dilithia-contract init, which provides the #[contract] macro, a Ctx context object for storage and events, and helpers for cross-contract calls, token operations, messaging, gas introspection, and signature verification.

Quick Start

Three commands take you from zero to a live contract:

# 1. Scaffold a new project
dilithia-contract init --name my_token

# 2. Compile to WASM
cd my_token
dilithia-contract build

# 3. Deploy to a running node
dilithia-contract deploy \
  --name my_token \
  --wasm target/wasm32-unknown-unknown/release/my_token.wasm \
  --rpc http://localhost:8000/rpc \
  --secret-key $DILITHIA_SECRET_KEY

What's Included

Component Description
CLI (dilithia-contract) Seven subcommands covering the full contract lifecycle, including ABI extraction
Docker image Pre-built Rust + WASM toolchain for compilation without a local Rust install
Project templates Starter contract with storage, events, and best-practice structure

Next Steps

  • Getting Started -- prerequisites, installation, and a full walkthrough
  • CLI Reference -- every subcommand, flag, and environment variable
  • Writing Contracts -- contract structure, storage, events, and advanced APIs
  • Deployment Guide -- signing flow, deploy payloads, upgrades, and verification
  • Docker -- compiling contracts without a local Rust toolchain
  • Dilithia SDK Documentation -- client SDKs for interacting with contracts from TypeScript, Python, Rust, Go, and Java