Bitcoin Forum
December 15, 2024, 01:34:39 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: noob question about `bitcoin-cli getnewaddress`  (Read 320 times)
bitachoin (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 1


View Profile
October 27, 2018, 02:00:12 AM
Merited by DarkStar_ (1)
 #1

How many times can I call `getnewaddress`? what exactly is happening to create a new address every time?

thank you for your help!
Pmalek
Legendary
*
Offline Offline

Activity: 2982
Merit: 7642


Playgram - The Telegram Casino


View Profile
October 27, 2018, 08:02:47 AM
 #2

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.

▄▄███████▄▄███████
▄███████████████▄▄▄▄▄
▄████████████████████▀░
▄█████████████████████▄░
▄█████████▀▀████████████▄
██████████████▀▀█████████
████████████████████████
██████████████▄▄█████████
▀█████████▄▄████████████▀
▀█████████████████████▀░
▀████████████████████▄░
▀███████████████▀▀▀▀▀
▀▀███████▀▀███████

▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 
Playgram.io
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

▄▄▄░░
▀▄







▄▀
▀▀▀░░
▄▄▄███████▄▄▄
▄▄███████████████▄▄
▄███████████████████▄
▄██████████████▀▀█████▄
▄██████████▀▀█████▐████▄
██████▀▀████▄▄▀▀█████████
████▄▄███▄██▀█████▐██████
█████████▀██████████████
▀███████▌▐██████▐██████▀
▀███████▄▄███▄████████▀
▀███████████████████▀
▀▀███████████████▀▀
▀▀▀███████▀▀▀
██████▄▄███████▄▄████████
███▄███████████████▄░░▀█▀
███████████░█████████░░
░█████▀██▄▄░▄▄██▀█████░
█████▄░▄███▄███▄░▄█████
███████████████████████
███████████████████████
██░▄▄▄░██░▄▄▄░██░▄▄▄░██
██░░░░██░░░░██░░░░████
██░░░░██░░░░██░░░░████
██▄▄▄▄▄██▄▄▄▄▄██▄▄▄▄▄████
███████████████████████
███████████████████████
 
PLAY NOW

on Telegram
[/
aleksej996
Sr. Member
****
Offline Offline

Activity: 490
Merit: 389


Do not trust the government


View Profile
October 27, 2018, 09:53:11 AM
 #3

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.
AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
October 27, 2018, 11:08:43 AM
 #4

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?

bitachoin (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 1


View Profile
October 27, 2018, 02:08:47 PM
 #5

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.
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2504



View Profile WWW
October 28, 2018, 12:04:10 PM
Merited by AdolfinWolf (1)
 #6

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.

HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4363

<insert witty quote here>


View Profile
October 30, 2018, 08:45:24 PM
Merited by achow101 (3)
 #7

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

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
seoincorporation
Legendary
*
Offline Offline

Activity: 3374
Merit: 3130



View Profile
October 31, 2018, 08:00:31 PM
 #8

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  Shocked

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2504



View Profile WWW
October 31, 2018, 08:08:09 PM
Merited by seoincorporation (1)
 #9

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.

seoincorporation
Legendary
*
Offline Offline

Activity: 3374
Merit: 3130



View Profile
November 01, 2018, 05:10:14 PM
 #10

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.

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!