<p>To the best of my knowledge there is no standard CLI utility.
However, there are some tools which seem to be generally accepted, like <a href="https://github.com/grondilu/bitcoin-bash-tools" rel="nofollow noreferrer" title="bitcoin-bash-tools">bitcoin-bash-tools</a></p>

<p>Alternatively, you can use some script library, such as <a href="https://github.com/pycoin/pycoin" rel="nofollow noreferrer" title="pycoin">pycoin</a> (written in Python), or <a href="https://github.com/bitcoinjs/bitcoinjs-lib%20%22bitcoinjs%22%20(written%20in%20Javascript)" rel="nofollow noreferrer">bitcoinjs</a>.</p>

<p>Personally I like <a href="https://bitcore.io/api/lib/" rel="nofollow noreferrer">Bitcore</a> libraries (Bitcore is not Bitcoin Core, despite their names are similar). They are also written in Javascript.
I wrote a simple library for handling keys/addresses that can be used from the command line with the NodeJS interpreter: <a href="https://github.com/frz-dev/btcutils/blob/master/bitcore-keys-utils.js" rel="nofollow noreferrer">https://github.com/frz-dev/btcutils/blob/master/bitcore-keys-utils.js</a>. In your case you can use the <code>getPubKey</code> function, passing the private key object.</p>

<p>Hope this helps</p>

CC BY-SA 3.0
2017-11-23T13:27:09.750Z
2017-11-23T13:27:09.750Z
FedFranz
<p>In fact, there are few CLI utilies that allow you this:</p>

<ul>
<li><p><a href="https://github.com/Bobalot/sx" rel="nofollow noreferrer">sx</a> : command line Bitcoin to empower the sysadmin </p>

<p>cat <em>key</em>| sx pubkey</p></li>
<li><p><a href="https://github.com/vbuterin/pybitcointools" rel="nofollow noreferrer">pybitcointools</a> : SImple, common-sense Bitcoin-themed Python ECC library </p>

<p>pybtctool privtopub <em>key</em></p></li>
</ul>

CC BY-SA 3.0
2017-11-23T17:15:48.333Z
2017-11-23T17:15:48.333Z
dark knight
<p>Try this: <code>pip3 install btc-address-dump</code></p>
<p>Here is an example:</p>
<pre><code>$ btc_address_dump c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
legacy address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
legacy address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
p2sh-segwit address (p2sh p2wpkh) = 3AzXxVUqdzvzEqVmdtmeVqRwc98uqwyh76
bech32 address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt
</code></pre>
<p>This tool also support mnemonic words:</p>
<pre><code>$ btc_address_dump &quot;olympic wine chicken argue unaware bundle tunnel grid spider slot spell need&quot;
mnemonic = olympic wine chicken argue unaware bundle tunnel grid spider slot spell need
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
legacy address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
legacy address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
p2sh-segwit address (p2sh p2wpkh) = 3AzXxVUqdzvzEqVmdtmeVqRwc98uqwyh76
bech32 address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt
</code></pre>

CC BY-SA 4.0
2021-01-31T15:32:45.527Z
Caution. This is a post by a new user, promoting new software.
Claris
CC BY-SA 4.0
2021-01-31T13:27:19.253Z
2021-01-31T13:27:19.253Z
lemon
<p>Is there a standard, or at least well-accepted, CLI tool that calculates the public key out of a private key?</p>

<p>I've done my homework erading <a href="https://bitcoin.stackexchange.com/questions/25024/how-do-you-get-a-bitcoin-public-key-from-a-private-key">How do you get a Bitcoin Public Key from a Private Key</a>, but it's from May 2014, and hopefully tooling has improved since then.</p>

<private-key><public-key><cli>
Standard CLI tool to calculate a public key out of a private key
Adam Matan
# Standard CLI tool to calculate a public key out of a private key

(Asked by: username_0 on 2017-11-23)

Is there a standard, or at least well-accepted, CLI tool that calculates the public key out of a private key?

I've done my homework erading [How do you get a Bitcoin Public Key from a Private Key](https://bitcoin.stackexchange.com/questions/25024/how-do-you-get-a-bitcoin-public-key-from-a-private-key), but it's from May 2014, and hopefully tooling has improved since then.

**Tags:** private-key, public-key, cli


---

## 3 answers

### Answer by username_1 on 2017-11-23. Score: 1 | Accepted answer

To the best of my knowledge there is no standard CLI utility.
However, there are some tools which seem to be generally accepted, like [bitcoin-bash-tools](https://github.com/grondilu/bitcoin-bash-tools "bitcoin-bash-tools")

Alternatively, you can use some script library, such as [pycoin](https://github.com/pycoin/pycoin "pycoin") (written in Python), or [bitcoinjs](https://github.com/bitcoinjs/bitcoinjs-lib%20%22bitcoinjs%22%20(written%20in%20Javascript)).

Personally I like [Bitcore](https://bitcore.io/api/lib/) libraries (Bitcore is not Bitcoin Core, despite their names are similar). They are also written in Javascript.
I wrote a simple library for handling keys/addresses that can be used from the command line with the NodeJS interpreter: <https://github.com/frz-dev/btcutils/blob/master/bitcore-keys-utils.js>. In your case you can use the `getPubKey` function, passing the private key object.

Hope this helps


---

### Answer by username_2 on 2017-11-23. Score: 1

In fact, there are few CLI utilies that allow you this:

* [sx](https://github.com/Bobalot/sx) : command line Bitcoin to empower the sysadmin

  cat *key*| sx pubkey
* [pybitcointools](https://github.com/vbuterin/pybitcointools) : SImple, common-sense Bitcoin-themed Python ECC library

  pybtctool privtopub *key*


---

### Answer by username_3 on 2021-01-31. Score: 0

Try this: `pip3 install btc-address-dump`

Here is an example:

```
$ btc_address_dump c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
legacy address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
legacy address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
p2sh-segwit address (p2sh p2wpkh) = 3AzXxVUqdzvzEqVmdtmeVqRwc98uqwyh76
bech32 address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt

```

This tool also support mnemonic words:

```
$ btc_address_dump "olympic wine chicken argue unaware bundle tunnel grid spider slot spell need"
mnemonic = olympic wine chicken argue unaware bundle tunnel grid spider slot spell need
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
legacy address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
legacy address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
p2sh-segwit address (p2sh p2wpkh) = 3AzXxVUqdzvzEqVmdtmeVqRwc98uqwyh76
bech32 address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt

```

> **Comments:**
> **username_4**: Caution. This is a post by a new user, promoting new software.  

---

