Automated Multi-Chain Deploy Setup with Foundry

Manual deployment of smart contracts across multiple networks is hours of routine and a risk of errors that slow down project launch. We set up automatic deployment via Foundry multi-chain so that one script deploys contracts in all required networks. Our team delivers the project turnkey—from script to CI/CD—with ongoing support and assurance of stable operation.

Blockchain Development Services

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1335
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1293
  • B2B Advance company logo design
    B2B Advance company logo design
    738
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1031
  • AIDER company logo development
    AIDER company logo development
    978
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1087

Imagine: you deploy a contract on Arbitrum, then Polygon, then BSC. Five networks — five runs of forge script, five address copies, five verifications on explorers. One typo — and hours of debugging. This is the real pain for teams we've worked with. Our experience — over 5 years in blockchain, dozens of successful deployments across 10+ EVM networks — guarantees you avoid these mistakes. We use licensed tools and certified practices.

Automating Foundry multi-chain deployment solves this with a single script, cutting time by 50% and eliminating human error. DevOps budget savings reach 80% — proven on client projects. Want the same result? Contact us for a consultation on architecture.

Why automated deployment is a must-have for multi-chain projects?

Manual deployment across 5 chains takes 30–60 minutes. With Foundry — 2–5 minutes. Idempotency: rerunning does not create duplicates. Verification is automatic via --verify. Scaling: one script for N chains. This is not just convenience but a necessity for cross-chain apps where addresses must match. Foundry's deterministic deployer (0x4e59b44847b379578588920cA78FbF26c0B4956C) exists on all EVM chains, allowing CREATE2 without extra transactions.

How to avoid human errors during deployment?

Automation eliminates manual address entry and checks. Use CREATE2 with a fixed salt — same address on all chains. Idempotent script prevents redeployment. Automatic verification via --verify on each explorer. We guarantee that after setup, you will not encounter nonce errors or lost addresses.

Structure of a Foundry deploy script

A Foundry Script is a Solidity contract inheriting Script from forge-std. It contains the deployment logic executed via forge script --broadcast.

For multi-chain deployment, key is per-chain configuration management. Standard approach: a JSON file with parameters per chain, read via vm.readFile and parsed via stdJson.

deployments/
  config.json # { "arbitrum": { "fee": 100 }, "polygon": { ... } }
  arbitrum.json # { "MyContract": "0x..." } (after deploy)
  polygon.json
script/
  Deploy.s.sol

In Deploy.s.sol, read config via vm.readFile, deploy with needed params, write address to JSON. The code must be idempotent: use vm.assertEq to prevent duplicates.

Component Purpose
config.json Network parameters (fee, oracle, startBlock)
deployments/*.json Files with addresses after deployment
Deploy.s.sol Main deployment logic

How to set up GitHub Actions for deployment on 5 chains?

Setting up CI/CD includes the following steps:

  1. Configure foundry.toml with RPC endpoints and API keys.
  2. Create a deploy script using CREATE2.
  3. Write a bash script to run deploy on multiple chains.
  4. Configure GitHub Actions with a matrix of chains.
  5. Run tests on testnet before mainnet.

Example bash script:

CHAINS=("arbitrum" "polygon" "optimism" "base" "bsc")
for chain in "${CHAINS[@]}"; do
  forge script script/Deploy.s.sol \
    --rpc-url $chain \
    --broadcast \
    --verify \
    --etherscan-api-key $ETHERSCAN_API_KEY \
    -vvv
done

For full multi-chain deployment, use a matrix in GitHub Actions:

---
strategy:
  matrix:
    chain: [arbitrum, polygon, optimism, base, bsc]
  steps:
    - run: forge script ... --rpc-url ${{ matrix.chain }}

Example foundry.toml configuration:

[rpc_endpoints]
  arbitrum = "${ARBITRUM_RPC_URL}"
  polygon = "${POLYGON_RPC_URL}"

[etherscan]
  arbitrum = { key = "${ARBISCAN_API_KEY}" }
  polygon = { key = "${POLYGONSCAN_API_KEY}" }

Deterministic addresses via CREATE2

For cross-chain systems, it is often crucial that the contract has the same address on all chains. CREATE2 computes the address from deployer + salt + bytecode. The same deployer with the same salt yields the same address everywhere.

In Foundry: new MyContract{salt: bytes32("v1")}(constructorArg) automatically uses CREATE2 via the mentioned deployer. Important: if bytecode changes, the address changes — use a proxy pattern (UUPS).

Common mistakes and prevention

Mistake Cause Solution
Different nonce on deployer Nonce shifted due to failed transaction Check cast nonce before deployment
Missing fallback RPC RPC down — deployment stopped Specify 2 RPC endpoints in foundry.toml
Contract overwrite Redeployment without check Use CREATE2 with timestamp in salt on testnet

Comparison of manual and automated deployment

Criteria Manual deployment Automated (Foundry)
Time for 5 chains 30–60 minutes 2–5 minutes
Errors in address entry Frequent Eliminated
Verification Manual on each explorer Auto with --verify
Repeatability Low (nonce-sensitive) Idempotent
Scaling Linear growth One script for N chains

Foundry is 2–3 times faster than Hardhat when deploying on 5 chains due to native batch mode.

What's included in a turnkey setup

As a result, you receive:

  • Solidity deploy script with configs for your chains
  • JSON files with addresses after deployment
  • CI/CD pipeline (GitHub Actions) with a chain matrix
  • Documentation on running and updating
  • Consultation on choosing a deployer (multisig vs EOA)

Contact us for a consultation — we will evaluate your project and propose a deployment configuration that saves development hours.

Timelines and how to order

Setup of Foundry multi-chain deployment for a project with 1–3 contracts on 3–5 chains — from 1 business day. Cost is calculated individually depending on complexity (custom oracles, additional verification logic).

Order setup today and get a consultation on architecture. We guarantee the result: idempotent, reproducible deployment to all target chains.