btcsnap
btcsnap copied to clipboard
How can i get the derive path
Hello, I want to generate the address from the xpub,but I don't know how to get derive path. This my codes:
const bitcoin = require('bitcoinjs-lib');
const zpub = 'zpub6r1Di2DqG9hrkk3EYQgjxVSr2QJTvtBaLswyknjwPc3eFiBipPWUE8RAhiCKDJxPiYHUpavEFueEuA4NsD82mhPMdPws6LonuuNGhDVyv4Q';
const path = "m/0/1";
const network = bitcoin.networks.bitcoin;
const hdNode = bitcoin.bip32.fromBase58(zpub, network);
const childNode = hdNode.derivePath(path);
const address = bitcoin.payments.p2wpkh({ pubkey: childNode.publicKey, network }).address;
My purpose is to verify that an address is generated by this wallet,thx