Skip to main content

Requesting Chain Support

Do you want to verify contracts on an EVM chain? Great! We don't want to be the single source of truth and encourage you to run your own Sourcify instance.

If you still want to request an EVM chain to be supported by Sourcify, please open a pull request with the instructions below for a speedy process:

  1. Make sure the new chain is listed in chains.json but this file should not be edited. It is kept in sync with chainid.network (github: ethereum-lists/chains) periodically. If your chain is not included, please first add your chains to the ethereum-lists/chains repository first.

  2. Fork the repository. Branch out from the staging branch with name add-chain-{chainId} (e.g. for Ethereum Mainnet add-chain-1). This branch name format is required for automated testing. For each chain (testnet, mainnet etc.) a new branch and a new pull request is required.

  3. Add the chain details in sourcify-chains.ts similar to other chains with supported: true and monitored: false. If your chain uses an Etherscan or Blockscout fork, use the same regex for other chains with the same block explorer. This field is used for verification with immutables via the creation bytecode.

  4. Install and build the project with npx lerna bootstrap and npx lerna run build.

  5. Provide test contracts:

    1. Deploy one contract with immutables and one normal contract. This enables displaying if it is possible to verify contracts with immutables on this chain in the supported chains table. There are several options:
      1. Using the provided script: You can easily deploy both contracts with an account private key using test/chains/deployContracts.js. See node deployContracts.js --help.
      2. Sending a raw transaction with a web wallet:
        1. You can send a raw tx with the contract's creation code using https://www.myetherwallet.com/wallet/deploy and choose your wallet. Paste the bytecode and abi found in test/chains/sources/shared/1_Storage.json and send the transaction with your wallet.
        2. For the immutables contract paste the bytecode and abi in test/chains/sources/shared/WithImmutables.json and set a constructor argument value. Take note of the value as you'll need it in the next steps.
      3. Using Remix:
        1. Copy-paste the contract test/chains/sources/shared/1_Storage.sol. Use the compiler settings defined in the metadata: compiler version 0.8.7+commit.e28d00a7 and optimizer disabled on Remix, you should have exactly the same metadata file. You can check by pasting and decoding the bytecode 60a0604... at playground.sourcify.dev that it matches to ipfs://QmSffyjwZxAWUYaAiE25YPpKYyBegQKCBnnBK3tknDSgJ5. Take note of the contract address.
        2. Copy-paste the contract test/chains/sources/shared/WithImmutables.sol. If you use the compiler settings defined in the metadata: compiler version 0.7.4+commit.3f05b770 and optimizer disabled on Remix, you should have exactly the same metadata file. You can check by pasting and decoding the bytecode 60a0604... at playground.sourcify.dev that it matches to ipfs://QmPNMaNYjzjA9oHrNdeACBNaDVpdbrbY73QJjB35AD8PHv. Take note of the contructor argument and the contract address.
    2. If you are not able to deploy new test contracts above (e.g. because it costs on a mainnet) you can provide existing contracts. Create a folder test/chains/sources/{chainId} and store the contract source files and metadata of already deployed contracts there.
  6. Add the test for the new chain in test/chain/chain-tests.js similar to other chains. Use the functions verifyContract or verifyContractWithImmutables. If you used the script deployContracts.js the contract and the metadata are the following:

    • Storage.sol: shared/1_Storage.sol and shared/1_Storage.metadata.json
    • withImmutables.sol: shared/WithImmutables.sol and shared/withImmutables.metadata.json
  7. To test locally run NEW_CHAIN_ID={chainId} npx mocha test/chains/chain-tests.js --exit

  8. Open a pull request targeting the Sourcify staging branch.

If the tests pass, the chain will be added quickly. The chain will be added to production (master branch) with the next release, which usually happens in 1-2 weeks.