<p>The normal <code>-y</code> yaml output of <code>mkp224o</code> includes a fixed prefix string in the public and private keys. These are part of what Tor expects in its private key files when it looks them up. However Bitcoin Core uses the Tor Control protocol to setup the hidden service. It reads the private key from the <code>onion_v3_private_key</code> file and sends it to Tor via the control protocol. Private keys sent this way use a different format. You should be able to get private keys in this other format by passing <code>--rawyaml</code> to <code>mkp224o</code>.</p>

CC BY-SA 4.0
2022-12-21T11:53:48.343Z
This worked, thanks. Although I found you also need to make sure `onion_v3_private_key` doesn't have a newline character at the end of the file (which some editors automatically add), or else bitcoind doesn't process it correctly.
girevik
CC BY-SA 4.0
2022-12-21T00:53:05.740Z
2022-12-21T00:53:05.740Z
Ava Chow
<p>I tried using <a href="https://github.com/cathugger/mkp224o" rel="nofollow noreferrer">mkp224o</a> to generate a Tor vanity address for my Bitcoin Core node. It output something like this:</p>
<pre><code>./mkp224o -y satosh

hostname: satoshf47rudte4hkkhhpz7sndbizctnvh3qcmdsaegjaprobb5mt6id.onion 
hs_ed25519_public_key: PT0gZWQyNTUxOXYxLXB1YmxpYzogdHlwZTAgPT0AAACQJukcvPxoOZOHUo535/JowoyKban3ATByAQyQPi4Ieg== 
hs_ed25519_secret_key: PT0gZWQyNTUxOXYxLXNlY3JldDogdHlwZTAgPT0AAADwgEV7/yRWZksAC7dZCHRWx0GQVn7q3Wki2rEmQd1DaBtwbyaym1Ohy+572xy49hnGgJyh2eWdEaaOs/ko0nkw
</code></pre>
<p>I assumed I could just edit <code>onion_v3_private_key</code> and put the secret key in there after &quot;ED25519-V3:&quot;, but it didn't work, and the generated key also looks longer than the one originally in the file. The error in debug.log was:</p>
<pre><code>tor: Add onion failed; error code 512
</code></pre>

<bitcoin-core><tor>
Use a Tor vanity address in Bitcoin Core?
girevik
# Use a Tor vanity address in Bitcoin Core?

(Asked by: username_0 on 2022-12-20)

I tried using [mkp224o](https://github.com/cathugger/mkp224o) to generate a Tor vanity address for my Bitcoin Core node. It output something like this:

```
./mkp224o -y satosh

hostname: satoshf47rudte4hkkhhpz7sndbizctnvh3qcmdsaegjaprobb5mt6id.onion 
hs_ed25519_public_key: PT0gZWQyNTUxOXYxLXB1YmxpYzogdHlwZTAgPT0AAACQJukcvPxoOZOHUo535/JowoyKban3ATByAQyQPi4Ieg== 
hs_ed25519_secret_key: PT0gZWQyNTUxOXYxLXNlY3JldDogdHlwZTAgPT0AAADwgEV7/yRWZksAC7dZCHRWx0GQVn7q3Wki2rEmQd1DaBtwbyaym1Ohy+572xy49hnGgJyh2eWdEaaOs/ko0nkw

```

I assumed I could just edit `onion_v3_private_key` and put the secret key in there after "ED25519-V3:", but it didn't work, and the generated key also looks longer than the one originally in the file. The error in debug.log was:

```
tor: Add onion failed; error code 512

```

**Tags:** bitcoin-core, tor


---

## 1 answers

### Answer by username_1 on 2022-12-21. Score: 4 | Accepted answer

The normal `-y` yaml output of `mkp224o` includes a fixed prefix string in the public and private keys. These are part of what Tor expects in its private key files when it looks them up. However Bitcoin Core uses the Tor Control protocol to setup the hidden service. It reads the private key from the `onion_v3_private_key` file and sends it to Tor via the control protocol. Private keys sent this way use a different format. You should be able to get private keys in this other format by passing `--rawyaml` to `mkp224o`.

> **Comments:**
> **username_0**: This worked, thanks. Although I found you also need to make sure `onion_v3_private_key` doesn't have a newline character at the end of the file (which some editors automatically add), or else bitcoind doesn't process it correctly.  

---

