DEV Community

Discussion on: Blockchain: what is in a block?

Collapse
 
damcosset profile image
Damien Cosset

If I understand correctly what your scenario is:

  • A block has been mined
  • In this block, you modify one transaction to your benefit. In this transaction, you give yourself 10 BTC instead of 0.01 BTC for example.

For this new transaction to be part of the blockchain, you, or another miner, would have to find a new Proof-of-Work for this block. This is an entirely new block now.

You mine it and find a valid Proof-of-Work. You propagate your finding to the network and they have to validate this new block.

Here, the problem is much bigger for this block to be accepted.

1) The network sees you tried to cheat the system. The block is rejected and you wasted your resources mining this new block for nothing.

2) The network accepts this new block ( for whatever reasons ). Now, we have to mine every single block that was validated after the one you just proposed because they are all invalid now.

I believe in this case, you won't get caught, because your block will never be part of the blockchain. You can't modify a block that is already part of the blockchain. You will create a new block that will act as a replacement of an existing block. So, for this block to be accepted, the network would also have to provide valid proof-of-work for every single block after the one you want to change.

  • In the case where you are mining the block and decide to modify a transaction in the block you are mining in your favor:

When you find a valid Proof-of-Work to your block, it is propagated to other nodes. These nodes will verify that the Proof-of-Work is valid, but they will also verify every single transaction in the block. There is a very long list of parameters that nodes must control in order to call a transaction valid ( inputs, outputs...). In this scenario, this is where your fraud will be stopped. Your block won't be accepted by the network.

I hope I answered your question. Let me know if anything wasn't clear.

Collapse
 
lilredindy profile image
lilredindy

ok that makes enough sense. from your type-up i get that the consensus from other peer nodes will not be in my favor due to this proof-of-work algorithm that is performed on new blocks.