Skip to content

Instantly share code, notes, and snippets.

@juantellez
juantellez / gist:89aff1e64b107822d02fc02c04fdc97e
Created March 27, 2020 04:12
Bitcoinjs-lib: Generate new test wallet address
/**
* Generate new test wallet address
* Test faucet:
* https://coinfaucet.eu/en/btc-testnet/
*/
async generateWallet(isTestNet: boolean = true) {
console.log(`Generate ${isTestNet ? 'Test' : 'Main'} Wallet`);
const {net, api} = isTestNet
? {net: bitcoin.networks.testnet, api: 'https://test-insight.swap.online/insight-api/addr/'}
: {net: bitcoin.networks.bitcoin, api: 'https://blockchain.info/rawaddr/'};

Keybase proof

I hereby claim:

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 19TmnStbcX7VT9Eina3D5m2baLiNNeugVf https://explorer.blockstack.org/address/19TmnStbcX7VT9Eina3D5m2baLiNNeugVf