ByAUJay
Blockchain Deployment Tools: CI/CD for Smart Contracts and Nodes
Decision-makers summary: This guide shows how to build production-grade CI/CD for both smart contracts and blockchain nodes in 2025, with concrete tool choices, workflow snippets, and rollout patterns that reduce risk and time-to-mainnet. It covers EVM and non‑EVM stacks, verification and simulation gates, reproducible builds, supply‑chain attestations, and Kubernetes-based node operations.
Why CI/CD for blockchain is different in 2025
Traditional software deploys to servers you control; web3 deploys to chains you don’t. The consequences of a bad deploy are irreversible, and node infrastructure must track fast-moving client releases and network upgrades. CI/CD needs to enforce determinism, formal safety checks (e.g., storage layout), chain-specific verification, pre-flight simulations against live state, and auditable provenance for regulators and partners.
What follows is a practical reference you can adapt to your stack today.
The 2025 tooling landscape at a glance
- Smart contracts (EVM):
- Build/test: Foundry (forge/cast/anvil), Hardhat 3.
- Upgrades/validation: OpenZeppelin Upgrades plugins and ERC‑7201 namespaced storage checks. (docs.openzeppelin.com)
- Static/dynamic analysis: Slither, Echidna, Mythril, Halmos. (github.com)
- Verification: Hardhat Verify (multi-explorer) and Sourcify. (hardhat.org)
- Simulation/staging: Tenderly Virtual TestNets and Simulation RPC (Forks deprecated March 31, 2025). (docs.tenderly.co)
- Supply chain: GitHub artifact attestations (SLSA provenance) + Sigstore cosign. (docs.github.com)
- Node infrastructure (Ethereum):
- Clients: Geth (snap + checkpoint/BL sync), Erigon 3 (prune modes), Nethermind, Besu. (geth.ethereum.org)
- K8s: Hyperledger Besu Helm patterns; community charts by ethPandaOps for EL/CL, metrics, and explorers. (besu.hyperledger.org)
- Observability: native Prometheus metrics endpoints in Geth/Nethermind/Besu. (geth.ethereum.org)
- Key/secrets:
- GitHub OIDC to cloud (no static keys) + Vault OIDC for secrets; Web3Signer for remote signing; Safe CLI for human-in-the-loop deploy approvals. (github.com)
- Note on Defender: New sign-ups were disabled June 30, 2025; plan migrations if you rely on Defender Relayers/Workflows. (docs.openzeppelin.com)
Part 1 — CI for smart contracts (EVM)
Repository and build profiles
- Use a mono-repo with:
- contracts/ (Solidity), test/ (Foundry or Hardhat), scripts/ (deploy), deploy/ (network configs), audits/ (reports), ci/ (workflows), docs/.
- Hardhat 3 introduces build profiles; compile and verify with the same profile (e.g., production) to avoid mismatches during verification. (hardhat.org)
Example (Hardhat 3 verification with production profile):
# Build and verify with the same profile npx hardhat build --build-profile production npx hardhat verify --network mainnet DEPLOYED_ADDRESS "arg1"
Deterministic compilation matrix
- Pin solc versions via foundry.toml or hardhat.config and test against the exact compiler + optimizer settings you will deploy with. Include a matrix for L2s (chainIds, EIPs enabled) and for bytecode linkage/library addresses.
Static analysis gates
- Slither in CI for fast detectors and custom checks:
python3 -m pip install slither-analyzer slither . --solc-remaps @openzeppelin=node_modules/@openzeppelin
Slither integrates well with Foundry/Hardhat builds and supports custom detectors (e.g., upgradeability checks). (github.com)
- Symbolic and property testing:
- Echidna for invariants; wire via the official GitHub Action and store corpus for regression. (github.com)
- Mythril for bytecode-level symbolic execution on critical artifacts. (github.com)
- Halmos to leverage existing Foundry tests for symbolic exploration. (github.com)
Upgrade safety and storage layout
- Enforce storage layout compatibility across releases with OpenZeppelin Upgrades:
- validateUpgrade/prepareUpgrade in CI, and block merges on layout diff.
- Prefer ERC‑7201 namespaced storage (OpenZeppelin Contracts 5.x upgradeable variants) to reduce risk when changing inheritance. (docs.openzeppelin.com)
Example (Foundry) in CI:
# After forge build, run OZ upgrade validations npx ts-node ./ci/check-upgrade.ts # calls @openzeppelin/upgrades-core validate
OpenZeppelin Upgrades Core exposes a CLI and API to run these validations headlessly in CI. (docs.openzeppelin.com)
Gas, fuzz, and invariants as quality budgets
- Treat gas snapshots (Foundry) and invariant test counts as budgets. Fail CI if gas exceeds thresholds on critical functions or if invariant coverage drops.
Pre-flight simulations against live state
- Shift from testnets-only to “simulate against mainnet state” to catch mempool and MEV realities:
- Use Tenderly Simulation RPC to run tenderly_simulateTransaction and tenderly_simulateBundle in CI before promoting a deployment. (blog.tenderly.co)
- Migrate any legacy “fork” steps to Virtual TestNets (Forks deprecated March 31, 2025). (docs.tenderly.co)
Multi-explorer verification (Etherscan, Blockscout, Sourcify)
- Hardhat Verify supports multi-provider verification and programmatic verification; align the build profile as above. (hardhat.org)
import hre from "hardhat"; import { verifyContract } from "@nomicfoundation/hardhat-verify/verify"; await verifyContract( { address, constructorArgs, provider: "sourcify" }, hre );
- Prefer Sourcify “full metadata” verification wherever supported for long-term reproducibility. (docs.sourcify.dev)
- For ZK chains (e.g., zkSync Era), use their Hardhat verification plugin when appropriate. (docs.zksync.io)
Supply-chain provenance and attestations
- Generate signed build provenance (SLSA in-toto) for artifacts (bytecode, ABI, addresses.json) using GitHub’s attest-build-provenance action; add Sigstore verification in your admissions/gates. (github.com)
permissions: id-token: write contents: read attestations: write - uses: actions/attest-build-provenance@v3 with: subject-path: 'artifacts/**/*.json'
- For containerized tools (builders or deployers), sign images with cosign in CI. (github.com)
Part 2 — CD for smart contracts (gating and execution)
Environment gates and secrets
- Use GitHub Environments to gate promotion; require reviewers for mainnet, and store environment-scoped secrets there. (docs.github.com)
- Eliminate static cloud keys: assume cloud roles with GitHub OIDC (id-token: write) to fetch deployer secrets or connect to private RPC. (github.com)
- Pull secrets from Vault using OIDC JWT auth (no long-lived tokens in CI). (github.com)
Key custody and approvals
- Separate “build signer” from “on-chain signer.” For on-chain changes, propose via CI and execute via multisig:
- Use OpenZeppelin Upgrades’ prepareUpgrade to deploy implementations but require a Safe to execute the upgrade transaction.
- Safe CLI can script proposals/executions; combine with manual reviewer gates in Environments. (pypi.org)
Note on Defender
- If you rely on Defender Relayers/Workflows, plan a 2025–2026 migration. New sign-ups are disabled (June 30, 2025) and shutdown is scheduled for July 1, 2026; follow OpenZeppelin’s migration guidance or self-hosted equivalents (e.g., Web3Signer + custom relayers). (docs.openzeppelin.com)
Part 3 — CI/CD for blockchain nodes
Running your own nodes (RPC, indexers, validators) requires release-aware pipelines, safe rollouts, and strong observability.
Client choices and sync modes (Ethereum)
- Geth: default Snap sync; checkpoint or beacon-light sync accelerates CL startup. Expose Prometheus metrics via --metrics flags. (geth.ethereum.org)
- Erigon 3: new prune modes (minimal/full/archive) + receipts persistence options; “all-in-one” mode with embedded consensus client; flags differ from Geth. (docs.erigon.tech)
- Nethermind: robust Prometheus metrics for syncing/trie internals; good for monitoring-heavy setups. (docs.nethermind.io)
- Besu: official Docker images and K8s guides; publishes Prometheus metrics; solid choice for enterprise networks. (besu.hyperledger.org)
Kubernetes deployment patterns
- Use community Helm charts from ethPandaOps to compose EL/CL, sentry topology, rpc proxies, explorers, and metrics exporters (ethereum-node umbrella, checkpointz, ethereum-metrics-exporter, blockscout). (github.com)
helm repo add ethereum-helm-charts https://ethpandaops.github.io/ethereum-helm-charts helm search repo ethereum-helm-charts helm install execution ethereum-helm-charts/geth \ --values values/geth-prod.yaml
ethPandaOps charts include components like checkpointz for CL checkpoint sync and exporters for EIP‑4844 blob monitoring, which are useful during network upgrades. (github.com)
- Production K8s hardening:
- set runAsNonRoot, readOnlyRootFilesystem, resource requests/limits;
- anti-affinity for EL/CL pods; PDBs for HA;
- PVCs on fast NVMe; distinct storage classes for archive pods;
- network policies to restrict inbound RPC to your API layer.
Observability
- Scrape native metrics:
- Geth: /debug/metrics/prometheus with --metrics flags. (geth.ethereum.org)
- Nethermind: extensive metrics namespaces (sync, trie, AuRa, shutter, etc.). (docs.nethermind.io)
- Besu: Prometheus scrape annotations and Grafana dashboards in the official k8s tutorial. (besu.hyperledger.org)
Rollout strategy
- Blue/green nodes per client and per network (e.g., mainnet, L2s) with cutover via your RPC proxy/load-balancer (e.g., dshackle/erpc, also available as charts). (github.com)
- For major forks, pre-stage new client versions and warm sync from snapshots or checkpoint sync; rehearse in a private devnet—Kurtosis’ ethereum-package helps spin up ephemeral multi-client testnets for dress rehearsals. (github.com)
Key management for validators and bots
- Keep private keys out of nodes; use Web3Signer for EL/CL signing (BLS + secp256k1) backed by disk or external vault. (docs.web3signer.consensys.net)
Part 4 — Non‑EVM notes (Solana and Cosmos)
Solana
- Local program testing: solana-test-validator offers full-featured single-node clusters, account cloning, and BPF program loading—use it in CI. (docs.solanalabs.com)
- Official docs provide validator operations and CLI guidance; pair with community Prometheus exporters for monitoring (e.g., SolanaExporter). (docs.solanalabs.com)
- For program teams, mirror the EVM approach: pre-flight simulation on local validator, then on testnet, then canary on mainnet with small upgrade authority windows.
Cosmos/CosmWasm
- Reproducible contract builds: use cosmwasm/optimizer Docker (or cw-optimizoor) for deterministic, minimized WASM in CI; publish checksums. (github.com)
- Chain CI: for app-chains, Ignite CLI accelerates scaffold, test, and launch; modern docs reflect CometBFT (formerly Tendermint). (docs.ignite.com)
Reference CI example (GitHub Actions, EVM)
Below is a compact but production-ready workflow you can adapt. It emphasizes defense-in-depth: analysis, upgrade validation, simulation gates, verification, and signed provenance.
name: contracts-ci on: push: branches: [ main ] pull_request: permissions: contents: read id-token: write # for OIDC to cloud/Vault and attestations attestations: write jobs: test-analyze: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # Setup toolchains (Node + Foundry) - uses: actions/setup-node@v4 with: { node-version: '20' } - name: Install Foundry run: curl -L https://foundry.paradigm.xyz | bash && ~/.foundry/bin/foundryup # Install deps - run: npm ci # Compile & unit tests (Foundry) - run: | forge --version forge test -vvv --ffi --gas-report # Static analysis - name: Slither run: | python3 -m pip install slither-analyzer slither . --solc-remaps @openzeppelin=node_modules/@openzeppelin # Fuzz invariants (Echidna) — keep short on PRs, longer on nightly - name: Echidna (smoke) uses: crytic/echidna-action@v2 with: files: src test-mode: property format: text test-limit: 2000 # Upgrade/storage layout validation - name: OZ Upgrades validate run: node ci/validate-upgrades.js # Pre-flight simulation (Tenderly Simulation RPC) - name: Simulate deployment script run: node ci/simulate.js # calls tenderly_simulateTransaction env: TENDERLY_ACCESS_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }}
- Slither/Echidna integrate cleanly into GitHub Actions. (github.com)
- Tenderly Simulation RPC lets you run pre-deploy simulations against latest chain state from CI. (blog.tenderly.co)
Promotion to mainnet with environment protection, OIDC, verification, and attestations:
deploy-mainnet: needs: [ test-analyze ] runs-on: ubuntu-latest environment: mainnet # requires approval & grants env secrets steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: '20' } # Assume cloud role via OIDC (no static keys) - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::123456789012:role/ci-deployer aws-region: us-east-1 # Fetch deploy secrets from Vault via OIDC JWT - uses: hashicorp/vault-action@v2 with: method: jwt url: ${{ secrets.VAULT_URL }} role: ci-deployer secrets: | kv/data/contracts DEPLOYER_KEY | DEPLOYER_KEY - run: npm ci # Hardhat build/verify with production profile - run: npx hardhat build --build-profile production - run: node scripts/deploy.js --network mainnet - run: npx hardhat verify --network mainnet $(cat deployments/mainnet/Address.json | jq -r .MyContract) # SLSA provenance attestation for artifacts - uses: actions/attest-build-provenance@v3 with: subject-path: 'artifacts/**'
- OIDC to AWS/GCP/Azure is the 2025 best practice for short-lived credentials. (github.com)
- Vault OIDC avoids putting long-lived secrets in GitHub. (github.com)
- Hardhat Verify build-profile alignment avoids verification mismatches. (hardhat.org)
- Attestations provide signed provenance (enforce at your K8s admission or release gates). (docs.github.com)
For upgrades, have CI propose the upgrade and a Safe approval step execute it. (pypi.org)
Reference CD example (nodes on Kubernetes)
Helm-based approach with Prometheus/Grafana out of the box and safe rollouts:
# Add repos helm repo add ethereum-helm-charts https://ethpandaops.github.io/ethereum-helm-charts helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update # Observability helm install monitoring prometheus-community/kube-prometheus-stack \ --namespace eth --create-namespace # Execution client: Geth or Erigon helm install geth ethereum-helm-charts/geth -n eth -f values/geth-prod.yaml # or helm install erigon ethereum-helm-charts/erigon -n eth -f values/erigon-prod.yaml # Consensus client and checkpoint sync provider helm install checkpointz ethereum-helm-charts/checkpointz -n eth
- The Besu docs also provide a complete K8s walkthrough including Prometheus scrape annotations and Grafana dashboards; you can adapt the same pattern for EL/CL stacks. (besu.hyperledger.org)
- Geth metrics endpoint exposes Prometheus format at /debug/metrics/prometheus when enabled. (geth.ethereum.org)
- Erigon 3 prune modes let you right-size disk/performance for RPC vs archive needs. (docs.erigon.tech)
Operational tips:
- Protect public RPC with an RPC proxy that enforces method allow-lists, rate limits, and per-IP budgets (e.g., dshackle/erpc charts). (github.com)
- For forks/upgrades (e.g., Pectra), stage client versions early across blue/green nodes; use checkpoint sync and switch traffic post-health. (ethpandaops.io)
Emerging practices to adopt now
- Namespaced storage (ERC‑7201) in upgradeable contracts to reduce inheritance/slot hazards in future upgrades. (docs.openzeppelin.com)
- Hardhat 3 build profiles: standardize on “production” for build + verify to eliminate class of CI flakiness. (hardhat.org)
- Tenderly: migrate legacy fork-based tests to Virtual TestNets; use Simulation RPC for PR gates. (docs.tenderly.co)
- Erigon 3 “minimal/full/archive” pruning for cost-effective RPC fleets; reset with clean re-sync when switching modes. (docs.erigon.tech)
- GitHub artifact attestations to reach SLSA L3 build provenance with reusable workflows; enforce in cluster with admission policies. (docs.github.com)
- Plan OpenZeppelin Defender migrations before mid‑2026; evaluate Web3Signer + Safe + custom relayer stack. (docs.openzeppelin.com)
What 7Block Labs would implement for you (pattern you can copy)
- Contract CI: Foundry + Slither + Echidna + Halmos; OZ storage checks; Tenderly sim gate; multi-explorer verification; addresses.json + ABI + provenance attestations.
- CD: GitHub Environments with required reviewers; cloud access via OIDC; secrets from Vault; Safe-based execution for privileged actions.
- Nodes: K8s Helm charts per client; blue/green rollouts; checkpoint sync; RPC proxy; Prometheus + Grafana; Web3Signer-backed keys; disaster-recovery runbooks.
Brief, in-depth details: edge cases we actually see
- Verification failures on Etherscan after Hardhat 3 upgrade often trace to mismatched build profiles—pin “production” for both build and verify. (hardhat.org)
- Storage layout regressions when adding base contracts are caught earlier when using ERC‑7201 + OZ plugins; make “validateUpgrade” a required status check. (docs.openzeppelin.com)
- Tenderly “simulate bundle” helps catch upgrade initializer ordering issues that won’t show in unit tests because live proxies already hold state. (docs.tenderly.co)
- Geth sync issues on fresh clusters drop dramatically when CL checkpoint sync is used (seconds-to-minutes to finality baseline) before switching to steady-state. (geth.ethereum.org)
- Erigon’s prune.mode=minimal is handy for wallet/bot infra where historical queries are outsourced; but switching prune modes requires a re-sync—plan the maintenance window. (docs.erigon.tech)
- For Cosmos/CosmWasm, using cosmwasm/optimizer in CI yields reproducible WASM and a checksums.txt; publish both alongside your deployment if you need audit-grade traceability. (github.com)
Final checklist
- Contracts
- Static analysis (Slither), property fuzzing (Echidna), symbolic (Mythril/Halmos). (github.com)
- Upgrade/storage layout checks (OZ), ERC‑7201 where possible. (docs.openzeppelin.com)
- Live-state simulations (Tenderly Sim RPC/Virtual TestNets). (blog.tenderly.co)
- Multi-explorer verification (Hardhat Verify + Sourcify). (hardhat.org)
- Signed provenance (attest-build-provenance) and container signing (cosign). (github.com)
- Nodes
- Client choice and sync mode documented (Geth snap/checkpoint, Erigon prune). (geth.ethereum.org)
- Helm-based rollouts and Prometheus metrics wired; RPC proxy in front. (github.com)
- Web3Signer or HSM-backed signing keys; secrets via Vault OIDC; CI cloud access via GitHub OIDC. (docs.web3signer.consensys.net)
- Fork rehearsal or Virtual TestNet dress rehearsal before mainnet cutover. (docs.tenderly.co)
If you adopt even half of these practices, your team will ship faster, safer, and with an audit-friendly trail that future partners and regulators will appreciate.
Like what you're reading? Let's build together.
Get a free 30‑minute consultation with our engineering team.

