I’m customizing https://coinb.in/ wallet.
var compressed = coinjs.compressed; coinjs.compressed = true; var coin = coinjs.newKeys(); // keys are changing... var sw = coinjs.bech32Address(coin.pubkey); var address = sw.address; coinjs.compressed = compressed; console.log(address);
This works as expected, but it generates new bitcoin addresses because of newKeys(). I don’t own them.
I need set my own xpub. So I’m trying this:
var pubkey = "xpub661MyMwAqRbcFAYRXx71gFgohbagK22EwLd24pQE98PfQKvtJDP6bFWge2N6WJjhhNriBYdjHadGwtFj8HaTG6s4HnprSpNZ7x2xo9Ag4RU"; // I need set my own xpub. var b32 = coinjs.bech32Address(pubkey); addr = b32.address; console.log(addr); // bc1q9m6yz90ekwdrgum294w7z85cth7muk600gnvxh
The issue here is that it gives always the same address (bc1q9m6yz90ekwdrgum294w7z85cth7muk600gnvxh).
I need somehow generate always new random bitcoin addresses (from my own xpub).