0

Is there any way i can generate private key and address of bitcoin and bitcoin forks(litecoin,dogecoin etc...).

For bitcoin I have used BitcoinJ to generate private key and address but for litecoin and dogecoin I can't find any. Is there is any algorithm or code available to generate private key and address for all bitcoin forked coin.

1

Yeah, you can do that since the only difference between all bitcoin forks addresses is just the prefixes.

For example for Litecoin and bitcoin you could do something like that to generate address from XPUP on Bitcoinjs:

var bitcoin = require('bitcoinjs-lib');
import HDNode from "../../bitcoinjs-lib/src/hdnode";

const litecoin = bitcoin.networks.litecoin
const xpub = "YOUR XPUP HERE";
const node = HDNode.fromBase58(xpub, litecoin);
const address = node.derive(0).getAddress(litecoin);
// Bitcoin
const bitcoin = bitcoin.networks.bitcoin
const xpub = "YOUR XPUP HERE";
const node = HDNode.fromBase58(xpub, bitcoin);
const address = node.derive(0).getAddress(bitcoin);

Not the answer you're looking for? Browse other questions tagged or ask your own question.