Author

Topic: How does the initial sync is done? (Read 927 times)

legendary
Activity: 1232
Merit: 1094
April 29, 2013, 03:53:33 AM
#11
Yes make a lot of sense. So the longer a blockchain exist, the more difficult to attack it. If a new alt coin is released, the easiest attack time (if someone want to) is at the initial release time where a fake blockchain can be easily be put in to replace the original one.

Partly, the "fake" chain is by definition the weakest one.  The chains are built up block by block.

You could go back 100 blocks and start your new chain from there, you then only have to build 100 blocks.  However, all the rest of the miners will be building on the main chain.  So, by the time you have your 100 blocks done, they will have moved the main chain on.  You need more than 50% of the hashing power to build your chain faster than the main chain.

The strength is down to 2 things.  The main chain is growing fast and the further you want to go back, the more hashing you need to do just to catch up. 

To completely replace a chain you need to re-do all the work already done, and grow your chain faster than the rest of the network.

However, if your chain did become the longest, then everyone will switch to it, and it will become the main chain.

A new alt chain wouldn't have much of a history to replace, but you would still need to grow the attacking chain faster than their main chain.  This is a problem for alt chains.  They generally don't have much hashing power growing their chain, so someone can easily overpower it.  A bored ASIC miner could do it in many cases. 
member
Activity: 70
Merit: 10
April 28, 2013, 07:29:43 PM
#10
Yes make a lot of sense. So the longer a blockchain exist, the more difficult to attack it. If a new alt coin is released, the easiest attack time (if someone want to) is at the initial release time where a fake blockchain can be easily be put in to replace the original one.
legendary
Activity: 1232
Merit: 1094
April 28, 2013, 05:09:34 PM
#9
OK I got it. Once the peer network established, everything is fine.

You can calculate how strong a chain is.  If you connect to 10 nodes, and they all give you a different chain, then you assume that the longest one is the real one.

It isn't possible to make a fake chain that is stronger than the main chain, without spending the same amount of computer processing that was used to create the current main chain.

This is a large amount of processing, so fake chains would be very weak compared to the main chain.

In practice, most nodes would be honest, so most will give you the main chain.  However, even if you only connect to 1 honest node out of 1000, you will be able to confirm that the chain you received from that node are the strongest.
member
Activity: 70
Merit: 10
April 28, 2013, 02:49:11 PM
#8
OK I got it. Once the peer network established, everything is fine.
legendary
Activity: 2506
Merit: 1010
April 28, 2013, 01:17:43 PM
#7
Thanks for the info. But it is still not clear to me. When I started with a genesis block and how does the system know there is no other existing bloackchain in the network that it needs to sync?

There are two methods, if I remember correctly.  Firstly, the client learns what peers believe is the block number at the tip of the longest chain.  So immediately the client knows it has at least N blocks to go.  

Secondly, there is a targeted rate of one block every ten minutes.  If the highest block a client knows about is N, and some period of time goes by (e.g., an hour) and the highest block is still N then it can be suspected that somehow the client isn't getting updated blocks (and the out of sync message displayed)

I'm not positive on either of these, hopefully someone knowledgeable of the details can confirm or correct me.
member
Activity: 70
Merit: 10
April 28, 2013, 01:10:06 PM
#6
But how many peers will be sufficient? If everyone just have the same genesis block, will it considered as sync'd?
legendary
Activity: 2058
Merit: 1452
April 28, 2013, 12:59:25 PM
#5
Thanks for the info. But it is still not clear to me. When I started with a genesis block and how does the system know there is no other existing bloackchain in the network that it needs to sync?
it asks for other peers for blocks
member
Activity: 63
Merit: 10
Vires in Numeris
April 28, 2013, 12:39:16 PM
#4
Thanks for the info. But it is still not clear to me. When I started with a genesis block and how does the system know there is no other existing bloackchain in the network that it needs to sync?
I'm not sure what you mean by that. There is only one blockchain (sometimes more if it's forking). The blockchain starts with the genesis block. The client will download all the subsequent blocks, then verify them, and assemble them into a blockchain.
member
Activity: 70
Merit: 10
April 28, 2013, 12:15:52 PM
#3
Thanks for the info. But it is still not clear to me. When I started with a genesis block and how does the system know there is no other existing bloackchain in the network that it needs to sync?
newbie
Activity: 30
Merit: 0
April 28, 2013, 08:48:35 AM
#2
What happens when the bitcoin or any altcoin initially launched?
The client will try to exchange blocks and transactions with other clients.

The developer will just have a genesis block created, no-one to sync up at this time, how does the system accept that this one block is the complete state of the blockchain?
Well, in fact your client doesn't regard a bare Genesis block as a complete blockchain - it says "out of sync" which means that part of the chain is missing.

Do we need to have certain number of computers running with the same genesis block to confirm each other that no other blockchain is in the network?
No, not really. Every client developer knows which Genesis block is the right Genesis block and this right Genesis block is hardcoded into all clients. No confirmations or anything are neccessary - everybody knows which Genesis block is right and which Genesis block is wrong. If someone comes up with a different Genesis block, they can build their own blockchain and their own network on top of it but a normal Bitcoin client will ignore that.
member
Activity: 70
Merit: 10
April 28, 2013, 03:41:55 AM
#1
When I first start bitcoin-qt, it always says "out of sync", until it sync's with the network on the blockchain. If I don't have internet, then it will stay at "out of sync" all the time.

What happens when the bitcoin or any altcoin initially launched? The developer will just have a genesis block created, no-one to sync up at this time, how does the system accept that this one block is the complete state of the blockchain? Do we need to have certain number of computers running with the same genesis block to confirm each other that no other blockchain is in the network?
Jump to: