The lock and unlock scripts for pay-to-pubkey are the simplest form of assigning satoshis to a public key.
The lock script has two components:
⟨pubKey⟩ OP_CHECKSIG
These components are based on the following data structures:
VarInt : Length of public key
[Byte] : Serialized public key
OpCode : OP_CHECKSIG
The unlock script has one component:
⟨signature⟩
This component is based on the following data structure:
VarInt : Length of signature
[Byte] : Serialized signature
The combined script has three components:
⟨signature⟩ ⟨pubKey⟩ OP_CHECKSIG
The script is parsed and executed from left to right. Every data object is pushed on top of the stack implicitly. Validating the script the following steps are executed:
⟨signature⟩ ⟨pubKey⟩ OP_CHECKSIG
⟨signature⟩
⟨pubKey⟩ OP_CHECKSIG
⟨pubKey⟩⟨signature⟩
OP_CHECKSIG
pops the first two items off the stack, checks the signature and pushes ⟨1⟩
on the stack if the signature is valid or stops the execution with an error otherwiseOP_CHECKSIG
⟨1⟩
⟨1⟩
after the execution has finished