Smart Contracts
Writing, testing, and deploying Solidity smart contracts on Armchain.
Overview
If you've built smart contracts on Ethereum, you already know how to build on Armchain. The EVM is fully compatible (London fork), so no Solidity changes are required. The main differences are at the network level:
Transactions use ML-DSA44 signatures (not ECDSA), handled by the SDK
Transaction type is 3 (PQC), set automatically by the SDK
Finality is instant, no need to wait for confirmations
Development Setup
Option 1: Remix IDE
No local setup required.
Open Remix IDE
Write your Solidity contract
In the Solidity Compiler tab, select version
0.8.24and set EVM version to londonIn the Deploy & Run Transactions tab, select Injected Provider (with Armchain Wallet connected)
For local development, select External HTTP Provider and enter
http://localhost:4000
Option 2: Hardhat (Partial Compatibility)
⚠ Compatibility Warning: Hardhat's built-in signers and
hre.ethersuse ECDSA and cannot sign Armchain transactions. The following features are not supported with standard Hardhat:
hre.ethers.getSigners()/hre.ethers.getContractFactory().deploy()(ECDSA signing fails)Self-funding test accounts
Fork testing against Armchain
Hardhat can be used for:
npx hardhat compile, artifact generation, and project structure. All signing must go through@armchain-ethersv6/ethers.
Configure for Armchain:
Compile with:
Writing Contracts
Supported Solidity Versions
Use Solidity 0.8.x. Recommended:
EVM Version
Set the EVM target to london in your compiler settings. Do not use:
shanghai(PUSH0opcode not supported)cancun(transient storage not supported)
Standard Patterns
All common Solidity patterns work on Armchain:
ERC-20 Token
NFT (ERC-721)
Upgradeable Contract (Proxy Pattern)
Testing
⚠ Compatibility Warning: Hardhat's default test environment (
hre.ethers.getSigners()) provides ECDSA signers that cannot send Armchain transactions. Hardhat tests that deploy contracts or send transactions will fail. Unit tests that only test pure Solidity logic (no state changes) work fine.
For contract interaction tests, use the Armchain Ethers SDK with a local Fakenet:
Remix IDE also has a built-in Solidity Unit Testing plugin for simpler logic checks.
Deploying
Remix IDE
Deploy using Remix IDE with the Injected Provider environment (Armchain Wallet). For a step-by-step walkthrough, see the Quickstart.
Hardhat + Armchain Ethers SDK
⚠ Do not use
hre.ethersfor deployments. Use@armchain-ethersv6/etherswith artifacts generated bynpx hardhat compile.
Run with Node.js directly (not via npx hardhat run, which injects an ECDSA signer):
Contract Verification
Submit your source code to the Armchain Explorer for public verification:
Deploy your contract
Navigate to the contract address on explorer.armchain.org
Click "Verify & Publish"
Submit your source code, compiler version, and constructor arguments
The explorer supports:
Single file verification
Standard JSON input verification
Multi-file verification with imports
Gas Optimization Tips
Since Armchain uses the same gas model as Ethereum (Berlin pricing):
Use
calldatainstead ofmemoryfor read-only function parametersPack storage variables so that
uint128+uint128fits in one 32-byte slotUse
immutableandconstantfor values that don't changeMinimize storage writes since they cost 20,000-5,000 gas
Use events for data that doesn't need on-chain reads
Enable the optimizer with 200+ runs
Security Best Practices
Use OpenZeppelin contracts for standard implementations
Follow checks-effects-interactions pattern to prevent reentrancy
Use
ReentrancyGuardfor state-changing external callsValidate all inputs by checking addresses, amounts, and array lengths
Use access control like
Ownable,AccessControl, or custom modifiersTest thoroughly with unit tests, integration tests, and fuzz tests
Get audited before production deployment
Use timelocks for admin functions in production
Important Notes
No
PUSH0opcode: SetevmVersion: "london"in compiler settings.Instant finality: No confirmation waits. Once mined, the contract is live.
Same address derivation:
CREATEandCREATE2work identically to Ethereum.Gas prices: EIP-1559 fee market. Minimum gas price is 1 Gwei.
Further Reading
Armchain Ethers SDK to interact with contracts from JavaScript
EVM Integration for technical details of Armchain's EVM
Transaction Types for the Type 3 PQC transaction format
Quickstart to deploy your first contract
Last updated