<p>I expect the pair</p>
<pre><code>getnewaddress  ( &quot;label&quot; &quot;address_type&quot; )
getaddressinfo  &quot;address&quot; 
</code></pre>
<p>will generate a new pubkey and tell you what it is</p>
<hr />
<p>The same commands are supported by bitcoin-qt console so I can easily demonstrate it thusly ...</p>
<pre><code>getnewaddress
bc1q************************************5e

getaddressinfo bc1q************************************5e
{
  &quot;address&quot;: &quot;bc1q************************************5e&quot;,
  [...]
  &quot;pubkey&quot;: &quot;03**************************************************************4d&quot;,
  [...]
}
</code></pre>

CC BY-SA 4.0
2022-03-07T15:44:11.250Z
2022-03-07T16:01:31.120Z
2022-03-07T16:01:31.120Z
RedGrittyBrick
<p>I'm trying to generate a public key associated with a wallet. How would I do this using the wallet rpc commands, I couldn't find a command in reference docs which does this.</p>
<p>Thanks.</p>

<bitcoin-core><json-rpc><public-key><address-generation>
How to generate a public key in wallet rpc commands
Chiru
# How to generate a public key in wallet rpc commands

(Asked by: username_0 on 2022-03-07)

I'm trying to generate a public key associated with a wallet. How would I do this using the wallet rpc commands, I couldn't find a command in reference docs which does this.

Thanks.

**Tags:** bitcoin-core, json-rpc, public-key, address-generation


---

## 1 answers

### Answer by username_1 on 2022-03-07. Score: 2

I expect the pair

```
getnewaddress  ( "label" "address_type" )
getaddressinfo  "address" 

```

will generate a new pubkey and tell you what it is

---

The same commands are supported by bitcoin-qt console so I can easily demonstrate it thusly ...

```
getnewaddress
bc1q************************************5e

getaddressinfo bc1q************************************5e
{
  "address": "bc1q************************************5e",
  [...]
  "pubkey": "03**************************************************************4d",
  [...]
}

```


---

