How blockchain node behaves upon receiving a new block when previous block wasn't acquired?

+1 vote
We know that a part of blockverification is checking that it contains valid previous block hash. But let's imagine, that for some reason (network glitch etc.) previous block never arrived. Wouldn't node discard all the following blocks?

I wonder how this problem is solved? Does node periodically checks whole chain, by requesting peers? How exactly is this implemented?
Mar 26, 2018 in Blockchain by Christine
• 15,790 points
51 views

1 answer to this question.

+1 vote
Best answer

A node will ask for block number N before asking for block N+1. Yes, mostly block N+1 will be discarded if block number N doesn't exist, but that's irrelevant. Because it's not that a node gets blocks only by being the receiving end. It can contact all the other nodes around it, and ask for block number N. If all these nodes don't have block number N, well, then it doesn't exist!

Notice that on a broader scale every node asks its peers for node number N, and verifies that this block follows the rules of the protocol. That's part of the consensus.

If we're talking about mining, the situation is different. You can imagine two competing miners creating blocks. If a miner doesn't have block N, he'll keep trying to mine that block. If he receives block number N after having mined it, the miner just ignores it, and we have a temporary fork in the blockchain with two branches, and block N+1 will have two different versions. Now what determines which branch survives is basically the branch that is mined faster. An arbitrary consensus rule is that the longer chain is always the correct chain. When a longer chain exists, all miners agree that this chain is the correct one.

The reason why this works, is because the probability of mining a block is wide enough over 10 minutes in Bitcoin (or block time in general).

This is why it's wrong to create blockchains with very short time. Because if the time is very short (like 10 seconds), there will be tons of forks before the blockchain stabilizes.

This is why it's wrong to create blockchains with very short time. Because if the time is very short (like 10 seconds), there will be tons of forks before the blockchain stabilizes.

answered Mar 26, 2018 by Perry
• 17,020 points

selected Aug 6, 2018 by Omkar

Related Questions In Blockchain

0 votes
1 answer

How do transactions create a new block in Blockchain?

Bitcoin puts a cap of 2,400 transactions ...READ MORE

answered Aug 10, 2018 in Blockchain by Christine
• 15,790 points
51 views
+4 votes
2 answers

How do I create a new block in Hyperledger Fabric?

This link might help you: https://github.com/hyperledger/fabric-sample ...READ MORE

answered Oct 11, 2018 in Blockchain by Sahu
503 views
0 votes
1 answer

How to create a new wallet on a blockchain?

Firstly, you need to have a clear ...READ MORE

answered Apr 4, 2018 in Blockchain by Christine
• 15,790 points
75 views
+3 votes
4 answers

How do I add a new node on a Hyperledger network?

You can do this by generating the crypto ...READ MORE

answered Apr 6, 2018 in Blockchain by Christine
• 15,790 points
1,611 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
158 views
0 votes
1 answer
0 votes
1 answer

How to retrieve data from a block to a blockchain?

web3.eth.getTransaction(txHash) will returns transaction details like blockHash, transactionIndex, ...READ MORE

answered Jun 26, 2018 in Blockchain by Perry
• 17,020 points
171 views
0 votes
1 answer

In a non-cryptocurrency implementation of Blockchain, how to successfully mine a node?

Difficulty is a property of the blockchain, ...READ MORE

answered Jul 13, 2018 in Blockchain by Perry
• 17,020 points
48 views