// Developers

Deploy a Smart Contract on Bitroot: Hardhat, Foundry, Remix

Bitroot is EVM compatible, so the tools you already use for Ethereum deploy to it without an adapter layer. You only change the network configuration. This page walks through Hardhat, Foundry and Remix.

1. Before you start

  • Add the network to your wallet and note the RPC URL and Chain ID from BRTSCAN: Add Bitroot to MetaMask.
  • Claim testnet BRT to pay for gas: Testnet faucet guide.
  • Keep the RPC URL, Chain ID and deployer key in environment variables. Do not commit them.

2. Hardhat

hardhat.config.js:

module.exports = {
  solidity: "0.8.24",
  networks: {
    bitrootTestnet: {
      url: process.env.BITROOT_RPC_URL, // current RPC URL from BRTSCAN
      chainId: Number(process.env.BITROOT_CHAIN_ID), // current Chain ID from BRTSCAN
      accounts: [process.env.DEPLOYER_PRIVATE_KEY],
    },
  },
};

Deploy with your usual script:

npx hardhat run scripts/deploy.js --network bitrootTestnet

3. Foundry

foundry.toml:

[rpc_endpoints]
bitroot_testnet = "${BITROOT_RPC_URL}"

Deployment is the same command you would use on any EVM chain:

forge create src/MyContract.sol:MyContract \
  --rpc-url $BITROOT_RPC_URL \
  --private-key $DEPLOYER_PRIVATE_KEY

4. Remix

In the "Deploy & Run Transactions" panel, choose "Injected Provider - MetaMask". As long as MetaMask is connected to Bitroot, compiling, deploying and calling contracts works the same as against Ethereum.

5. Verify the deployment

Open your contract address on BRTSCAN (https://devnet.bitroot.co/overview) and verify the source following the flow shown there, so other users can read the code and call read-only methods from the explorer.

6. Pitfalls worth checking

  • Wrong chain. Compare the Chain ID at runtime, as shown in the network guide, so a typo in a config file cannot send a deployment to another network.
  • Precompile assumptions. Standard Solidity contracts compile and deploy unchanged. Contracts that rely on Ethereum-specific precompile addresses need a check.
  • Gas limits in batches. Estimate gas for batch operations before production runs so a low per-transaction limit does not cause partial failures.
  • Keys. A plaintext .env is acceptable for testnet debugging. Production deployments should use a hardware wallet or MPC custody.

7. Next steps