CRYPTO NEWS

Bitcoin hits $60K for the first time since April after reports of imminent ETF approval

Bitcoin has recaptured the $60,000 position after a six-month period of ups and downs.

bitcoinjs-lib: P2SH (purpose 49) addresses derived from an xpub are not matching Ian Coleman’s Bip39

Code: export function xpubTo49Addresses(xpub: string, index: number = 10): string | undefined[] { const cache = bip32.fromBase58(xpub).derive(0) const addresses: string | undefined[] = [] for (let i = 0; i < index; i++) { const { address } = bjs.payments.p2sh({ redeem: bjs.payments.p2wpkh({ pubkey: cache.derive(i).publicKey }) }) addresses.push(address) } return addresses } The xpub (sample, of::Listen

Code:

export function xpubTo49Addresses(xpub: string, index: number = 10): string | undefined[] {    const cache = bip32.fromBase58(xpub).derive(0) const addresses: string | undefined[] = []   for (let i = 0; i < index; i++) {     const { address } = bjs.payments.p2sh({       redeem: bjs.payments.p2wpkh({         pubkey: cache.derive(i).publicKey       })     })     addresses.push(address)       }    return addresses } 

The xpub (sample, of course) is xpub6DUH8Xha1g8J344Ha6PBrydtYvkfLEYRWKLpQSVtdxTzJs7tiEYQ8h2GW8edPVhDB9f81HRuofGwfmkjy9vu2X8jc5DaHHY7J9f2FKsjkZj

The test results for the first three indices are:

    expect(received).toEqual(expected) // deep equality      - Expected  - 3     + Received  + 3        Array [     -   "3Huci2jdvztGKSGn8NKKA1h6XYM8yi6XDS",     -   "3JWdSocu1VXPagvYCQ5GuMJMFzya1r9rVy",     -   "3MLvfZZMVKskXZ9jTBDaeEhGhL29vB8Je1",     +   "3Jt34YeUvNP3KQZYLFM94Ap4abHk4xyvbU",     +   "3PxFt8GaTPXcLJNRwg9BtqV7LVKm6jAEQj",     +   "3QLJCMW3F17ATzbB9BVbZUKYNVhxFxRn3o",       ]     

What am I doing wrong here?

Crypto Hats, Crypto Shirts, Crypto Socks, Crypto Clothing

Bitcoin hits $60K for the first time since April after reports of imminent ETF approval

Shopping cart
There are no products in the cart!
Continue shopping
0