Hi, sorry if this has been asked / discussed before.
I’m struggling to understand one of the inner workings of the bitcoin blockchain, namely, how does the chain actually prevent changes to past transactions? Sorry this is a bit of a lengthy question:
Here’s my current understanding / premise:
- I know that in order to submit a transaction / input, one must sign it with their digital signature (which can only be created if you have access to your private key for the address you’re sending it from), so far so good.
- The miner picks this transaction up from the mempool (at some point), validates it (any idea what type of validation?) and then adds it to a block.
- Once sufficient transactions have been added to the block, the block gets mined, I.e. the miner guesses the output of that block (containing all the transactions, the hash of the previous block and the time stamp of the block) until he/she reaches an output that starts with 18 zeroes (might be more zeroes by now).
- Once the miner has the correct output he/she distributes this to the rest of the network and the network validates that the hash for the block is indeed correct; I.e. proof of work; which is easy to verify once the output is known.
- The block is now considered mined and the miner gets paid in shiny new bitcoins (woohoo). Let’s call this block 2,345
So my transaction sits in block 2,345 and the blockchain continues on its merry way, let’s say that miners in the mean time reach block 10,575.
If I now go and change the transaction in block 2,345, by adding a 0 somewhere in the transaction data, how does the network know that this blocks transaction has changed?
I know that any change, changes the hash value of the transaction and as such the hash value of the block and therefore has a perceived ripple effect on the rest of the blockchain since all transactions based on this block are now referring to a block hash that is no longer accurate. My questions however are:
- What if I add the zero and do not recalculate the hash of the transaction? I.e. the hash of the transaction and the hash of the block do not change.
- When is this change recalculated?
- Is this recalculating part of the bitcoin/blockchain protocol?
- What triggers recalculating?
- How is this automated?
- What is it that the miner validates when validating the transaction?
Thanks for taking the time to read and thanks in advance for answering or pointing me in the right direction.
Cheers,