<blockquote>
  <p>I don't understand the difference between <code>listaddressgroupings</code> and <code>getnewaddress</code></p>
</blockquote>

<p><code>listaddressgroupings</code> is very different from <code>getnewaddress</code>. <code>listaddressgroupings</code> just shows you addresses from your wallet that have been used. <code>getnewaddress</code> gives you a new address for you to receive Bitcoin at.</p>

<blockquote>
  <p>What address is it?</p>
</blockquote>

<p>That address is an address in your wallet. The reason you see it listed in <code>listaddressgroupings</code> is because you used <code>generate</code>. <code>generate</code> mines blocks and sends the block reward to a newly generated address. So after using <code>generate</code>, you will see a new address in your wallet which has the Bitcoin received from the block that was just mined.</p>

<p><code>listaddressgroupings</code> is not giving you a new address every time you call it. If you just call it without mining any blocks and without using <code>getnewaddress</code>, then you will see the same addresses there. No new addresses will be created.</p>

<blockquote>
  <p>Why this address begin with 2 and not with m or n ?</p>
</blockquote>

<p>The address that <code>generate</code> uses is a P2PKH address which begins with <code>m</code> or <code>n</code>. However the wallet will give you, by default, addresses that are P2SH segwit addresses which will begin with <code>2</code>. This can be changed by setting the <code>-addresstype</code> option to change the address type that <code>getnewaddress</code> will give you. This discrepancy is largely due to legacy reasons; there's no reason that <code>generate</code> couldn't use P2SH segwit addresses (or whatever you have set <code>addresstype</code> to) but no one bothered to change it.</p>

<p>(Note that <code>generate</code> doesn't actually use P2PKH outputs. Rather it uses a P2PK output which does not have an address type. For convenience, this is displayed as a P2PKH address)</p>

CC BY-SA 4.0
2019-01-21T20:38:53.680Z
thanks for your reply. I am little confusion. `listaddressgroupings` give the wallet after `generate`command. But these wallets are different from `dumpwallet`.
Where Can I see all address from generate? because with `dumpwallet` help I can read `Dumps all wallet keys in a human-readable format to a server-side file.`, but I can't find the address generate after mine block. These address have same Master priv key?
monkeyUser
CC BY-SA 4.0
2019-01-22T00:12:11.727Z
The private keys for addresses that are used by `generate` are in the `dumpwallet` output. They just aren't shown in the same form as `listaddressgroupings` because of the way that Bitcoin core stores addresses internally. The addresses from `generate` aren't actually addresses and are not stored as addresses. But their keys are stored, and that's what matters. When you use `dumpwallet`, the address form for those keys are not found, so it defaults to outputting it as the current default address type which is P2SH segwit.
Ava Chow
CC BY-SA 4.0
2019-01-22T08:20:25.703Z
thanks again for your reply. `The addresses from generate aren't actually addresses and are not stored as addresses.` Not address because miss some hash o check like base58check or what? for example If I create a transaction with `MVA_PRIVATEKEY`with which Public key check my signature? with `mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8` or ` `2NCGuG2v4RbaAKsZp1RQJ2ZpDM6WtW79Mu3`

Thanks
monkeyUser
CC BY-SA 4.0
2019-01-22T16:35:23.567Z
`MVA_PRIVATEKEY` has only one public key. That public key corresponds to different addresses. When hashed with hash160 and base58 check encoded with version number 111, you get `mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8`. When hashed with hash160, built into a segwit script, that script hashed with hash160, and then base58 check encoded with version number 196, you get `2NCGuG2v4RbaAKsZp1RQJ2ZpDM6WtW79Mu3`. It's the same public key in both, just different addresses representing different output scripts.
Ava Chow
CC BY-SA 4.0
2019-01-22T16:36:05.613Z
However, `generate` does not use either of those output scripts in the block it mined. It uses a P2PK script which has no address.
Ava Chow
CC BY-SA 4.0
2019-01-21T05:37:16.957Z
2019-01-21T05:37:16.957Z
Ava Chow
<p>I don't understand the differents between <code>listaddressgroupings</code> and <code>getnewaddress</code></p>

<p>For example, I have a local blockchain ( regtest ) with 0 Block.
I create 101 block (<code>generate 101</code>)
I can see with <code>listaddressgroupings</code> this output</p>

<pre><code>[
  [
    [
      "mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8",
      50.00000000
    ]
  ]
]
</code></pre>

<p>What address is it?
If dump the priv key <code>dumpprivkey mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8</code></p>

<p>I have this result <code>MVA_PRIVATEKEY</code></p>

<p>ok, If I search this privkey in <code>dumpwallet test.txt</code> that key in associate to this address </p>

<p><code>MVA_PRIVATEKEY 2019-01-19T10:26:19Z change=1 # addr=2NAoHv7kDBhHND7YHcQKuDS8wCbEz87xLrv hdkeypath=m/0'/0'/0'</code></p>

<p>Why is not <code>mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8</code> ?</p>

<p>Now I want create a new address getnewaddress => 
<code>2NCGuG2v4RbaAKsZp1RQJ2ZpDM6WtW79Mu3</code></p>

<p>Why this address begin with 2 and not with m or n ? its pk is different from <code>mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8</code></p>

<p>If I create another 101 block, I have a new address in <code>listaddressgroupings</code></p>

<p>anytime I create a new block, I have a new address in <code>listaddressgroupings</code></p>

<wallet><address><private-key><public-key><regtest>
address in listaddressgroupings and getnewaddress
monkeyUser
# address in listaddressgroupings and getnewaddress

(Asked by: username_0 on 2019-01-19)

I don't understand the differents between `listaddressgroupings` and `getnewaddress`

For example, I have a local blockchain ( regtest ) with 0 Block.
I create 101 block (`generate 101`)
I can see with `listaddressgroupings` this output

```
[
  [
    [
      "mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8",
      50.00000000
    ]
  ]
]

```

What address is it?
If dump the priv key `dumpprivkey mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8`

I have this result `MVA_PRIVATEKEY`

ok, If I search this privkey in `dumpwallet test.txt` that key in associate to this address

`MVA_PRIVATEKEY 2019-01-19T10:26:19Z change=1 # addr=2NAoHv7kDBhHND7YHcQKuDS8wCbEz87xLrv hdkeypath=m/0'/0'/0'`

Why is not `mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8` ?

Now I want create a new address getnewaddress =>
`2NCGuG2v4RbaAKsZp1RQJ2ZpDM6WtW79Mu3`

Why this address begin with 2 and not with m or n ? its pk is different from `mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8`

If I create another 101 block, I have a new address in `listaddressgroupings`

anytime I create a new block, I have a new address in `listaddressgroupings`

**Tags:** wallet, address, private-key, public-key, regtest


---

## 1 answers

### Answer by username_1 on 2019-01-21. Score: 1 | Accepted answer

> I don't understand the difference between `listaddressgroupings` and `getnewaddress`

`listaddressgroupings` is very different from `getnewaddress`. `listaddressgroupings` just shows you addresses from your wallet that have been used. `getnewaddress` gives you a new address for you to receive Bitcoin at.

> What address is it?

That address is an address in your wallet. The reason you see it listed in `listaddressgroupings` is because you used `generate`. `generate` mines blocks and sends the block reward to a newly generated address. So after using `generate`, you will see a new address in your wallet which has the Bitcoin received from the block that was just mined.

`listaddressgroupings` is not giving you a new address every time you call it. If you just call it without mining any blocks and without using `getnewaddress`, then you will see the same addresses there. No new addresses will be created.

> Why this address begin with 2 and not with m or n ?

The address that `generate` uses is a P2PKH address which begins with `m` or `n`. However the wallet will give you, by default, addresses that are P2SH segwit addresses which will begin with `2`. This can be changed by setting the `-addresstype` option to change the address type that `getnewaddress` will give you. This discrepancy is largely due to legacy reasons; there's no reason that `generate` couldn't use P2SH segwit addresses (or whatever you have set `addresstype` to) but no one bothered to change it.

(Note that `generate` doesn't actually use P2PKH outputs. Rather it uses a P2PK output which does not have an address type. For convenience, this is displayed as a P2PKH address)

> **Comments:**
> **username_0**: thanks for your reply. I am little confusion. `listaddressgroupings` give the wallet after `generate`command. But these wallets are different from `dumpwallet`. Where Can I see all address from generate? because with `dumpwallet` help I can read `Dumps all wallet keys in a human-readable format to a server-side file.`, but I can't find the address generate after mine block. These address have same Master priv key?  
> **username_1**: The private keys for addresses that are used by `generate` are in the `dumpwallet` output. They just aren't shown in the same form as `listaddressgroupings` because of the way that Bitcoin core stores addresses internally. The addresses from `generate` aren't actually addresses and are not stored as addresses. But their keys are stored, and that's what matters. When you use `dumpwallet`, the address form for those keys are not found, so it defaults to outputting it as the current default address type which is P2SH segwit.  
> **username_0**: thanks again for your reply. `The addresses from generate aren't actually addresses and are not stored as addresses.` Not address because miss some hash o check like base58check or what? for example If I create a transaction with `MVA_PRIVATEKEY`with which Public key check my signature? with `mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8` or ` `2NCGuG2v4RbaAKsZp1RQJ2ZpDM6WtW79Mu3`  Thanks  
> **username_1**: `MVA_PRIVATEKEY` has only one public key. That public key corresponds to different addresses. When hashed with hash160 and base58 check encoded with version number 111, you get `mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8`. When hashed with hash160, built into a segwit script, that script hashed with hash160, and then base58 check encoded with version number 196, you get `2NCGuG2v4RbaAKsZp1RQJ2ZpDM6WtW79Mu3`. It's the same public key in both, just different addresses representing different output scripts.  
> **username_1**: However, `generate` does not use either of those output scripts in the block it mined. It uses a P2PK script which has no address.  

---

