Author

Topic: Why is Bitcoin wallet client peer sync so slow (Read 33524 times)

newbie
Activity: 56
Merit: 0
November 19, 2012, 01:24:46 PM
#14
In order to verify a transaction, you need to know that all of the transactions that came before it were also valid. Suppose Bob gives you some bitcoins. In order to verify that transaction, you need to know that Bob obtained that money from a valid transaction. Let's say he got the money from Alice. Now you need to know where Alice got the money. And so on, all the way back to the miner who first produced the coins. And that's just for one transaction. In order to verify all transactions sent to you, you need to be able to verify every single transaction that has ever taken place in the history of Bitcoin, and this is exactly what the client is doing when it is synchronising with the network. When doing this for the first time, the client has to not only download the entire transaction record (which is currently nearly 4GB in size), but also verify every single transaction. This can take a while. However, once it has synchronised the first time, the client only needs to download and verify transactions that have taken place since then, so it is much faster.

Thank you for this very clear explanation. Smiley
legendary
Activity: 1400
Merit: 1000
I owe my soul to the Bitcoin code...
It is definitely chugging along.
legendary
Activity: 1148
Merit: 1008
If you want to walk on water, get out of the boat
I am a little confused as to why a p2p distributed system has such a hard time transferring ~5Gb of data around.

Is it the way the blocks are broadcast across the network? Such as the most recent blocks get highest priority for verification purposes and the rest whenever a node is able?

It just seems strange that in the torrent world multiple gig files are passed around and verified easily.
Because the database system that is used by the client sucks. If you notice your hard disk happily work when the client is syncing.
legendary
Activity: 1400
Merit: 1000
I owe my soul to the Bitcoin code...
I am a little confused as to why a p2p distributed system has such a hard time transferring ~5Gb of data around.

Is it the way the blocks are broadcast across the network? Such as the most recent blocks get highest priority for verification purposes and the rest whenever a node is able?

It just seems strange that in the torrent world multiple gig files are passed around and verified easily.
newbie
Activity: 2
Merit: 0
You can get the first 193,000 blocks via torrent way faster:

magnet:?xt=urn:btih:0bb0521942f586ed96203c6f4d136324756f8a9a&dn=bootstrap.dat&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.ccc.de:80&tr=udp://tracker.istole.it:80
newbie
Activity: 40
Merit: 0
Thanks!  That's a great way of explaining it.


I guess I would think after a transaction has been verified x times it wouldn't need to be verified by EVERY other client.  I'm sure I'm just not understanding something...

Clients don't verify transactions, Miners include them in a block.

Basically you transaction gets only confirmed 1 Time. After that it counts only the numbers of blocks over the block that confirmed your transaction.

The reason for this is, that the client counts always the longest string of blocks in existence as valid, so which each block more it becomes harder to override your transaction.

This was the easiest way I could explain it.

Edit: That should explain it:

http://spectrum.ieee.org/img/06Bitcoin-1338412974774.jpg
legendary
Activity: 4542
Merit: 3393
Vile Vixen and Miss Bitcointalk 2021-2023
In order to verify a transaction, you need to know that all of the transactions that came before it were also valid. Suppose Bob gives you some bitcoins. In order to verify that transaction, you need to know that Bob obtained that money from a valid transaction. Let's say he got the money from Alice. Now you need to know where Alice got the money. And so on, all the way back to the miner who first produced the coins. And that's just for one transaction. In order to verify all transactions sent to you, you need to be able to verify every single transaction that has ever taken place in the history of Bitcoin, and this is exactly what the client is doing when it is synchronising with the network. When doing this for the first time, the client has to not only download the entire transaction record (which is currently nearly 4GB in size), but also verify every single transaction. This can take a while. However, once it has synchronised the first time, the client only needs to download and verify transactions that have taken place since then, so it is much faster.
newbie
Activity: 11
Merit: 0
You can always download the blockchain via torrent (check out the bitcoin torrent project), and then import it via the -loadblock option.
legendary
Activity: 2506
Merit: 1010
Future clients will have another system much much faster.

Not just "sometime in the future" but ... available today (if you are willing to use code stil undergoing development)

Ultraprune merged in mainline
 - https://bitcointalksearch.org/topic/ultraprune-merged-in-mainline-119525


So, relief is coming.
legendary
Activity: 1148
Merit: 1008
If you want to walk on water, get out of the boat
Because the database system that is used by the client sucks. Future clients will have another system much much faster.

The client must download every block, the "sync" means it download all the blocks. 1 block is created after average 10 minutes. Now, to verify that each block is indeed ok and the header of it is ok with the previous one, it keep reading the blocks and checking things. If you notice your hard disk happily work when the client is syncing. Future clients will make this verify much much faster by optimizing how the client do this.

Anyway, yes, verifying the blocks is required to make sure the blockchain is the right one. Bitcoin is a p2p network after all, and it cannot trust anyone. It must be sure that the blockchain it download makes sense  Cheesy But yes, making the process faster is a good idea.

Anyway there are lightweight clients who do not download the blockchain and simply use one on a server. This of course doesn't mean they can steal your bitcoin!
legendary
Activity: 1232
Merit: 1001
I guess I would think after a transaction has been verified x times it wouldn't need to be verified by EVERY other client.  I'm sure I'm just not understanding something...

Clients don't verify transactions, Miners include them in a block.

Basically you transaction gets only confirmed 1 Time. After that it counts only the numbers of blocks over the block that confirmed your transaction.

The reason for this is, that the client counts always the longest string of blocks in existence as valid, so which each block more it becomes harder to override your transaction.

This was the easiest way I could explain it.

Edit: That should explain it:

newbie
Activity: 6
Merit: 0
It is in the interests of security.  If you want speed use a credit card.
legendary
Activity: 1027
Merit: 1005
I asked the same thing awhile back and the answer I got was way over my head. The best thing to do is to let it download and then save the files somewhere (spare flash drive/external hard drive/etc) and just copy it over if you ever need to reinstall the client. You will still have to update from that point forward but everything from then back will be there and wont need downloading.
newbie
Activity: 40
Merit: 0
I'm sure this is a beat the dead horse subject, but I can't find a good answer.

Why does a new client take hours (even days) to process, and "catch up"?  I guess I would think after a transaction has been verified x times it wouldn't need to be verified by EVERY other client.  I'm sure I'm just not understanding something...

Thanks!
Jump to: