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


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

1 Answer 1


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)

  • thanks for your reply. I am little confusion. listaddressgroupings give the wallet after generatecommand. 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
    Jan 21, 2019 at 20:38
  • 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
    Jan 22, 2019 at 0:12
  • 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_PRIVATEKEYwith which Public key check my signature? with mvAH7VsxifvQdEZ46Rdt2oN3nB5BzaPqS8 or ` 2NCGuG2v4RbaAKsZp1RQJ2ZpDM6WtW79Mu3 Thanks
    – monkeyUser
    Jan 22, 2019 at 8:20
  • 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
    Jan 22, 2019 at 16:35
  • 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
    Jan 22, 2019 at 16:36

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.