CoinJS (coinjs-lib)
A simple fork of the famous and battle-tested BitcoinJs-lib for use with NodeJs(no browser support) v7+ only.
Features
- All features of
bitcoinjs-lib@3.3.2
. - Integrated Bip39 module.
- Additional networks.
- Support for BCH's CashAddress format.
- Support for Ethereum.
Example
const coinjs = ; // generate mnemonic seed// const mnemonic = coinjs.bip39.generateMnemonic();// or use your own valid bip39 mnemonic seedconst mnemonic = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; // validate mnemonic seedconsole;// => true // mnemonic to seedconst seed = coinjsbip39; const rootNode = coinjsHDNode; // get bip44 constants https://github.com/satoshilabs/slips/blob/master/slip-0044.mdconst ethbip44 = 60;const btcbip44 = 0;const bchbip44 = 145; const ethchild = rootNode;const btcchild = rootNode;const bchchild = rootNode; // get addressesconst ethaddress = ethchild;const btcaddress = btcchild;const bchaddress = bchchild; console;// => 0x9858effd232b4033e47d90003d41ec34ecaeda94console;// => 1LqBGSKuX5yYUonjxT5qGfpUsXKYYWeabAconsole;// => bitcoincash:qqyx49mu0kkn9ftfj6hje6g2wfer34yfnq5tahq3q6 // get private keyconst ethprivkey = ethchild;const btcprivkey = btcchild;const bchprivkey = bchchild; console;// => 1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727console;// => L4p2b9VAf8k5aUahF1JCJUzZkgNEAqLfq8DDdQiyAprQAKSbu8hfconsole;// => KxbEv3FeYig2afQp7QEA9R3gwqdTBFwAJJ6Ma7j1SkmZoxC9bAXZ // All other methods and functions are the same with bitcoinjs-lib