<blockquote>
<p>The verifying process is only between the signature and the sender's public key with no reference to the receivers public key.</p>
</blockquote>
<p>That's incorrect. The message signed by the sender includes several pieces of information, including the outputs of the transaction. Changing the receiver's public key would invalidate the signer's signature.</p>

CC BY-SA 4.0
2021-12-31T01:02:19.427Z
Thanks for correcting Pieter, looks like the Blockchain 101 video I watched was wrong... I thought the process of verifying was to compare the sender's public key with the signature and to ensure they both come from the same private key?
Vik
CC BY-SA 4.0
2021-12-31T11:49:29.910Z
@Vik: a spender has to satisfy the locking script that is in *a prior block*
RedGrittyBrick
CC BY-SA 4.0
2021-12-30T03:44:25.627Z
2021-12-30T03:44:25.627Z
Pieter Wuille
<p>Say a hacker is tinkering with a receivers public key in the latest block in a chain such that they change it to their own public key and intercept the transaction. The verifying process is only between the signature and the sender's public key with no reference to the receivers public key.</p>
<p>The hacker could then mine the block (and potentially be first) to find the new hash. This means they gain their mining reward as well as intercepting bitcoin fraudulently.</p>

<blockchain>
What stops a hacker changing the last block?
Vik
# What stops a hacker changing the last block?

(Asked by: username_0 on 2021-12-30)

Say a hacker is tinkering with a receivers public key in the latest block in a chain such that they change it to their own public key and intercept the transaction. The verifying process is only between the signature and the sender's public key with no reference to the receivers public key.

The hacker could then mine the block (and potentially be first) to find the new hash. This means they gain their mining reward as well as intercepting bitcoin fraudulently.

**Tags:** blockchain


---

## 1 answers

### Answer by username_1 on 2021-12-30. Score: 6

> The verifying process is only between the signature and the sender's public key with no reference to the receivers public key.

That's incorrect. The message signed by the sender includes several pieces of information, including the outputs of the transaction. Changing the receiver's public key would invalidate the signer's signature.

> **Comments:**
> **username_0**: Thanks for correcting username_1, looks like the Blockchain 101 video I watched was wrong... I thought the process of verifying was to compare the sender's public key with the signature and to ensure they both come from the same private key?  
> **username_2**: @username_0: a spender has to satisfy the locking script that is in *a prior block*  

---

