<p>OK, I managed to do it with the excellent bitcoin-tool by matja
<a href="https://github.com/matja/bitcoin-tool" rel="nofollow noreferrer">https://github.com/matja/bitcoin-tool</a></p>

<p><code>git clone https://github.com/matja/bitcoin-tool.git</code></p>

<p><code>cd bitcoin-tool</code></p>

<p><code>make test</code></p>

<p><code>./bitcoin-tool --input-type private-key-wif --input-format base58check --output-type private-key --output-format hex --network bitcoin  --input "KzRVLwCuCi2tH2PpSNZnwUqPwg6gaqXAM2LWobUurzAsNdC5JesE"</code></p>

<p>which gave me 
5f92519eef7ec4e37cbcd25f9ba4a82e5acf9a8cd274d4d3aa3aa727fd7b6969</p>

<p>as a result.</p>

CC BY-SA 3.0
2017-04-24T16:59:20.483Z
2017-04-25T11:45:29.627Z
2017-04-25T11:45:29.627Z
relG
<p><a href="https://en.bitcoin.it/wiki/Private_key" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Private_key</a>
Private keys associated with compressed public keys are 52 characters and start with a capital L or K on mainnet. Your second line looks pretty much like a privkey (KzRVLwCuCi2tH2PpSNZnwUqPwg6gaqXAM2LWobUurzAsNdC5JesE), just it is 53 chars long... sure your data is not garbled? 
Once you have your privkey you'd need the base58check encoding, like provided on Ken Shirriff's blog: <a href="http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html" rel="nofollow noreferrer">http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html</a>
which again is explained in the wiki: <a href="https://en.bitcoin.it/wiki/Base58Check_encoding" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Base58Check_encoding</a></p>

CC BY-SA 3.0
2017-04-24T14:21:08.390Z
2017-04-24T14:21:08.390Z
pebwindkraft
<p>I am trying to create raw transactions according to the excellent answer of runeks here:
<a href="https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx/5241#5241">How to redeem a basic Tx?</a></p>

<p>But there he starts with a private key in hex format
<code>18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725</code></p>

<p>and I have one in base58 given by bitcoin-cli dumpprivkey:</p>

<p><code>bitcoin-cli dumpprivkey 154G5oUywHU3pESNy4oBBpkmAGqRZiYxBk
KzRVLwCuCi2tH2PpSNZnwUqPwg6gaqXAM2LWobUurzAsNdC5JesE</code></p>

<p>How do I get it in hex in the right format?</p>

<private-key>
How to get the private key in hex from the output of dumpprivkey
relG
# How to get the private key in hex from the output of dumpprivkey

(Asked by: username_0 on 2017-04-24)

I am trying to create raw transactions according to the excellent answer of runeks here:
[How to redeem a basic Tx?](https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx/5241#5241)

But there he starts with a private key in hex format
`18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725`

and I have one in base58 given by bitcoin-cli dumpprivkey:

`bitcoin-cli dumpprivkey 154G5oUywHU3pESNy4oBBpkmAGqRZiYxBk
KzRVLwCuCi2tH2PpSNZnwUqPwg6gaqXAM2LWobUurzAsNdC5JesE`

How do I get it in hex in the right format?

**Tags:** private-key


---

## 2 answers

### Answer by username_0 on 2017-04-24. Score: 3

OK, I managed to do it with the excellent bitcoin-tool by matja
<https://github.com/matja/bitcoin-tool>

`git clone https://github.com/matja/bitcoin-tool.git`

`cd bitcoin-tool`

`make test`

`./bitcoin-tool --input-type private-key-wif --input-format base58check --output-type private-key --output-format hex --network bitcoin --input "KzRVLwCuCi2tH2PpSNZnwUqPwg6gaqXAM2LWobUurzAsNdC5JesE"`

which gave me
5f92519eef7ec4e37cbcd25f9ba4a82e5acf9a8cd274d4d3aa3aa727fd7b6969

as a result.


---

### Answer by username_1 on 2017-04-24. Score: 0

<https://en.bitcoin.it/wiki/Private_key>
Private keys associated with compressed public keys are 52 characters and start with a capital L or K on mainnet. Your second line looks pretty much like a privkey (KzRVLwCuCi2tH2PpSNZnwUqPwg6gaqXAM2LWobUurzAsNdC5JesE), just it is 53 chars long... sure your data is not garbled?
Once you have your privkey you'd need the base58check encoding, like provided on Ken Shirriff's blog: <http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html>
which again is explained in the wiki: <https://en.bitcoin.it/wiki/Base58Check_encoding>


---

