GemHQ / money-tree

A Ruby implementation of Bitcoin HD Wallets (Hierarchical Deterministic) BIP32
MIT License
185 stars 68 forks source link

how can we adopt this to litecoin? #32

Closed krtschmr closed 5 years ago

netiko commented 5 years ago

base on https://github.com/lian/bitcoin-ruby/blob/master/lib/bitcoin.rb#L751 , i've been working on a network for litecoin

here where I succeeded to get

    litecoin: {
      address_version: '30',
      p2sh_version: '32',
      p2sh_char: '3',##TODO
      privkey_version: 'b0',
      privkey_compression_flag: '01',##TODO
      extended_privkey_version: "019d9cfe",
      extended_pubkey_version: "019da462",
      compressed_wif_chars: %w(K L),##TODO
      uncompressed_wif_chars: %w(5),##TODO
      protocol_version: 70002
    },
    litecoin_testnet: {
      address_version: '6f',
      p2sh_version: '3a',
      p2sh_char: '2',##TODO
      privkey_version: 'ef',
      privkey_compression_flag: '01',##TODO
      extended_privkey_version: "0436ef7d",
      extended_pubkey_version: "0436f6e1",
      compressed_wif_chars: %w(c),##TODO
      uncompressed_wif_chars: %w(9),##TODO
      protocol_version: 70002
    }

the ##TODO is value I could not find and for with I kept bitcoin's value

with it, I succeed to generate address corresponding to what I could see on https://iancoleman.io/bip39/

krtschmr commented 5 years ago

@netiko so would this be ready for production, just enough so we can generate receiving addresses which would equal to the electrum addresses?

krtschmr commented 5 years ago

@netiko allright, i have tested it and it's working!

https://github.com/krtschmr/money-tree/blob/master/lib/money-tree/networks.rb

thanks a lot