BTC:
Previously generated private key and address based on path;code show as below:
const bip32 = require('bip32')
const bip39 = require('bip39')
function getAddress (node, network) {
return bitcoin.payments.p2pkh({ pubkey: node.publicKey, network }).address
}
let mnemonic = bip39.generateMnemonic();
const seedBuffer = bip39.mnemonicToSeed(mnemonic)
const root = bip32.fromSeed(seedBuffer)
const BTCChild = root.derivePath("m/44'/0'/0'/0/0")
const BTCAdress = getAddress(BTCChild)//adress by path
const BTCPrivateKey = BTCChild.toWIF()//private key
Now import the private key into the wallet; how to generate an address(BTCAdress) based on the private key(BTCAdress);
Now import the private key into the wallet; how to generate an address(BTCAdress) based on the private key(BTCPrivateKey)?
const bitcoin = require('bitcoinjs-lib')
const keyPair = bitcoin.ECPair.fromWIF(BTCPrivateKey)
const BTCAddressFromWIF = getAddress(keyPair, keyPair.network)
Please format your questions properly.
Thank you.
Sorry ! Wallet business is not familiar. I do not know how to describe. Thank you very much!
Ahora importa la clave privada en la billetera; ¿Cómo generar una dirección (BTCAdress) basada en la clave privada (BTCPrivateKey)?
LA DIRECCION PUBLICA SE PUEDE GENERAR DESDE LA CLAVE PLIVADA WIF "5KMA1fY8AiDQgc8jgGEQPCTKXHm4FgUQ6rbvSkTsYPNY5sfufRv' O DESDE UNA CLAVE HEX "cacc96cbe474b7eab87da1b35eac0206193ca2776cabd862450d83835e6b2ae6"
TIENES QUE ESPECIFICAR QUE ES LO QUE QUIERES HACER