Ironclad CLI - DPL Smart Contract Framework
Ironclad is the Anchor-like development framework for dchat smart contracts.
Overview
Ironclad provides a complete toolkit for building, testing, and deploying DPL (dchat Program Language) smart contracts:
- ๐๏ธ Project scaffolding - Initialize projects from templates
- ๐จ Build pipeline - Compile Rust to WASM with manifest verification
- ๐งช Testing - Run unit and integration tests
- ๐ IDL generation - Extract Interface Definition Language from WASM
- ๐ Deployment - Deploy to localnet, devnet, testnet, or mainnet
- โ Verification - Verify manifest integrity and schema hashes
Installation
Or run directly from the workspace:
# Then use: target/debug/ironclad
Quick Start
Initialize a New Project
# Create from template
Available templates:
counter- Simple state counterescrow- Multi-party escrowtoken- Fungible token implementationcustom- Empty template
Build
# Development build
# Release build with verification
Test
# With verbose output
Verify
# With expected schema hash
Deploy
# Deploy to devnet
# Deploy to mainnet with custom keypair
IDL Operations
# Extract IDL from WASM
# Show IDL hash
# Validate IDL
# Generate TypeScript client (future)
Program Info
# Show local project info
# Query deployed program
Configuration
# Show current config
# Set configuration value
# Get configuration value
Clean
# Remove build artifacts
Project Structure
my-program/
โโโ Cargo.toml
โโโ Ironclad.toml # Project configuration
โโโ build.rs # DPL build script
โโโ src/
โ โโโ lib.rs # Program code
โโโ tests/
โ โโโ integration.rs
โโโ idl/ # Generated IDL files
โ โโโ my-program.json
โโโ target/
โโโ wasm32-wasip1/
โโโ release/
โโโ my_program.wasm
Configuration File (Ironclad.toml)
[]
= "my-program"
= "0.1.0"
= "DcHaT..." # Set after first deployment
= "My awesome smart contract"
= ["Your Name"]
[]
= "wasm32-wasip1"
= true
= false
[]
= "http://localhost:8545"
= "ws://localhost:8546"
= "~/.dchat/keypair.json"
= true
[]
= "https://devnet.dchat.network"
= "wss://devnet.dchat.network/ws"
= true
[]
= "https://mainnet.dchat.network"
= "wss://mainnet.dchat.network/ws"
= true
[]
= 300
= true
[]
= "idl"
= false
= "ts-client"
Using with Existing Examples
The ironclad CLI works with the existing DPL examples in this repository:
# Navigate to an example
# Build
# Test
# Verify
# Show info
Note: The dpl-escrow-ironclad example is already set up as a proper Ironclad project with Ironclad.toml.
Command Reference
| Command | Description | Example |
|---|---|---|
ironclad init <name> |
Initialize new project | ironclad init my-token --template token |
ironclad build |
Build smart contract | ironclad build --release --verify |
ironclad test |
Run tests | ironclad test --verbose |
ironclad verify |
Verify manifest | ironclad verify --expected-hash <hash> |
ironclad idl extract |
Extract IDL from WASM | ironclad idl extract --output idl/program.json |
ironclad idl hash |
Show IDL hash | ironclad idl hash idl/program.json |
ironclad deploy |
Deploy program | ironclad deploy --network devnet |
ironclad upgrade |
Upgrade program | ironclad upgrade --program-id <id> --network mainnet |
ironclad info |
Show program info | ironclad info --program <id> --network mainnet |
ironclad config show |
Show configuration | ironclad config show |
ironclad clean |
Clean build artifacts | ironclad clean |
Development Workflow
- Initialize:
ironclad init my-program - Develop: Edit
src/lib.rs - Build:
ironclad build - Test:
ironclad test - Verify:
ironclad verify - Deploy:
ironclad deploy --network devnet - Upgrade:
ironclad upgrade --program-id <id>
Features
โ Implemented
- Project initialization with templates
- WASM build pipeline
- Test runner
- Manifest verification
- IDL extraction
- Program info display
- Configuration management
- Build artifact cleanup
๐ง In Progress
- Network deployment (RPC integration)
- Program upgrades
- IDL-based client generation
๐ Planned
- Interactive deployment wizard
- Reproducible builds
- Security auditing
- Gas optimization analysis
Comparison to Anchor (Solana)
| Feature | Anchor | Ironclad |
|---|---|---|
| Language | Rust | Rust |
| Target | BPF/eBPF | WASM |
| Init | anchor init |
ironclad init |
| Build | anchor build |
ironclad build |
| Test | anchor test |
ironclad test |
| Deploy | anchor deploy |
ironclad deploy |
| IDL | Automatic | Automatic |
| Verification | anchor verify |
ironclad verify |
Troubleshooting
"No Ironclad.toml found"
Run ironclad config init in your project root, or run ironclad init to create a new project.
"WASM file not found"
Run ironclad build --release before deploying or verifying.
"Manifest not found in WASM"
Ensure you're using the DPL SDK with proper build.rs configuration. See existing examples for reference.
Examples
See examples/contracts/dpl-escrow-ironclad/ for a complete working example.
Contributing
Ironclad is part of the dchat project. Contributions are welcome!
License
MIT OR Apache-2.0
Built with โค๏ธ for the dchat ecosystem