<p>When attempting to create a p2tr address using the private key 0x0000...01 I get, <code>bc1pmfr3p9j00pfxjh0zmgp99y8zftmd3s5pmedqhyptwy6lm87hf5sspknck9</code> which does not match the provided test vectors provided here: <a href="https://github.com/bitcoin/bips/pull/1225" rel="nofollow noreferrer">https://github.com/bitcoin/bips/pull/1225</a></p>
<p>However if I search this bech32m address in github or google I find others arriving at this same address for key 0x0000..01 so I know I at least have the bech32m encoding right, but not right for p2tr.</p>
<p>Is there another step I'm missing in the below code so that it matches the examples included here (<a href="https://github.com/bitcoin/bips/pull/1225" rel="nofollow noreferrer">https://github.com/bitcoin/bips/pull/1225</a>)?</p>
<pre><code>const ecurve = require('ecurve')
const secp256k1 = ecurve.getCurveByName('secp256k1')
const schnorr = require('bip-schnorr')
const bech32 = require('bech32').bech32
const bech32m = require('bech32').bech32m    

  const pubKey = ecurve.Point.decodeFrom(secp256k1, keyPair.getPublicKeyBuffer())
  const taprootPubkey = schnorr.taproot.taprootConstruct(pubKey)
  const words = bech32.toWords(taprootPubkey)
  words.unshift(1)
  return bech32m.encode('bc',words)
  //bc1pmfr3p9j00pfxjh0zmgp99y8zftmd3s5pmedqhyptwy6lm87hf5sspknck9
</code></pre>

CC BY-SA 4.0
2021-11-13T16:12:11.163Z
Which test vector does not match? I don't see one for a private key of 1. AFAICT, you have the correct address.
Ava Chow
CC BY-SA 4.0
2021-11-13T16:17:51.673Z
Indeed, I also get `bc1pmfr3p9j00pfxjh0zmgp99y8zftmd3s5pmedqhyptwy6lm87hf5sspknck9` for the key-only P2TR address for private key 0x000...0001.
Pieter Wuille
CC BY-SA 4.0
2021-11-14T00:24:56.090Z
Oh excellent news! I must have misunderstood your post when you said you used the 0x0...01 key because I couldn't locate this P2TR address in the test vectors post but now I'm looking at it again it must have been the input which explains why that address doesn't appear here https://github.com/bitcoin/bips/pull/1225#issuecomment-958124970
m1xolyd1an
CC BY-SA 4.0
2021-11-14T00:37:05.007Z
The 0x0000...0001 key is used for the address of one of the outputs of the test transaction there. The input keys are all random, and listed in the vector data.
Pieter Wuille
<taproot><p2tr><bip350-bech32m><nodejs>
P2TR bech32m mismatch
m1xolyd1an
# P2TR bech32m mismatch

(Asked by: username_0 on 2021-11-13)

When attempting to create a p2tr address using the private key 0x0000...01 I get, `bc1pmfr3p9j00pfxjh0zmgp99y8zftmd3s5pmedqhyptwy6lm87hf5sspknck9` which does not match the provided test vectors provided here: <https://github.com/bitcoin/bips/pull/1225>

However if I search this bech32m address in github or google I find others arriving at this same address for key 0x0000..01 so I know I at least have the bech32m encoding right, but not right for p2tr.

Is there another step I'm missing in the below code so that it matches the examples included here (<https://github.com/bitcoin/bips/pull/1225>)?

```
const ecurve = require('ecurve')
const secp256k1 = ecurve.getCurveByName('secp256k1')
const schnorr = require('bip-schnorr')
const bech32 = require('bech32').bech32
const bech32m = require('bech32').bech32m    

  const pubKey = ecurve.Point.decodeFrom(secp256k1, keyPair.getPublicKeyBuffer())
  const taprootPubkey = schnorr.taproot.taprootConstruct(pubKey)
  const words = bech32.toWords(taprootPubkey)
  words.unshift(1)
  return bech32m.encode('bc',words)
  //bc1pmfr3p9j00pfxjh0zmgp99y8zftmd3s5pmedqhyptwy6lm87hf5sspknck9

```

**Tags:** taproot, p2tr, bip350-bech32m, nodejs

> **Comments:**
> **username_1**: Which test vector does not match? I don't see one for a private key of 1. AFAICT, you have the correct address.  
> **username_2**: Indeed, I also get `bc1pmfr3p9j00pfxjh0zmgp99y8zftmd3s5pmedqhyptwy6lm87hf5sspknck9` for the key-only P2TR address for private key 0x000...0001.  
> **username_0**: Oh excellent news! I must have misunderstood your post when you said you used the 0x0...01 key because I couldn't locate this P2TR address in the test vectors post but now I'm looking at it again it must have been the input which explains why that address doesn't appear here https://github.com/bitcoin/bips/pull/1225#issuecomment-958124970  
> **username_2**: The 0x0000...0001 key is used for the address of one of the outputs of the test transaction there. The input keys are all random, and listed in the vector data.  

---

## 0 answers

