Kalau untuk legacy address mungkin lebih gampang pakai bitaddress
It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
npm install tiny-secp256k1
yarn add tiny-secp256k1
const bitcoin = require('bitcoinjs-lib');
const ecc = require('tiny-secp256k1');
const { BIP32Factory } = require('bip32');
const bip32 = BIP32Factory(ecc);
const ParentXPriv = 'xprv9s21ZrQH143K3bSA5miskqop4mNKY86YEpasxCaEwuxyFdJPr5UaqJo3hLBhz91wAQaXZ6hpLE6eEL9qJW7obcWCgpNurQjtqKhqo8TurVA';
const RootKey = bip32.fromBase58(ParentXPriv);
const AccPath = "m/44'/0'/0'";
const AccChild = RootKey.derivePath(AccPath);
const AccXPriv = AccChild.toBase58();
const BIP32Path = "m/44'/0'/0'/0";
const BIP32Child = RootKey.derivePath(BIP32Path);
const BIP32XPriv = BIP32Child.toBase58();
const path44index7 = "m/44'/0'/0'/0/7";
const child44index7 = RootKey.derivePath(path44index7);
const Wif44index7 = child44index7.toWIF();
const path84index0 = "m/84'/0'/0'/0/0";
const child84index0 = RootKey.derivePath(path84index0);
const Wif84index0 = child84index0.toWIF();
const { address } = bitcoin.payments.p2wpkh({ pubkey: child84index0.publicKey });
console.log('Account Xpriv: ' + AccXPriv);
console.log('BIP32 Xpriv: ' + BIP32XPriv);
console.log('WIF-P2PKH (index 7): ' + Wif44index7);
console.log('Bech32 (index 0): ' + address);
console.log('WIF-Bech32 (index 0): ' + Wif84index0);