I have a small script basically taken from this test script in bitcoinjs-lib
function getAddress(node) {
const bitcoin = require('bitcoinjs-lib');
return bitcoin.payments.p2pkh({ pubkey: node.publicKey }).address;
}
function BIP44() {
/* create a BIP44, rvn, account 0, external address */
const bip32 = require('bip32');
const root = bip32.fromSeed(
Buffer.from(
'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd',
'hex',
),
);
const childAuto = root.derivePath("m/44'/175'/0'/0/0");
const childManual = root
.deriveHardened(44)
.deriveHardened(175)
.deriveHardened(0)
.derive(0)
.derive(0);
return getAddress(childAuto);
}
console.log(BIP44());
It works perfectly for deriving a bitcoin address (derivation path "m/44'/0'/0'/0/0"
) but when trying to derive any other address it doesn't seem to work. The output is this:
16CzcgCURH83h3cLQ91ZpavDjXSfuNru4c
That address starts with a 1, whereas RVN addresses start with R.
I mistakenly assumed that merely by changing the derivation path to match RVN (175
) it would generate Raven addresses, but there must be something else I'm missing.
Can you help me figure out where I'm going wrong?
Other resources I've explored:
- https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
- https://github.com/satoshilabs/slips/blob/master/slip-0044.md
- https://medium.com/@harshagoli/hd-wallets-explained-from-high-level-to-nuts-and-bolts-9a41545f5b0
- https://github.com/topics/bip44
- How to validate HD wallet address to match BIP44