0

This question already has an answer here:

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.

marked as duplicate by Зелёный, alcio, chytrik, Willtech, Pieter Wuille Mar 9 '18 at 18:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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.