4 ms·
Interestingly, Bitcoin and similar systems use a Forth-like stack language as script. For instance, a typical transaction goes like this: [scriptSig] [scriptP
by muyuu 11y ago
Interestingly, Bitcoin and similar systems use a Forth-like stack language as script.
For instance, a typical transaction goes like this:
[scriptSig] [scriptPubKey]
Where scriptSig is: __signature__ __public_key__
and scriptPubkey is: OP_DUP OP_HASH160 __some_hash__ OP_EQUALVERIFY OP_CHECKSIG
In rough terms:
OP_DUP works like classic Forth DUP, duplicates the immediate stack element. OP_HASH160 replaces the stack element with its hash160. OP_EQUALVERIFY performs a "fail if not equal" and OP_CHECKSIG takes two elements from the stack and verifies they're a pubkey and its signature.
So basically that's how the system verifies that a transaction is signed by the owner of the input address to go to the owner of the output address.