Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: schone on April 27, 2011, 10:24:51 PM



Title: network protocol?
Post by: schone on April 27, 2011, 10:24:51 PM
Hello,

I was wondering where can one learn the network protocol of bitcoin?  I've read on the wiki about the transaction and blocks payloads and how they work but I'm curious since I lack basic p2p understanding, how do all the server nodes get *ALL* the transactions information?

Also, it says that on average about every 10 minutes the blocks are sent and the one that is either equal or less than the target wins.  Question is, "the average" what is that.... at what point do all of them transmit their blocks? and how does it work exactly - Do they all just send to all of the nodes they know about the blocks ?  How does this voting (acceptance of a new block) happen simultaneously at all server nodes at once?

I'm looking for the on-the-wire protocol i guess.  Not so much the composition of the data but rather the algorithm of how it works.

I'm a n00b trying to learn and loving bitcoin!

Thanks!


Title: Re: network protocol?
Post by: theymos on April 28, 2011, 12:11:19 AM
Everyone doesn't broadcast their blocks. You only broadcast your block if you win, and you broadcast as soon as you win. 10 minutes is only an average because people can win at any time. It's like everyone is drawing raffle tickets as fast as possible from the same giant pool of tickets, and whenever someone pulls out a winning value, they yell, "I won!".

When you solve a block, you send it to all your peers. They send it to all their peers, etc. Nodes don't broadcast blocks that they've already seen, so this eventually stops.

Whoever solves the next block gets to vote for which previous block they think is accurate.

Read:
http://www.bitcoin.org/bitcoin.pdf
The wiki pages "network" and "block" (down right now)


Title: Re: network protocol?
Post by: schone on April 28, 2011, 12:55:39 AM
So a transaction that gets recorded in block 1 won't be confirmed until block 2 is voted most accurate?

Also, what happens if my miner is working in block X and declares it self a winner (and sends it out), then I get a block from somebody else who claims they are the winner?  What happens now...?



Title: Re: network protocol?
Post by: theymos on April 28, 2011, 01:05:37 AM
So a transaction that gets recorded in block 1 won't be confirmed until block 2 is voted most accurate?

It gets one confirmation from the block that included it, the next block results in two total confirmations, etc.

Also, what happens if my miner is working in block X and declares it self a winner (and sends it out), then I get a block from somebody else who claims they are the winner?  What happens now...?

Whoever solves the next block decides. Until then, you assume yours will win.