Hello So I’m utilizing the bitcoinjs-lib pacakge to generate pockets deal with and personal keys domestically nevertheless it looks as if it is creating the litecoin deal with of legacy kind, my aim is right here to create of segwit kind which has a prefix like tltc
right here is my code:
const bitcoin = require('bitcoinjs-lib');
perform generateLtcAddress() {
const litecoinTestnet = {
messagePrefix: 'x19Litecoin Signed Message:n',
bip32: {
public: 0x043587cf,
non-public: 0x04358394
},
pubKeyHash: 0x6f,
scriptHash: 0xc4, // for segwit (begin with 2)
wif: 0xef
};
const keyPair = bitcoin.ECPair.makeRandom({ community: litecoinTestnet });
const { deal with } = bitcoin.funds.p2pkh({
pubkey: keyPair.publicKey,
community: litecoinTestnet
});
const privateKeyWIF = keyPair.toWIF();
console.log("Litecoin Testnet Handle:", deal with);
console.log("Personal Key (WIF):", privateKeyWIF);
return {
deal with: deal with,
privateKey: privateKeyWIF
};
}
Output:
Litecoin Testnet Handle: mnUDkLibVp1MhKSm6pvYgT26PUxeTjHJiR
Personal Key (WIF): cQgM1FZSkJWJ3eFs4xfYozfCt37KYKr1rEGEYwuNdquwsfzjASnM
please let me understand how I can obtain this. or ought to I take advantage of another npm package deal or one thing?