Author

Topic: Longest Chain? (Read 461 times)

full member
Activity: 237
Merit: 100
April 27, 2016, 09:49:59 AM
#8
Folks,

Im wondering on what always the longest chain is based on. Is it on how many blocks or on how many transactions have been included.

Most people will tell you that it is based on how many blocks are in the chain.  As a general rule of thumb that's a reasonable explanation, but technically it isn't correct.

The "longest chain" rule is actually based on the total proof of work.  Usually blocks generated at the same block height all have the same difficulty target, so more blocks means more proof of work.  However, if someone were to go back to the genesis block and try to generate several hundred thousand blocks at a MUCH easier difficulty target than the existing blockchain, their chain would still be "shorter" even if it had more blocks because it would have less total difficulty.

For Example - lets say you have two chains competing:

1st chain has 6 blocks and every block has 100 Transactions (total 600 transactions)

2nd chain has 4 blocks and every block has 400 transactions (total 1600 transactions)

Which is now the longest chain and on which are miner now looking on?

Assuming that they all the blocks were generated at the same difficulty target, the 1st chain is the one that miners would choose to work on. Choosing the 2nd chain would result in all other miners rejecting your block, and therefore you would waste your effort (and money) trying to build on it.

Thanks Smiley

How is it if two blocks are being published at the same time. One block with 100 transactions and the other block with 200 transactions included. Is the latter one taken or are miner not looking on the transactions included in the block?

The intention is for miners to use the first block they receive. So some miners would receive the 100 transaction block first and would build on top of that. Other miners would receive the 200 transaction block and build on top of that.  Eventually, a miner would solve a block and broadcast it.  This would make the chain they were working on now the "longest". All miners that were working on the other chain would abandon it and switch to this new longest chain.  The block that didn't get built on top of would be considered "orphaned".

Wow, thanks for the long explanation!!! I got it!!! Cheesy
legendary
Activity: 3472
Merit: 4801
April 27, 2016, 09:39:14 AM
#7
Folks,

Im wondering on what always the longest chain is based on. Is it on how many blocks or on how many transactions have been included.

Most people will tell you that it is based on how many blocks are in the chain.  As a general rule of thumb that's a reasonable explanation, but technically it isn't correct.

The "longest chain" rule is actually based on the total proof of work.  Usually blocks generated at the same block height all have the same difficulty target, so more blocks means more proof of work.  However, if someone were to go back to the genesis block and try to generate several hundred thousand blocks at a MUCH easier difficulty target than the existing blockchain, their chain would still be "shorter" even if it had more blocks because it would have less total difficulty.

For Example - lets say you have two chains competing:

1st chain has 6 blocks and every block has 100 Transactions (total 600 transactions)

2nd chain has 4 blocks and every block has 400 transactions (total 1600 transactions)

Which is now the longest chain and on which are miner now looking on?

Assuming that all the blocks were generated at the same difficulty target, the 1st chain is the one that miners would choose to work on. Choosing the 2nd chain would result in all other miners rejecting your block, and therefore you would waste your effort (and money) trying to build on it.

Thanks Smiley

How is it if two blocks are being published at the same time. One block with 100 transactions and the other block with 200 transactions included. Is the latter one taken or are miner not looking on the transactions included in the block?

The intention is for miners to use the first block they receive. So some miners would receive the 100 transaction block first and would build on top of that. Other miners would receive the 200 transaction block and build on top of that.  Eventually, a miner would solve a block and broadcast it.  This would make the chain they were working on now the "longest". All miners that were working on the other chain would abandon it and switch to this new longest chain.  The block that didn't get built on top of would be considered "orphaned".
legendary
Activity: 4424
Merit: 4794
April 27, 2016, 08:22:47 AM
#6
Thanks Smiley

How is it if two blocks are being published at the same time. One block with 100 transactions and the other block with 200 transactions included. Is the latter one taken or are miner not looking on the transactions included in the block?

its not about transactions amounts. forget transaction amounts.

if there were 2 blocks published at same time. they are both pushed out. and the the next fastest block (minutes later) will contain details of one OR the other, and obviously becomes the longest chain. and everyone follows that one, and drops the chain that is no longer the longest because it doesnt have a new block to keep up.. (process called orphaning)
full member
Activity: 174
Merit: 100
April 27, 2016, 08:19:57 AM
#5
Thanks Smiley

How is it if two blocks are being published at the same time. One block with 100 transactions and the other block with 200 transactions included. Is the latter one taken or are miner not looking on the transactions included in the block?

If both blocks with the same height received about the same time, miners build on top of the one received bit sonner because this one has higher chance to be longest chain in next block height (miners always build on top of longest chain anyway). Number of transactions included does not matter at all.
full member
Activity: 237
Merit: 100
April 27, 2016, 08:01:35 AM
#4
Thanks Smiley

How is it if two blocks are being published at the same time. One block with 100 transactions and the other block with 200 transactions included. Is the latter one taken or are miner not looking on the transactions included in the block?
legendary
Activity: 4424
Merit: 4794
April 27, 2016, 07:30:20 AM
#3
Folks,

Im wondering on what always the longest chain is based on. Is it on how many blocks or on how many transactions have been included.

For Example - lets say you have two chains competing:

1st chain has 6 blocks and every block has 100 Transactions (total 600 transactions)

2nd chain has 4 blocks and every block has 400 transactions (total 1600 transactions)

Which is now the longest chain and on which are miner now looking on?

Thanks in advance

Best

answer in green

the chain is a chain of blocks. the longest chain is the longest amount of blocks
legendary
Activity: 2674
Merit: 2970
Terminated.
April 27, 2016, 07:29:21 AM
#2
Im wondering on what always the longest chain is based on.
Do you know what the word longest means? In your case, the answer would be chain 1. The number of blocks is what determines the longest chain. Additional useful information can be found here.
full member
Activity: 237
Merit: 100
April 27, 2016, 07:05:41 AM
#1
Folks,

Im wondering on what always the longest chain is based on. Is it on how many blocks or on how many transactions have been included.

For Example - lets say you have two chains competing:

1st chain has 6 blocks and every block has 100 Transactions (total 600 transactions)

2nd chain has 4 blocks and every block has 400 transactions (total 1600 transactions)

Which is now the longest chain and on which are miner now looking on?

Thanks in advance

Best
Jump to: