iancoleman / bip39

A web tool for converting BIP39 mnemonic codes
https://iancoleman.io/bip39/
MIT License
3.41k stars 1.42k forks source link

Generate all addresses from a HEX key? #628

Open zilveer opened 1 year ago

zilveer commented 1 year ago

Hi, first of all thanks for such a great script, I love it truly!

I wonder if it is possible through the functions you use in this script to actually generate all the addresses belonging to a HEX key (depending of the choosen coin of course). For i.e the HEX key 0000000000000000000000000000000000000000000000000000000000000001 would give us the following addresses:

P2PKH Compressed: 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH BECH32: bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 P2SH: 3JvL6Ymt8MVWiCNHC7oWU6nLeHNJKLZGLN P2PKH Uncompressed: 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm

What functions can I use to achieve this? All kind of help is appreciated.

regards Zilveer

zilveer commented 1 year ago

Hi, so I started with this just to be able to generate an address from a HEX key:

var privateKey = libs.buffer.Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', "hex");
var wifFromPrivKey = libs.bitcoin.ECPair(privateKey, null, {network: libs.bitcoin.networks.bitcoin, compressed: true}).toWif();
var test = libs.bitcoin.ECPair.fromWIF(wifFromPrivKey, libs.bitcoin.networks.bitcoin);

but I am getting error: Uncaught TypeError: d.signum is not a function

What am I doing wrong? I am trying to follow this example:.

regards Zilveer

zilveer commented 1 year ago

Can someone please guide me here ?