Trust Developers
  • Get Started
  • Developing for Trust Wallet platform
    • Browser Extension
      • Ethereum & EVM chains
    • Mobile (WalletConnect)
    • Deep Linking
  • Listing new dApps
    • A Complete Guide to Listing your dApp with Trust Wallet
    • Optimizing your dApp for Trust Wallet
    • Debugging
  • Listing new assets
    • Add Asset
    • Requirements
    • Pull Request Fee
    • FAQ
    • Repository Details
    • Universal Asset ID
  • Wallet Core
    • New Blockchain Support
      • RPC / API Requirements
      • New EVM-compatible chain
    • Developing the Library
      • Contributing
      • Building
      • WalletConsole utility
      • Coverage
      • Releasing
    • Integration Guide
      • Usage Guide
      • iOS Integration Guide
      • Android Integration Guide
      • Server-Side
    • References
      • Swift API Reference
      • Kotlin API Reference
    • FAQ
  • Barz - Smart Wallet
    • Introducing Barz. TrustWallet's Smart Wallet Solution
    • Cutting Diamonds: How to make Accounts Awesome
    • Build with Trust Wallet and Barz, A Comprehensive Guide to Integrating Barz with AA SDK
Powered by GitBook
On this page
  • Prerequisties / Needed information
  • Steps
  • Some Sample PRs:

Was this helpful?

  1. Wallet Core
  2. New Blockchain Support

New EVM-compatible chain

PreviousRPC / API RequirementsNextDeveloping the Library

Last updated 1 year ago

Was this helpful?

Adding support for a new fully EVM-compatible chain to Wallet Core requires only a few changes, follow the steps here. For more complex chain integrations, see .

Prerequisties / Needed information

  • ChainID. EVM chains have a unique ChainID, such as 8217.

  • Derivation path used. Most EVM chains use Ethereum derivation path, "m/44'/60'/0'/0/0" (but not all).

  • CoinID. Most EVM chains do not have a SLIP 44 CoinID, but some do. We'll see below what to use if one is not available.

Steps

  • Start with an up-to-date workspace ().

  • Add chain information to registry.json. Some notable fields:

    • blockchain: "Ethereum",

    • coinId: If own coinID is available, use that. Otherwise, use: 10000000 + chainID, such as 10008217.

  • Run cd codegen-v2 && cargo run -- new-evmchain <chain> to generate template source files, where is the chain id from registry.

  • The result will be a new line in TWCoinType.h and a new test file tests/<Chain>/TWCoinTypeTests.cpp.

  • There are some test cases test derivation for all coins. Extend these with the new chain. If the new chain reuses Ethereum address, it can reuse the Ethereum case in the switch statements.

rust/tw_any_coin/tests/coin_address_derivation_test.rs
tests/common/CoinAddressDerivationTests.cpp
android/app/src/androidTest/java/com/trustwallet/core/app/blockchains/CoinAddressDerivationTests.kt
kotlin/wallet-core-kotlin/src/commonTest/kotlin/com/trustwallet/core/test/CoinAddressDerivationTests.kt
swift/Tests/CoinAddressDerivationTests.swift
./tools/build-and-test
  • If all is fine, create a PR with the changes.

Some Sample PRs:

Update generated sources, build the project, execute unit tests (see ):

general new blockchain docs
more info
building
github.com/trustwallet/wallet-core/pull/2307
github.com/trustwallet/wallet-core/pull/2157