<p>There is no "consensus algorithm" that starts and stops as you are asking. There isn't a timer and there isn't anything that nodes communicate other than blocks.</p>

<p>The process of updating the blockchain (i.e. the consensus algorithm) is always running and "wakes up" whenever a new block is received. It is run by nodes by themselves as there is no need to communicate with other nodes except to receive new blocks. Updating the blockchain only works on complete and valid blocks.</p>

<p>The process of every node receiving a new block and updating their own view of the blockchain <em>is</em> the  consensus algorithm.</p>

<blockquote>
  <p>Due to latency and other issues, every miner is probably building a different block, at a different speed.</p>
</blockquote>

<p>They are building different bllocks because they are different miners. Each miner is working on their own  unique block. They probably are not working on blocks at different heights.</p>

<blockquote>
  <p>1) When the consensus algorithm will start? There is like a timer? (For example: "every 10 minutes the consensus algorithm starts, with the purpose of putting a new block in the blockchain")</p>
</blockquote>

<p>It "starts" within a node when it receives a new block. There is no timer, and it is  not a networkwide algorithm.</p>

<blockquote>
  <p>2) Can a miner create more than one block before the consensus algorithm start ? For example, it finishes a block and before this block goes under the consensus algorithm, it creates another one.</p>
</blockquote>

<p>Sure. When a node receives a new block before it has validated previous ones, the new block is partially validated (the parts that don't rely on previous blocks are checked) and then it goes into a queue.</p>

<blockquote>
  <p>2) When the consensus algorithm start do it consider the blocks builded by all the miners ? And if some miner haven't finished building one's?</p>
</blockquote>

<p>Then those miners lose the race and get nothing. Consensus only cares about complete and valid blocks. Whatever other miners are doing does not matter unless they too broadcast a valid block for that height.</p>

<blockquote>
  <p>3) Is the order of transaction in a block important ? Must the transactions in the blocks respect the chronological order of the correnspondent "real" transaction (A sends 9 bitcoins to B) ?</p>
</blockquote>

<p>Yes, kind of. The order for two independent transactions does not matter. If transaction A came first and transaction B (which has no relation to transaction A) is second, a block can have B then A and that does not matter. The point of blocks is to establish the chronological order anyways.</p>

<p>But if transaction B relies on A (so it spends an output of A), then yes, the order matters. In that case, B must come after A. Otherwise the block is invalid and nodes will reject it.</p>

CC BY-SA 4.0
2019-11-29T17:55:34.047Z
2019-11-29T17:55:34.047Z
Ava Chow
<p>Let's consider a blockchain. They mining nodes are listening to transactions and every one is building is own block. Due to latency and other issues, every miner is probably building a different block, at a different speed. At this point, i have some questions:</p>

<p>1) When the consensus algorithm will start? There is like a timer? (For example: "every 10 minutes the consensus algorithm starts, with the purpose of putting a new block in the blockchain") </p>

<p>2) Can a miner create more than one block before the consensus algorithm start ? For example, it finishes a block and before this block goes under the consensus algorithm, it creates another one.</p>

<p>2) When the consensus algorithm start do it consider the blocks builded by all the miners ? And if some miner haven't finished building one's?</p>

<p>3) Is the order of transaction in a block important ? Must the transactions in the blocks respect the chronological order of the correnspondent "real" transaction (A sends 9 bitcoins to B) ?</p>

<p>Thanks</p>

<blockchain><mining-theory><consensus>
Mining process in a blockchain
AleWolf
# Mining process in a blockchain

(Asked by: username_0 on 2019-11-29)

Let's consider a blockchain. They mining nodes are listening to transactions and every one is building is own block. Due to latency and other issues, every miner is probably building a different block, at a different speed. At this point, i have some questions:

1) When the consensus algorithm will start? There is like a timer? (For example: "every 10 minutes the consensus algorithm starts, with the purpose of putting a new block in the blockchain")

2) Can a miner create more than one block before the consensus algorithm start ? For example, it finishes a block and before this block goes under the consensus algorithm, it creates another one.

2) When the consensus algorithm start do it consider the blocks builded by all the miners ? And if some miner haven't finished building one's?

3) Is the order of transaction in a block important ? Must the transactions in the blocks respect the chronological order of the correnspondent "real" transaction (A sends 9 bitcoins to B) ?

Thanks

**Tags:** blockchain, mining-theory, consensus


---

## 1 answers

### Answer by username_1 on 2019-11-29. Score: 1 | Accepted answer

There is no "consensus algorithm" that starts and stops as you are asking. There isn't a timer and there isn't anything that nodes communicate other than blocks.

The process of updating the blockchain (i.e. the consensus algorithm) is always running and "wakes up" whenever a new block is received. It is run by nodes by themselves as there is no need to communicate with other nodes except to receive new blocks. Updating the blockchain only works on complete and valid blocks.

The process of every node receiving a new block and updating their own view of the blockchain *is* the consensus algorithm.

> Due to latency and other issues, every miner is probably building a different block, at a different speed.

They are building different bllocks because they are different miners. Each miner is working on their own unique block. They probably are not working on blocks at different heights.

> 1) When the consensus algorithm will start? There is like a timer? (For example: "every 10 minutes the consensus algorithm starts, with the purpose of putting a new block in the blockchain")

It "starts" within a node when it receives a new block. There is no timer, and it is not a networkwide algorithm.

> 2) Can a miner create more than one block before the consensus algorithm start ? For example, it finishes a block and before this block goes under the consensus algorithm, it creates another one.

Sure. When a node receives a new block before it has validated previous ones, the new block is partially validated (the parts that don't rely on previous blocks are checked) and then it goes into a queue.

> 2) When the consensus algorithm start do it consider the blocks builded by all the miners ? And if some miner haven't finished building one's?

Then those miners lose the race and get nothing. Consensus only cares about complete and valid blocks. Whatever other miners are doing does not matter unless they too broadcast a valid block for that height.

> 3) Is the order of transaction in a block important ? Must the transactions in the blocks respect the chronological order of the correnspondent "real" transaction (A sends 9 bitcoins to B) ?

Yes, kind of. The order for two independent transactions does not matter. If transaction A came first and transaction B (which has no relation to transaction A) is second, a block can have B then A and that does not matter. The point of blocks is to establish the chronological order anyways.

But if transaction B relies on A (so it spends an output of A), then yes, the order matters. In that case, B must come after A. Otherwise the block is invalid and nodes will reject it.


---

