Guides › Deploy a contract
Bitcoin Swap is a standard EVM chain (Besu, Cancun rules), so the usual tools work unchanged. Deploying a contract costs a fraction of a cent: a 150,000-gas deployment at the network's 0.001 gwei gas price is about 0.00000016 BTCw. The steps below were run end to end against a fork of the live chain — about five minutes from an empty folder to a deployed, called contract.
1. Network settings
| Chain ID | 482120 |
|---|---|
| RPC | https://rpc.btcw.tech |
| EVM version | cancun — set it explicitly; compilers that default to a newer target may emit code the chain does not run |
| Gas price | 1000000 wei (0.001 gwei); base fee is always 0 |
| Explorer | explorer.btcw.tech (Blockscout, Etherscan-compatible API at /api) |
2. Get a little BTCw for gas
- Swap a few USDw, USDC.e or any of the 323 assets for BTCw on Swap — 0.0001 BTCw covers hundreds of deployments.
- Bring USDC or USD₮0 from Arbitrum with the bridge, then swap.
- Holding tokens but no BTCw at all? The gas faucet sends a small amount once per wallet.
Before using real funds, rehearse every step on a local fork — see Test on a chain fork; the commands below work there with
--rpc-url http://127.0.0.1:8545.
3a. Foundry
forge init hello && cd hello
# foundry.toml, under [profile.default]:
# evm_version = "cancun"
forge create src/Counter.sol:Counter \
--rpc-url https://rpc.btcw.tech \
--private-key $PRIVATE_KEY \
--broadcast
cast send <deployed address> "setNumber(uint256)" 42 --rpc-url https://rpc.btcw.tech --private-key $PRIVATE_KEY
cast call <deployed address> "number()(uint256)" --rpc-url https://rpc.btcw.tech
forge script with --broadcast works the same way. Deterministic (CREATE2) deployments in scripts use the standard deployer
0x4e59b44847b379578588920cA78FbF26c0B4956C, which is live on this chain — so a contract gets the same address here as on other EVM chains.
3b. Hardhat
npm i -D hardhat@2 @nomicfoundation/hardhat-ethers@3 ethers@6
hardhat.config.js:
require("@nomicfoundation/hardhat-ethers");
module.exports = {
solidity: { version: "0.8.24", settings: { evmVersion: "cancun", optimizer: { enabled: true, runs: 200 } } },
networks: {
bitcoinswap: { url: "https://rpc.btcw.tech", chainId: 482120, accounts: [process.env.PRIVATE_KEY], gasPrice: 1000000 },
},
};
scripts/deploy.js:
const hre = require("hardhat");
async function main() {
const c = await hre.ethers.deployContract("Hello");
await c.waitForDeployment();
console.log("deployed to", await c.getAddress());
}
main().catch((e) => { console.error(e); process.exit(1); });
npx hardhat run scripts/deploy.js --network bitcoinswap
@nomicfoundation/hardhat-ethers 4.x needs Hardhat 3; with Hardhat 2 keep version 3 as above.
4. Verify the source
Blockscout accepts the standard verifiers. With Foundry:
forge verify-contract <address> src/Counter.sol:Counter \
--chain 482120 \
--verifier blockscout \
--verifier-url https://explorer.btcw.tech/api/
You can also upload the solc standard-JSON input in the explorer (contract page → Verify & publish). Verification is free and needs no API key.
5. Infrastructure already on the chain
Permit2, EntryPoint v0.7 and Safe 1.3.0 are deployed at their usual addresses — see Addresses. Multicall3 is at its own address (also listed there). There is no need to deploy your own copies.