<p>I'm trying to create a new prefix to change the prefix of a xprv, but it doesn't work, what I need to know for do it? I'm looking to use the prefix 'nxprv'.</p>
<p>I'm trying to use this code(it works to zprv):</p>
<pre><code>function convertXprvToNxprv(pub, prefix) {
  let payload = b58.decode(pub)
    , key = payload.slice(4)

  return b58.encode(Buffer.concat([Buffer.from(prefix,'hex'), key]))
}
</code></pre>

CC BY-SA 4.0
2024-05-24T20:18:41.120Z
I’m not familiar with 'nxprv', could you provide more information about the context in which you heard about that?
Murch
CC BY-SA 4.0
2024-05-24T22:02:16.693Z
@Murch It doesn't exist yet, I want to create it.
Anderson Juhasc
<private-key><bip32-hd-wallets>
How can I create a new prefix for an extended key (xprv, zprv...)?
Anderson Juhasc
# How can I create a new prefix for an extended key (xprv, zprv...)?

(Asked by: username_0 on 2024-05-24)

I'm trying to create a new prefix to change the prefix of a xprv, but it doesn't work, what I need to know for do it? I'm looking to use the prefix 'nxprv'.

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

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

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

```

**Tags:** private-key, bip32-hd-wallets

> **Comments:**
> **username_1**: I’m not familiar with 'nxprv', could you provide more information about the context in which you heard about that?  
> **username_0**: @username_1 It doesn't exist yet, I want to create it.  

---

## 0 answers

