Skip to content

Instantly share code, notes, and snippets.

@coreyphillips
Last active March 13, 2020 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreyphillips/91de5d15964797054988522664cc3150 to your computer and use it in GitHub Desktop.
Save coreyphillips/91de5d15964797054988522664cc3150 to your computer and use it in GitHub Desktop.
Moonshine Altcoin Implementation Guide

Altcoin Support

Please be aware and take note that my primary focus is on expanding the core functionality of this wallet and not on adding altcoins. However, for those wishing to add a specific altcoin for personal use, this guide was created so that you may fork off in a proper fashion. If you have any questions I'm always happy to help so don't hesitate to reach out.

Feel free to use the following commit as a reference to what changes need to be made: https://github.com/coreyphillips/moonshine/commit/0eeecdeea7a9004bacf6db369cec61bc2c930962

Files that will need to be modified/updated for this process:

Step 1: Modify peers.json in electrum-host-parse

  • Add the necessary servers to the /fixture/peers.json file. This server list is used to kickstart the peerlist for the wallet.

Step 2: Modify networks.js & Add New Coin Image To /src/assets

  1. Add the necessary network params to the networks object in /src/utils/networks.js.
  2. Using the same key that you used in the networks object, add the coin to the zeroValueItems & arrayTypeItems objects.
  3. Using the same key, add the coin to defaultWalletShape.keyDerivationPath with a default value of "84".
  4. Using the same key, add the coin to defaultWalletShape.addressType with a default value of "bech32".
  5. Using the same key, add the coin to defaultWalletShape.addressType with a default value of "bech32".
  6. Add the coin's image to /src/assets
  7. Add the coin to the switch statement in getCoinImage and ensure it matches up with and requires the new image that was just added.
  8. Add the coin to the switch statement in getCoinData. This will ensure the app displays the correct cryptoUnit label for the selected coin.

Step 3 (Optional): Modify walletApi.js

  • Add the necessary api to push a rawTx for the new coin to the fallbackBroadcastTransaction method. In the event that a transaction fails to send via Electrum, this api will be used to push the rawTx instead.
  • All you'll need to do here is add the new coin to the this.mainClient, this.peer & this.peers objects.

Step 5: Modify TransactionDetail.js

  1. Locate the openAddress method and add the proper url of a block explorer to view the details of an address for the new coin.
  2. Locate the openMessage method and add the proper url of a block explorer for the new coin to view any OP_RETURN message in a transaction.
  3. Locate the openBlock method and add the proper url of a block explorer to view a block for the new coin.

Step 6: Modify helpers.js

  • Locate the openTxId method and add the proper url of a block explorer to view a transaction for the new coin.

Note: An easy way to ensure you've made all of the appropriate modifications is to search for "litecoinTestnet". If the new coin is not listed or detailed next to one of the "litecoinTestnet" matches you most likely need to add the new coin there as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment