In the rapidly evolving blockchain industry, it’s crucial to keep up with the pace of change. Here’s a quick overview of how we seamlessly integrate new chains into the Mochi system, with the caveat that this method is specific to EVM-based blockchains:

Product Preparation

In this section, most of the tasks require manual handling.

Add new chain to supported chain list

  1. Go to Mochi Pay repository.
  2. Create a migration file as show below.
INSERT INTO "public"."product_supported_chains" ("chain_id", "name", "symbol", "rpc", "explorer", "icon", "is_evm",) VALUES
('1', 'Ethereum Mainnet', 'ETH', '', '', '', 't'),
  1. use the /chains command to see the new changes.

Add token emojis
To enhance the aesthetics of Mochi, we aim to display token emojis whenever possible. Currently, please reach out to @minh_cloud for assistance with this task.

Pull raw data into clickhouse

To store blockchain raw events data in ClickHouse, follow these steps:

  1. Go to Infras repository and create a service with the following configuration, similar to the example
  chainName: base
  chainId: 8453
  syncFromBlockNumber: 2769582
  1. Verify Clickhouse Database Data

Ticker, watchlist and Token info

This step should work automatically. Simply go to Mochi Clients and test out some well-known tokens to ensure that everything is functioning as expected.

Wallet tracking

Wallet tracking is managed within the account-telemetry repository, follow these tasks:

  1. Verify Clickhouse Database Data: should be done at step 1

  2. Update utils package:

    • Use any token of this chain to call Mochi API api/v1/defi/custom-tokens?chain_id=%d&address=%s to see what is the key that represents the new block chain. Using this key to update in the next step. For Example, with the following response, the new chain is Optimistic, but the key that is provided by API is optimistic-ethereum, so we must use this key as the chain name. Because in some places, we need this key to detect token detail platform by chain id. TODO: rename these methods for compatible and readable.
          "optimistic-ethereum": response.TokenDetailPlatform{
             DecimalPlace:    18,
             ContractAddress: "0x9560e827af36c94d2ac33a39bce1fe78631088db",
    • Update the internal/util/chain.go file to add support for the new chain. This involves adding the necessary configurations and logic to handle the data retrieval and notification process for the new chain. Currently, it is just a few utilities that are responsible for convert between chain ID, Name, etc.
      For example:

By completing these tasks, you’ll ensure that wallet tracking in the account-telemetry repository works seamlessly with the new chains, allowing for accurate notifications to users when their tracked accounts receive new transactions.
3. How to test

Show assets in Profile

NOTE: This is the primary step before doing any other below steps
In this part, it is essential to ensure that all widely-recognized tokens from the new chains are added to our database whitelist. To fulfill this requirement, we can follow these steps.

How to test

Everything must be done at step 4, except also need to update list chainIds in the function ListOrCreate of repository mochi-pay-api to support creating new inapp wallet that is used for transfer/deposit/withdraw in the Mochi.

How to test


This is actually done at step 4 and step 5. A token can be withdrawn when it is whitelist in the DB.

NOTE: You must faucet native token to the centralized wallet to pay for gas of withdraw transactions.

How to test
Try using cmd /withdraw and ensure that you give 2 following notifications:


NOTE: You must faucet native token to the centralized wallet to pay for gas of sweeping native/token transactions.

To enable support for deposits on a new chain, follow these essential steps:

  1. Compile and Deploy Deposit Contract:

    • Compile the deposit contract using the contract available in the consolelabs/contract-tip-bot repository.
    • Deploy the compiled deposit contract to the new chain. Ensure that the deployment is successful and that the contract is functioning as expected. Can testing on the testnet first.
  2. Change Ownership to Centralized Wallet Address:

    • Change the ownership of the deployed deposit contract to a centralized wallet address.
  3. Seed Deposit Contract Information:

    • Update the mochi_pay_api by adding information about the newly deployed deposit contract to the deposit_contracts table. This includes details such as the contract address and other relevant information.
  4. Test Deposits:

    • Perform testing to ensure that deposits work smoothly on the new chain. Test depositing a few tokens to verify that the deposit functionality is working as intended. Ensure that you got following notification and the balance is changed