2

I tried using 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

1 Answer 1

4

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.

1
  • 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
    Commented Dec 21, 2022 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.