How can i generate private key and its address of bitcoin,dogecoin,litecoin etc

0

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.

Ajit Soman

Posted 2018-02-26T05:36:16.897

Reputation: 405

Question was closed 2018-03-09T18:07:01.153

Answers

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);

Adam

Posted 2018-02-26T05:36:16.897

Reputation: 3 215

Can you provide link for java library that does the same functionalityAjit Soman 2018-02-26T07:18:08.327

https://github.com/bitcoinjs/bitcoinjs-libAdam 2018-02-26T08:19:01.247