I am not fully understanding the design purpose of the scriptPubKey in the transaction output.
I think the tx's (say tx1 here) output could just be the receiver's public key's hash.
Then when the receiver want to send the money to another one, he only needs to create the transaction tx2 (with receiver's public key and the sig of the previous transaction).
Then the bitcoin net work could check:
- Is the public hash(tx2.public_key) = t1.output.hash_public_key?
- Verify(tx2.sign, tx2.public_key, tx1)
a+b can approve that this transaction is created by the receiver.
Therefore, I am not quite understanding why we need to save OP_DUP OP_HASH160 next_receiver_public_key_hash OP_EQUALVERIFY OP_CHECKSIG in the tx.output.