CLI
Drive contract.dev from your terminal — watch mainnet accounts, push contracts to a Stagenet, generate funded wallets, override balances and state, and pin state to the live chain.
Commands
Account:
login/whoami/logout— connect the CLI to your contract.dev account.workspace— show or switch the workspace the CLI acts on.
Mainnet Analytics:
watch/unwatch— watch mainnet contracts and wallets.
Stagenets:
stagenets/stagenet use— pick the stagenet that stagenet commands target.push-contracts— push compiled contracts from your Hardhat/Foundry project.generate-wallet— generate funded wallets.balance/erc20-balance— set native and ERC20 balances.state— set code, nonce, and storage.impersonate— send transactions from any address.follow/unfollow— pin state to the live chain.function-override— force contract functions to return fixed values.
Install
Install the contract.dev npm package globally (or use npx):
npm install -g contract.devSign in
contract.dev loginThis opens the browser with a one-time code; approving it saves an API key to ~/.contract.dev/credentials.json. In CI, set CONTRACT_DEV_API_KEY instead.
Target a stagenet
Stagenet commands need a stagenet to talk to:
contract.dev stagenets # list the active workspace's stagenets
contract.dev stagenet use my-stagenetOr override per command with --stagenet <name>, or --rpc-url <url> (which needs no login at all).
Run your first commands
# Watch a mainnet contract
contract.dev watch 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 --name "USDC"
# Push your Hardhat/Foundry project's compiled contracts to your stagenet
contract.dev push-contracts
# Generate a funded wallet on your stagenet
contract.dev generate-wallet
# Mint USDC to a recipient on your stagenet
contract.dev erc20-balance add 0xRecipient 0xUSDC 100000000Every command prints usage with help (e.g. contract.dev balance help).
Last updated on