Bitcoin Forum
May 09, 2024, 07:49:17 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How does the initial sync is done?  (Read 898 times)
js2082 (OP)
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 28, 2013, 08: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?
1715240957
Hero Member
*
Offline Offline

Posts: 1715240957

View Profile Personal Message (Offline)

Ignore
1715240957
Reply with quote  #2

1715240957
Report to moderator
Even in the event that an attacker gains more than 50% of the network's computational power, only transactions sent by the attacker could be reversed or double-spent. The network would not be destroyed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715240957
Hero Member
*
Offline Offline

Posts: 1715240957

View Profile Personal Message (Offline)

Ignore
1715240957
Reply with quote  #2

1715240957
Report to moderator
falschgeld
Newbie
*
Offline Offline

Activity: 30
Merit: 0


View Profile
April 28, 2013, 01:48:35 PM
 #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.
js2082 (OP)
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 28, 2013, 05: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?
leijurv
Member
**
Offline Offline

Activity: 63
Merit: 10


Vires in Numeris


View Profile WWW
April 28, 2013, 05: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.

Firstbits 1Leijurv. Or, if you like cats, Firstbits 1Kittens and 1catcat as well. If you're a chemist, also 1Helium, 1Erbium, 1Copper, 1Cerium, and 1Nickel. If you like numbers, 123four, 12234,  12three.
Keybase and onename user: leijurv.
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 28, 2013, 05: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

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
js2082 (OP)
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 28, 2013, 06: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?
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
April 28, 2013, 06: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.

Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


js2082 (OP)
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 28, 2013, 07:49:11 PM
 #8

OK I got it. Once the peer network established, everything is fine.
TierNolan
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
April 28, 2013, 10: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.

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
js2082 (OP)
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 29, 2013, 12:29:43 AM
 #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.
TierNolan
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
April 29, 2013, 08: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. 

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
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!