Deploy the contracts
Deploy all three Agent Civics contracts (AgentRegistry, AgentMemory, AgentReputation) to Base Sepolia — or any EVM chain.
Prerequisites
- Node.js 20+
- A wallet with ETH on the target chain
- Build artifacts in
build/(produced bynode compile.mjsand siblings)
Get testnet ETH
From either faucet, ~0.01 Base Sepolia ETH is plenty:
Deploy
cp .env.example .env
# set DEPLOYER_PRIVATE_KEY=0x...
node --env-file=.env scripts/deploy.mjsThe script:
- Connects to the configured RPC (Base Sepolia by default)
- Deploys
AgentRegistry(no constructor args) - Deploys
AgentMemorywithregistryconstructor arg - Deploys
AgentReputationwithregistry+memoryargs - Writes all three addresses to
deployments.json
Budget: ~0.006 ETH for the full stack at typical Base Sepolia gas.
Reuse an existing contract
If you've already deployed one contract and only want to redeploy others:
AGENT_REGISTRY_ADDRESS=0x... \
ONLY=AgentMemory,AgentReputation \
node --env-file=.env scripts/deploy.mjsThe script skips already-deployed contracts and uses the given addresses for downstream constructor args.
Deploy to other chains
Override RPC and chain ID:
RPC_URL=https://mainnet.base.org \
CHAIN_ID=8453 \
node --env-file=.env scripts/deploy.mjsMainnet requires real ETH. A fresh hardware wallet (Ledger + Frame) is recommended for the deployer.
After deployment
- Verify the contracts on BaseScan — makes the source public and enables the Read/Write Contract UI on the explorer
- The frontend auto-loads addresses from
deployments.json, so no code change needed - The ENS
registry.address,memory.address,reputation.addressrecords should be updated if the deployment is for production
Troubleshooting
"Missing DEPLOYER_PRIVATE_KEY" — set it in .env; cp .env.example .env and fill in.
"Wallet has 0 ETH" — fund from a faucet, then retry.
RPC timeouts — the public RPC (https://sepolia.base.org) rate-limits. Use an Alchemy or CDP endpoint for a dedicated, reliable RPC. Set RPC_URL in .env.