Mainnet Deployment Guide

Once your contract has been thoroughly tested and audited as per Review and Audit Guide, it’s time to deploy it to THORChain mainnet to be live officially on Rujira. This process involves additional security checks and permissions to ensure the integrity of the contract on the network.

Registry and Permissions

For mainnet, Rujira maintains an on-chain registry that maps each contract’s checksum to its deployer. This registry will grant permissions for instantiation based on the contract’s checksum rather than its code ID. The process will involve:

  1. Registry check: The registry will verify that the deployer is allowed to instantiate a specific contract version, using the contract’s computed checksum.

  2. MsgStoreCore: If the checksum matches the registry entry, the deployer will be granted permission to store the contract on-chain.

  3. MsgInstantiateContract: Once the contract is stored, the deployer can instantiate it with the appropriate parameters.

By tying instantiation permissions to the contract checksum, THORChain node operators and hence the Rujira App Layer ensure that only approved contract versions can be deployed on mainnet, improving security and reliability.

Deployment Steps

  1. Submits a Merge Request to THORNode to whitelist { checksum, deployer } on mainnet

    1. Ensure your contract checksum matches the registry and ties to the final audit report.

    2. Ensure that your deployer address matches the team multisig address from step 6.

    3. Hans will do a final code review and guide through the Merge Request (one MR every Base Layer upgrade).

  2. The Merge Request will be reviewed and must be approved by 2 authorized reviewers from 9R and ThorSec before included in the next THORChain version upgrade.

  3. 2/3 of Node Operators must upgrade to the new THORChain version to allow you to deploy the contracts. You find all contracts approved in wasm_permissions_mainnet.go

  4. Submit MsgStoreCore with the correct checksum to store your contract. Example:

thornode tx wasm store ./artifacts/my_contract.wasm --from deployer-account

  1. Use MsgInstantiateContract to deploy your contract instance on mainnet. You find all contracts instantiated in https://thornode.ninerealms.com/thorchain/codes

thornode tx wasm instantiate 100 '{"some_init": "msg"} --from deployer-account

Last updated