segregated witness – The right way to create a litecoin testnet segwit pockets offline – CoinNewsTrend

segregated witness – The right way to create a litecoin testnet segwit pockets offline


Hello So I’m utilizing the bitcoinjs-lib pacakge to generate pockets handle and personal keys domestically nevertheless it looks like it is creating the litecoin handle of legacy kind, my objective 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  handle  = bitcoin.funds.p2pkh(
        pubkey: keyPair.publicKey,
        community: litecoinTestnet
    );

    const privateKeyWIF = keyPair.toWIF();

    console.log("Litecoin Testnet Handle:", handle);
    console.log("Personal Key (WIF):", privateKeyWIF);
    return 
        handle: handle,
        privateKey: privateKeyWIF
    ;

Output:

Litecoin Testnet Handle: mnUDkLibVp1MhKSm6pvYgT26PUxeTjHJiR
Personal Key (WIF): cQgM1FZSkJWJ3eFs4xfYozfCt37KYKr1rEGEYwuNdquwsfzjASnM

please let me know the way I can obtain this. or ought to I exploit some other npm package deal or one thing?



Supply hyperlink