Bitcoin

Private Key – How can I create a new prefix for extended keys (xprv, zprv…)?

I’m trying to create a new prefix to change the prefix of xprv, but it doesn’t work. What do you need to know to do this? You are trying to use the prefix ‘nxprv’.

I’m trying to use this code (it works with zprv):

function convertXprvToNxprv(pub, prefix) 
  let payload = b58.decode(pub)
    , key = payload.slice(4)

  return b58.encode(Buffer.concat((Buffer.from(prefix,'hex'), key)))

Related Articles

Back to top button