Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: bitachoin on October 27, 2018, 02:00:12 AM



Title: noob question about `bitcoin-cli getnewaddress`
Post by: bitachoin on October 27, 2018, 02:00:12 AM
How many times can I call `getnewaddress`? what exactly is happening to create a new address every time?

thank you for your help!


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: Pmalek on October 27, 2018, 08:02:47 AM
I assume you are asking how many times you can generate a new address for a BTC payment. You can do that for every new payment you receive or you can use the same address every time. It also depends on your wallet, some wallets will generate a new address for every transaction.


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: aleksej996 on October 27, 2018, 09:53:11 AM
OP is using Bitcoin Core, as seen in headline of this topic.

You can generate an address however many times you like. Each time you run that command on newer versions of Bitcoin Core, you will simply get an address that was already generated in your wallet (HD wallet). You have couple of hundreds, I think, already generated and another batch is likely generated once these run out.


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: AdolfinWolf on October 27, 2018, 11:08:43 AM
OP is using Bitcoin Core, as seen in headline of this topic.

You can generate an address however many times you like. Each time you run that command on newer versions of Bitcoin Core, you will simply get an address that was already generated in your wallet (HD wallet). You have couple of hundreds, I think, already generated and another batch is likely generated once these run out.

Is this actually still the case? Does bitcoin core still use the keypool to store X amounts of adresses? That seems.. unnecessary?

Why not just generate them when needed using the xprv? Is this done simply because it was easier to implement, or is there some kind of reasoning behind it?


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: bitachoin on October 27, 2018, 02:08:47 PM
Interesting, thanks for that. Although, when I created my testnet wallet I used the -legacy parameter. Does that change things?

OP is using Bitcoin Core, as seen in headline of this topic.

You can generate an address however many times you like. Each time you run that command on newer versions of Bitcoin Core, you will simply get an address that was already generated in your wallet (HD wallet). You have couple of hundreds, I think, already generated and another batch is likely generated once these run out.


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: bob123 on October 28, 2018, 12:04:10 PM
Is this actually still the case? Does bitcoin core still use the keypool to store X amounts of adresses? That seems.. unnecessary?

Why not just generate them when needed using the xprv? Is this done simply because it was easier to implement, or is there some kind of reasoning behind it?


Unfortunately i am not sure whether core still uses a key pool (might still be possible, but not necessary).

But the reason for core not to use the xpriv to generate new addresses is, that you'd need to unlock your wallet in this case.
The better option would be to use the xpub (which probably is the case if there is no address pool anymore)



Interesting, thanks for that. Although, when I created my testnet wallet I used the -legacy parameter. Does that change things?

No. The legacy parameter is to choose the address type (legacy/segwit).
This is not related to the address generation itself.


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: HCP on October 30, 2018, 08:45:24 PM
I believe that it still generates a "keypool" of 1000 keys. As keys are "used" the keypool will be topped back up automatically... As I understand it, this usually occurs when you "unlock" the wallet.

Some reasons for still using the keypool system (more complete restore, not needing to unlock wallet to "generate" a new address etc) are mentioned by achow101 here: https://bitcointalk.org/index.php?topic=2940114.msg30228579#msg30228579


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: seoincorporation on October 31, 2018, 08:00:31 PM
I would like to join this noob questions about `bitcoin-cli getnewaddress`.

What's the weight of each addy we create, let's suppose we want to create 100 Million addys with our wallet, how many MB we need in our hard disk for that?

By the way, thanks for the comments guys, I didn't know there was a 1000 addys keypool  :o


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: bob123 on October 31, 2018, 08:08:09 PM
What's the weight of each addy we create, let's suppose we want to create 100 Million addys with our wallet, how many MB we need in our hard disk for that?

You probably won't be able to efficiently create 100 million addresses within core.

If you really want to create that much addresses (to try out your luck; maybe generating an already used address with balance? ), use a different program which is optimized to generate private-/public- keypairs.
Core definitely is not.


It might be worth to note, that you won't find an already used address (if that's what you intend to do).


Regarding the disk space required:
Basically, if you want to store the private key + the address (not within core), you'll need 256 bit (private key) + 160 bit (address) to be stored.
That's 416 bit (= 52 byte) per pair.

For 100 million pairs, thats 4GB of data.


Title: Re: noob question about `bitcoin-cli getnewaddress`
Post by: seoincorporation on November 01, 2018, 05:10:14 PM
What's the weight of each addy we create, let's suppose we want to create 100 Million addys with our wallet, how many MB we need in our hard disk for that?

You probably won't be able to efficiently create 100 million addresses within core.

If you really want to create that much addresses (to try out your luck; maybe generating an already used address with balance? ), use a different program which is optimized to generate private-/public- keypairs.
Core definitely is not.


It might be worth to note, that you won't find an already used address (if that's what you intend to do).


Regarding the disk space required:
Basically, if you want to store the private key + the address (not within core), you'll need 256 bit (private key) + 160 bit (address) to be stored.
That's 416 bit (= 52 byte) per pair.

For 100 million pairs, thats 4GB of data.

Great answer bob, thanks for the information.

The 100 million addys was a hypothetical scenario. If the goal were to try the luck chasing addys with balance, then I would use something like vanity gen. You know... create the addy, verify if it has balance and if it doesn't then try again with a new addy, but never save the addys unless they have balance.

So, 4 GB for 100 million addys isn't a bad deal at all, I think it would be a lot more.