Suppose i have fully synchronosed bitcoin node running in my local machine and i change its checkpoints data apart from its genesis block and recompile the code. Now what will happen when i try to run the daemon, having older block data residing inside .bitcoin folder. Is this what orphan block is?
2 Answers
It will think that the databases have been corrupted and so it will attempt to redownload the entire blockchain. When it does, it will find that all of the blocks are invalid (because you changed the genesis block) and then it will just do nothing as it is unable to sync what it believes to be a valid blockchain.
Is this what orphan block is?
No. Orphan blocks are something else entirely and unrelated.
-
what is i changed one block lets say block no 100 on source code and recompile the code when i am already synchronised with current block number in bitcoin blockchain May 3, 2018 at 7:25
-
Checkpoints are not checked when you are fully synced, so changing a checkpoint should not effect your node.– Andrew Chow ♦May 3, 2018 at 14:52
-
The question is changing checkpoints and not the genesis block, so your reply doesn't seem to follow. Jul 30, 2018 at 7:44
Assume the following example. You already have a fully sync'd bitcoin node and you then build a new wallet by changing a single line from here :
Change this:
{295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")},
to:
{295000, uint256S("0x01")},
Recompile the code into a new wallet and run it on your already sync'd blockchain, but you will notice zero differences from the original wallet. Checkpoints only have an effect on nodes that have not yet synced up to the block height specified by the checkpoint. Therefore, if you take your custom built wallet and try to use it to sync a new blockchain, it will error out when it gets to block 295000 with the following error: forked chain older than last checkpoint (height 295000)
.
Essentially checkpoints prevent forked chains from being seen as the longest chain, since they will not be able to pass this error validation. Only new nodes and nodes that have not yet synced up to the block height specified in the checkpoint are affected.
To answer your second question, orphaned blocks have nothing to do with checkpoints. An orphaned block is the result of having two (or more) miners solve the proof-of-work challenge at the same time. Since only one of the blocks can be valid, both miners that solved the POW challenge race to notify all of their peers about the new block they found and the network temporarily splits as a result of half of the network thinking Block A is correct and the other half thinking Block B is correct. These types of splits are typically corrected in the next block, but can sometimes span more than one block if the competing chains both continue to solve their POW challenges at the exact same time (very rare but it has happened). This is precisely the reason why many exchanges and other payment services require a certain amount of confirmations before a deposit is considered valid. The more confirmations a block has, the more likely that it is the one and only valid block at that height.