Skip to main content
The Minichain CLI provides a complete interface for interacting with your blockchain. From initializing a new chain to deploying smart contracts, all operations are available through intuitive commands.

Installation

The CLI is built as part of the Minichain project:
# Clone the repository
git clone https://github.com/jayendra-info/minichain.git
cd minichain

# Build the project
cargo build --release

# The CLI binary will be at target/release/minichain
You can run commands using:
cargo run --release -- <command>
Or directly via the binary:
./target/release/minichain <command>

Command Structure

All Minichain commands follow a consistent structure:
minichain [COMMAND] [SUBCOMMAND] [OPTIONS]
For example:
  • minichain init --authorities 2
  • minichain account new --name alice
  • minichain block produce --authority authority_0

Available Commands

init

Initialize a new blockchain with genesis block

account

Manage accounts, check balances, mint tokens

tx

Send transfer transactions

block

Produce blocks and query block information

deploy

Deploy smart contracts from assembly

call

Execute contract functions

explore

Browse blockchain state and history

Quick Reference

CommandDescriptionExample
initInitialize new blockchainminichain init --authorities 2
account newGenerate keypairminichain account new --name alice
account mintMint tokens (authority only)minichain account mint --from authority_0 --to 0xABC... --amount 50000
account balanceQuery balanceminichain account balance 0xABC...
account infoShow account detailsminichain account info 0xABC...
account listList all keypairsminichain account list
tx sendSend transferminichain tx send --from alice --to 0xABC... --amount 100
block listList recent blocksminichain block list --count 10
block infoShow block detailsminichain block info 5
block produceProduce new blockminichain block produce --authority authority_0
deployDeploy contractminichain deploy --from alice --source contract.asm --gas-limit 80000
callCall contractminichain call --from alice --to 0xABC...

Common Options

Most commands support the following common options:

Data Directory

--data-dir <PATH>
Specifies where blockchain data is stored. Defaults to ./data. Example:
minichain init --data-dir ./my-chain
minichain account new --data-dir ./my-chain --name alice

Help

--help
Shows detailed help for any command:
minichain --help
minichain init --help
minichain account --help

Typical Workflow

Here’s a common sequence of operations:
# 1. Initialize blockchain
minichain init --authorities 1

# 2. Create user accounts
minichain account new --name alice
minichain account new --name bob

# 3. Fund accounts (authority only)
minichain account mint --from authority_0 --to <ALICE_ADDRESS> --amount 50000
minichain account mint --from authority_0 --to <BOB_ADDRESS> --amount 50000

# 4. Deploy a contract
minichain deploy --from alice --source counter.asm --gas-limit 80000

# 5. Produce a block to include the deployment
minichain block produce --authority authority_0

# 6. Call the contract
minichain call --from alice --to <CONTRACT_ADDRESS>

# 7. Produce another block
minichain block produce --authority authority_0

# 8. Explore the chain
minichain block list
minichain account info <CONTRACT_ADDRESS>

Output Format

The CLI uses colored output with symbols for visual clarity:
  • ✓ (green) - Success
  • ✗ (red) - Error
  • Yellow text - Addresses and hashes
  • Cyan text - Numeric values and commands
  • Gray text - Supplementary information
If colors don’t display correctly in your terminal, check that your terminal supports ANSI color codes.

Error Handling

When commands fail, the CLI provides clear error messages:
$ minichain account balance 0xinvalid
Error: Invalid address format: 0xinvalid

$ minichain init
Error: Chain already initialized. Use --force to reinitialize.

$ minichain tx send --from alice --to 0xABC... --amount 1000000
Error: Insufficient balance: have 50000, need 1021000 (amount 1000000 + gas 21000)

Next Steps

Initialize Blockchain

Learn how to create a new blockchain

Manage Accounts

Create accounts and manage balances

Send Transactions

Transfer tokens between accounts

Deploy Contracts

Deploy and interact with smart contracts

Build docs developers (and LLMs) love