Skip to content

Instantly share code, notes, and snippets.

@maraoz
Created June 11, 2014 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maraoz/8393f72a998bae58d585 to your computer and use it in GitHub Desktop.
Save maraoz/8393f72a998bae58d585 to your computer and use it in GitHub Desktop.
bip32 non-deterministic derivation bug
var hk = new HierarchicalKey('tprv8ZgxMBicQKsPdSF1avR6mXyDj5Uv1XY2UyUHSDpAXQ5TvPN7prGeDppjy4562rBB9gMMAhRfFdJrNDpQ4t69kkqHNEEen3PX1zBJqSehJDH');
console.log(hk.derive('m/45/0/0/0').extendedPrivateKeyString());
console.log(hk.derive('m/45/0/0/0').extendedPrivateKeyString());
console.log(hk.derive('m/45\'/0/0/0').extendedPrivateKeyString());
console.log(hk.derive('m/45\'/0/0/0').extendedPrivateKeyString());
Outputs:
tprv8iDdrJ7doYBh2MpWDAPHopqUZ8jftExnk3v98yGFfEJPAfUBszoswxqg5doKrQS7whF6q5Q4cdK2Bdn3HWA4tURnjdPyPv83fpuamjELFmP
tprv8iDdrJ7doYBh2MpWDAPHopqUZ8jftExnk3v98yGFfEJPAfUBszoswxqg5doKrQS7whF6q5Q4cdK2Bdn3HWA4tURnjdPyPv83fpuamjELFmP
tprv8hJwoLPPDxbToSDevAzN7ram5E1iCHik4fXauZWCU5rH3rPU2kwtmDdFZMLQZkqEyoUAnarUhZpNX2fTNbwE3mfFs4w9ga18Hb7oQiuukhN
tprv8hdWreosLBRoGsH7kZktHJpbC59ap16zWnMp65UAq5Jv4L43vYGpfQ54wqx6PeFMyHQmxXTtrKiN3LHwTZc3bDbiiGGivJSBAuLecgS6WtU
@yemel
Copy link

yemel commented Jun 11, 2014

node> HierarchicalKey = require('bitcore').HierarchicalKey
copy + paste

Outputs on Mac:

tprv8iDdrJ7doYBh2MpWDAPHopqUZ8jftExnk3v98yGFfEJPAfUBszoswxqg5doKrQS7whF6q5Q4cdK2Bdn3HWA4tURnjdPyPv83fpuamjELFmP
tprv8iDdrJ7doYBh2MpWDAPHopqUZ8jftExnk3v98yGFfEJPAfUBszoswxqg5doKrQS7whF6q5Q4cdK2Bdn3HWA4tURnjdPyPv83fpuamjELFmP
tprv8hNNDKK3rxTTC3vTfJJrnFVUB5DEge1bVL725T3PnmDUXDJBPRutKfuRgTCUhh6f85iFnbdyxgxPPUykf1hQHU393yG6GNq5JugcDKWwTDF
tprv8hNNDKK3rxTTC3vTfJJrnFVUB5DEge1bVL725T3PnmDUXDJBPRutKfuRgTCUhh6f85iFnbdyxgxPPUykf1hQHU393yG6GNq5JugcDKWwTDF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment