TrustWallet - need dev support

We’ve seen a couple of people asking about BTG on Trust Wallet. It seems they have a clearly laid-out process for devs to contribute to trust wallet.

The work to add BTG to Trust doesn’t seem like a really big lift, but our current devs are fully loaded. I’d like to see this put up with a little bit of bounty for someone, and am looking for other opinions/input. We definitely need one of our devs to do a quick review of the process and asses how much work it really is (I am not qualified to do this.)

What: Trust Wallet is a Binance-Sponsored wallet which has become the official wallet for Binance.

Why: Seems to be continuing to pick up usage and a fair number of coins. Supports all ETH and all Eth-based tokens. Supports BTC and a handful of other coins, but not BTG. We’ve gotten direct requests for it. Binance is something of a monster, so we can expect Trust wallet to continue to grow, getting marketing/development support from Binance.

How: They ask outside projects/devs to develop code for their interface. Full details are here: https://developer.trustwallet.com/wallet-core/newblockchain

Here’s the process, in checklist form, extracted from the link above:


Blockchain checklist

The above steps are summarized below as a checklist:

  • Coin Definition:

    • Add the coin definition to coins.json .

    • Execute tools/generate-files to generate coin-specific generated files.

    • Extend TWCoinType.h and TWBlockchain.h .

    • Extend src/Coin.cpp .

  • Generate skeleton, using codegen/bin/newcoin <coinid>

    • Create tests in tests/X/TWCoinTypeTests.cpp .
  • Implement functionality in C++. Put it in a subfolder of src/ .

    • Address.

    • Transaction (if necessary).

    • Signer.

  • Write unit tests. Put them in a subfolder of tests/ .

    • Mnemonic phrase - > Address derivation test. Put this test in the CoinTests.cpp file.

    • Transaction signing tests, at least a mainnet transaction test.

    • Add stake, unstake, get rewards tests if the blockchain is PoS like.

  • Add relevant constants in TWEthereumChainID , TWCurve , etc., as necessary.

  • Write C interface header in include/TrustWalletCore and implement the interface in src/interface .

    • Address interface.

    • Signing interface.

  • Validate generated code in Android an iOS projects. Write integration tests for each.

  • Extend central derivation and validation tests: make sure the following tests are extended with the new coin: CoinAddressDerivationTests.cpp and CoinAddressValidationTests.cpp , TWHRPTests.cpp , CoinAddressDerivationTests.kt , CoinType+Address.swift , CoinAddressDerivationTests.swift .

  • Upload coin icon to trustwallet/assets if necessary.

Bitcoin forks checklist

If you’re adding a Bitcoin fork, you might not neeed to implement new Address or Signer class, please complete this checklist before you submit a pull request:

  • Derive address according to definition in coins.json , p2pkh address for bip44 or native bech32 segwit address for bip84 .

  • Check SLIP-0132 :Registered HD version bytes.

  • Check fee preference, use static fee or not, Trust will use fee that can be confirmed with in 2 blocks.

  • Add tests to validate all possible addresses, p2pkh , p2sh and bech32 .

  • Add tests to derive xpub / xprv and cross check the values with other wallets, like ledger or trezor.

  • Add tests to derive address from xpub at random index.

  • Add tests to cover lock scripts for all addresses.

  • Add tests to make sure transaction detail url in block explorer is correct.

  • Add a mainnet transaction test, you can construct it by using wallet core and validate it by broadcasting it.

2 Likes

:white_check_mark: Add BTG logo: Add Bitcoin Gold logo by h4x3rotab · Pull Request #622 · trustwallet/assets · GitHub
:hourglass: Implement BTG integration: [WIP] Bitcoin Gold Integration by h4x3rotab · Pull Request #725 · trustwallet/wallet-core · GitHub

1 Like

Glad to see this rapidly pushing forward, and I appreciate you stealing time from other tasks to squeeze this in.

I hope the Community appreciates it.