<blockquote>
<p>It's valid but it's a miner writing wrong data, e.g. changing a transaction address to his own or changing a 3 btc transaction to 30 (while the wallet holds 50). The hashes are correct but the miner is using his position as miner to benefit himself or others</p>
</blockquote>
<p>Miners can't change that data in a transaction because that data is secured by the transaction-author's <a href="https://en.wikipedia.org/wiki/Digital_signature" rel="nofollow noreferrer">digital signature</a>. Any change in the data will cause a signature check to fail.</p>
<p>Nobody cares about other people's balances, no one ever needs to know another person's balance. Bitcoin keeps track of coins not balances. In this case a coin means an unspent transaction output (UTXO). These UTXOs can only be spent by someone who knows the secret number (private-key) that can be used in a mathematical proof of right to spend.</p>

CC BY-SA 4.0
2021-03-24T12:32:10.600Z
Yes, that makes sense, thanks. I guess I'm looking for realistic scenarios where a miner could try and cheat the blockchain, but the tech is resilient enough to not even allowing my scenario coming to fruition.
C0pterPi
CC BY-SA 4.0
2021-03-24T14:18:37.127Z
@C0pterPi Miners can re-write the blockchain at will if the have more than 50% of the hashing power, this is known as the "51% attack".
Polygnome
CC BY-SA 4.0
2021-03-24T15:02:33.737Z
But how would they even start at re-writing anything if they can't sign other people transactions, therefore having nothing they can change?
C0pterPi
CC BY-SA 4.0
2021-03-25T09:24:04.770Z
@C0pterPi https://bitcoin.stackexchange.com/questions/658/what-can-an-attacker-with-51-of-hash-power-do
Polygnome
CC BY-SA 4.0
2021-03-26T17:38:46.607Z
Very cool, a lot less than I imagined.
C0pterPi
CC BY-SA 4.0
2021-03-24T11:14:39.200Z
2021-03-24T11:14:39.200Z
RedGrittyBrick
<p>I understand that forks are resolved by opting in for the eventual longest chain, preferring the chain with the longest POW. But everything I read on this suggests it's just random chance or that the next block is really &quot;alone&quot; on some nodes due to delays in propagating, so &quot;tough luck&quot;.</p>
<p>But let's imagine the scenario where a miner changes the last block with incorrect information for his own benefit, creating block A which should be rejected by the network. Another miner creates block B with the correct data.
We now have a fork, with block A and B being at the end of the chain.
The next miner needs to choose one of the blocks, hopefully not validating the bad intentions of the first miner. How does this gets resolved, how does block A get proven wrong?</p>

CC BY-SA 4.0
2021-03-23T17:06:14.163Z
Validating a block is extremely fast compared to mining it, it can be done in a matter of seconds. The malicious block wouldn't validate, no other node would accept it.
Polygnome
CC BY-SA 4.0
2021-03-23T17:45:37.043Z
Why wouldn't be accepted? The hashes are correct, what other validations are performed?
C0pterPi
CC BY-SA 4.0
2021-03-23T18:03:34.277Z
If the hashes are correct, then the block isn't malicious, Its a valid block. It can't have "incorrect information" if its a valid block.
Polygnome
CC BY-SA 4.0
2021-03-23T18:08:33.203Z
It's valid but it's a miner writing wrong data, e.g. changing a transaction address to his own or changing a 3 btc transaction to 30 (while the wallet holds 50).
The hashes are correct but the miner is using his position as miner to benefit himself or others.
C0pterPi
CC BY-SA 4.0
2021-03-23T18:30:48.160Z
The miner can not transfer funds from an address without having the private key - which means owning the wallet. Transactions are signed, you can nor create a transaction with funds of someone else without having their private key.
Polygnome
CC BY-SA 4.0
2021-03-23T21:55:20.653Z
@C0pterPi the hash is only one of many checks to ensure a block is valid. If anything is invalid (such as a transaction with an invalid signature), then the block is rejected.
chytrik
CC BY-SA 4.0
2021-03-24T09:24:36.293Z
Appreciate all the replies. Will look better into what signing a transaction entails, if it protects a transaction from its contents to be tampered with, e.g. input or receiving address.
So there aren't any mischievous actions a miner could try to do that would benefit himself?
C0pterPi
CC BY-SA 4.0
2021-03-25T02:50:24.970Z
@C0pterPi The block is either valid or invalid. If it's valid, then there's no problem. If it's invalid, then everyone ignores it.
David Schwartz
<security><blockchain-fork><consensus>
How are malicious forks resolved?
C0pterPi
# How are malicious forks resolved?

(Asked by: username_0 on 2021-03-23)

I understand that forks are resolved by opting in for the eventual longest chain, preferring the chain with the longest POW. But everything I read on this suggests it's just random chance or that the next block is really "alone" on some nodes due to delays in propagating, so "tough luck".

But let's imagine the scenario where a miner changes the last block with incorrect information for his own benefit, creating block A which should be rejected by the network. Another miner creates block B with the correct data.
We now have a fork, with block A and B being at the end of the chain.
The next miner needs to choose one of the blocks, hopefully not validating the bad intentions of the first miner. How does this gets resolved, how does block A get proven wrong?

**Tags:** security, blockchain-fork, consensus

> **Comments:**
> **username_1**: Validating a block is extremely fast compared to mining it, it can be done in a matter of seconds. The malicious block wouldn't validate, no other node would accept it.  
> **username_0**: Why wouldn't be accepted? The hashes are correct, what other validations are performed?  
> **username_1**: If the hashes are correct, then the block isn't malicious, Its a valid block. It can't have "incorrect information" if its a valid block.  
> **username_0**: It's valid but it's a miner writing wrong data, e.g. changing a transaction address to his own or changing a 3 btc transaction to 30 (while the wallet holds 50). The hashes are correct but the miner is using his position as miner to benefit himself or others.  
> **username_1**: The miner can not transfer funds from an address without having the private key - which means owning the wallet. Transactions are signed, you can nor create a transaction with funds of someone else without having their private key.  
> **username_2**: @username_0 the hash is only one of many checks to ensure a block is valid. If anything is invalid (such as a transaction with an invalid signature), then the block is rejected.  
> **username_0**: Appreciate all the replies. Will look better into what signing a transaction entails, if it protects a transaction from its contents to be tampered with, e.g. input or receiving address. So there aren't any mischievous actions a miner could try to do that would benefit himself?  
> **username_3**: @username_0 The block is either valid or invalid. If it's valid, then there's no problem. If it's invalid, then everyone ignores it.  

---

## 1 answers

### Answer by username_4 on 2021-03-24. Score: 1 | Accepted answer

> It's valid but it's a miner writing wrong data, e.g. changing a transaction address to his own or changing a 3 btc transaction to 30 (while the wallet holds 50). The hashes are correct but the miner is using his position as miner to benefit himself or others

Miners can't change that data in a transaction because that data is secured by the transaction-author's [digital signature](https://en.wikipedia.org/wiki/Digital_signature). Any change in the data will cause a signature check to fail.

Nobody cares about other people's balances, no one ever needs to know another person's balance. Bitcoin keeps track of coins not balances. In this case a coin means an unspent transaction output (UTXO). These UTXOs can only be spent by someone who knows the secret number (private-key) that can be used in a mathematical proof of right to spend.

> **Comments:**
> **username_0**: Yes, that makes sense, thanks. I guess I'm looking for realistic scenarios where a miner could try and cheat the blockchain, but the tech is resilient enough to not even allowing my scenario coming to fruition.  
> **username_1**: @username_0 Miners can re-write the blockchain at will if the have more than 50% of the hashing power, this is known as the "51% attack".  
> **username_0**: But how would they even start at re-writing anything if they can't sign other people transactions, therefore having nothing they can change?  
> **username_1**: @username_0 https://bitcoin.stackexchange.com/questions/658/what-can-an-attacker-with-51-of-hash-power-do  
> **username_0**: Very cool, a lot less than I imagined.  

---

