Skip to content

Getting Started

Complete Installation first. The steps below assume you are in a local checkout of https://github.com/wasichain/chain.

This page takes the fastest path into deterministic contract execution. Services are covered separately in Services Overview.

Quick path: counter contract

1. Start a local devnet

docker compose -f compose/docker-compose.yml up -d --build

The local devnet exposes the public gateway on port 8080, and wasichain defaults to that gateway for contract and code flows.

2. Export a signing key

wasichain can derive the signer address directly from --key or WASICHAIN_KEY, so the examples below do not need a separate --from.

export WASICHAIN_KEY=<32_BYTE_ED25519_SEED>

3. Build the contract

cargo build --target wasm32-wasip2 --release -p counter-contract

This uses plain Cargo and writes the Wasm artifact to target/wasm32-wasip2/release/counter_contract.wasm.

4. Deploy in one step

The dev deploy command builds, uploads, waits for activation, and instantiates:

wasichain dev deploy packages/contracts/counter \
  --msg '{"initial_value": 0}'

5. Or deploy step-by-step

# Upload the compiled Wasm
wasichain code upload target/wasm32-wasip2/release/counter_contract.wasm

# Announce code to the chain
wasichain code announce --hash <CODE_HASH> --blob-size <SIZE>

# Wait for validators to compile and activate the code
wasichain code wait --hash <CODE_HASH> --until activated

# Instantiate the contract
wasichain contract instantiate --code-id <ID> --msg '{"initial_value": 0}'

6. Interact with the contract

# Increment the counter
wasichain contract exec --address <CONTRACT_ADDR> --msg '{"Increment":{}}'

# Query the current value
wasichain contract query --address <CONTRACT_ADDR> --msg '{"GetCount":{}}'

For remote deployments, point --rpc and --node at the gateway URL instead of relying on local defaults.

Genesis and initial balances

If you generate your own network config, wasichain genesis init --chain-id <name> writes a genesis.toml file in the current directory.

Initial balances live in the initial_balances section of that file. The generated first validator is also given an initial balance automatically. To change genesis balances:

  • edit genesis.toml directly before finalizing
  • add or change validator entries with wasichain genesis add-validator
  • rerun wasichain genesis finalize after your edits

For development networks, this is where you decide who starts funded and by how much.

Next steps