Bitcoin Forum

Other => Beginners & Help => Topic started by: tjohej on February 13, 2013, 05:26:00 PM



Title: From where does my Bitcoin client download the public keys of others?
Post by: tjohej on February 13, 2013, 05:26:00 PM
From where does my Bitcoin client download the public keys of others? Are they stored in the blockchain or does the p2p network keep a separate list of public keys? Any help appreciated.

I checked the FAQ, and introduction to Bitcoin and "How Bitcoin Works". They don't go into the detail that my question seeks.

(by the way, the https://en.bitcoin.it page is outdated because it states that 50 BTC are created for each block. Nowadays since a long time a miner who finds a block only gets half=25 BTC for each block mined)


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: Walter Rothbard on February 13, 2013, 05:34:08 PM
Public addresses are stored in the blockchain.  These are essentially a hash of the public keys of others.  When 'coin is spent from an address, the public key of the address is included in the transaction and the transaction is signed with the private key.

I think I have that right but may be glossing over some details or may be inaccurate, in which case I hope someone will correct me.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: DeathAndTaxes on February 13, 2013, 05:52:06 PM
The public key is only needed to verify transactions. 
The public key is included in the transaction itself. 
This means until you spend from an address the public key is unknown.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: Gyrsur on February 13, 2013, 06:02:13 PM

This means until you spend from an address the public key is unknown.


if you spend to an address the public key of the receiver is known (e.g. paper wallet). it is unknown as long the address is not loaded.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: DannyHamilton on February 13, 2013, 07:30:14 PM
This means until you spend from an address the public key is unknown.
if you spend to an address the public key of the receiver is known (e.g. paper wallet). it is unknown as long the address is not loaded.
DeathAndTaxes got this one correct.  Gyrsur, you are mistaken.

If you spend to an address, the Bitcoin Address of the receiver is known, the public key is not.

When you spend from an address, the public key is included in the input of the transaction.  It is only then that the public key becomes known.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: Gyrsur on February 13, 2013, 09:15:21 PM
This means until you spend from an address the public key is unknown.
if you spend to an address the public key of the receiver is known (e.g. paper wallet). it is unknown as long the address is not loaded.
DeathAndTaxes got this one correct.  Gyrsur, you are mistaken.

If you spend to an address, the Bitcoin Address of the receiver is known, the public key is not.

When you spend from an address, the public key is included in the input of the transaction.  It is only then that the public key becomes known.

you both are correct.

"A Bitcoin address is a 160-bit hash of the public portion of a public/private ECDSA keypair. Using some mathemagic, you can "sign" data with your private key and anyone who knows your public key can verify that the signature is valid. See the Wikipedia article for more information about how this works."

https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses (https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses)


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: Stephen Gornick on February 13, 2013, 10:52:06 PM
where does my Bitcoin client download the public keys of others?

Keep in mind that the bitcoin client doesn't know the public key [Edit: Bitcoin address] of others until there is a transaction with a payment to that address.  

For example, create an address using BitAddress:
 - http://www.BitAddress.org

That can be created offline (e.g., load the page, disconnect from the internet, then generate a new one).  That is a valid address but nobody else in the world knows about it.   You can give that address to anyone and they can send bitcoins to that address without the network ever having seen it before.

You could hit print and leave the computer disconnected for 50 years, and the funds would still be there waiting to be spent (by someone with that private key).


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: DannyHamilton on February 13, 2013, 10:54:43 PM
where does my Bitcoin client download the public keys of others?
Keep in mind that the bitcoin client doesn't know the public key of others until there is a transaction with a payment to from that address.   
FTFY


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: tjohej on February 14, 2013, 09:30:05 AM
[snip]
FTFY
Yeah thanks. Your explanation in post #5 was helpful, I understand now. If you had a BTC tip address maybe I'd send a tip.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: Stephen Gornick on February 15, 2013, 02:56:56 AM
where does my Bitcoin client download the public keys of others?
Keep in mind that the bitcoin client doesn't know the public key of others until there is a transaction with a payment to from that address.  
FTFY

Huh?

You can't send a payment to an address without the bitcoin network then becoming aware of that address the payment is sent to.  As soon as that transaction is broadcast then each node becomes aware of the address if it hadn't known of it previously.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: DannyHamilton on February 15, 2013, 06:25:17 AM
where does my Bitcoin client download the public keys of others?
Keep in mind that the bitcoin client doesn't know the public key of others until there is a transaction with a payment to from that address.  
FTFY
Huh?

If you pay attention to the thread that you are commenting in, it should be clear.  Notice, there is a difference between a Bitcoin Address (which is broadcast to the network the first time bitcoins are sent TO the address), and a public key (which isn't broadcast to the network until the first time bitcoins are sent FROM the address).

This means until you spend from an address the public key is unknown.
if you spend to an address the public key of the receiver is known (e.g. paper wallet). it is unknown as long the address is not loaded.
DeathAndTaxes got this one correct.  Gyrsur, you are mistaken.

If you spend to an address, the Bitcoin Address of the receiver is known, the public key is not.

When you spend from an address, the public key is included in the input of the transaction.  It is only then that the public key becomes known.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: Walter Rothbard on February 15, 2013, 03:33:42 PM
where does my Bitcoin client download the public keys of others?
Keep in mind that the bitcoin client doesn't know the public key of others until there is a transaction with a payment to from that address.  
FTFY

Huh?

You can't send a payment to an address without the bitcoin network then becoming aware of that address the payment is sent to.  As soon as that transaction is broadcast then each node becomes aware of the address if it hadn't known of it previously.

That's true, but an address is not a public key.  An address is an irreversable hash of a public key.  You can't turn an address into the corresponding public key.  The public key is only disclosed when a transaction spends from that address.

(I think I have this right, but someone correct me if I'm wrong.)

Because an address is a hash of a public key, you can think of them as the same thing for the purpose of simplification and understanding.  But technically they are different.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: DeathAndTaxes on February 15, 2013, 07:19:10 PM
You have it right Walter.

Bitcoin uses three distinct elements:
* The Bitcoin Address (I sometimes use term public address) which is double hashed plus checksum of the public key.
* The public key which is created using ECC from the private key and represents a point (x,y) on the secp256k1 curve.
* The private key which is a random 256 bit number.


Title: Re: From where does my Bitcoin client download the public keys of others?
Post by: Stephen Gornick on February 15, 2013, 10:20:49 PM
If you pay attention to the thread that you are commenting in, it should be clear.

Ah, got it. 

More often than not when someone is asking about a "public key" they are simply referring to a Bitcoin address.   The question comes up because most ledger systems require an "account number" or similar to be created in advance before transactions related to that entity can occur.    So the question comes up from people wanting to know where each and every bitcoin address that exists is stored.   And the answer to that question, of course, is that bitcoin doesn't require an address to be known by the nodes of the network before it is used.   So addresses exist without the rest of the network knowing about them.  (e.g,, by default 100 addresses are in each node's keypool which the rest of the network does not know anything about.)