I have this Script P2PKH
<A Signature> <A Public Key> OP_DUP OP_HASH160 <A Public Key Hash> OP_EQUALVERIFY OP_CHECKSIG
The bitcoin.org documentation say this
The entire transaction's outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.
Now I want to understand how the code is running inside the stack and how the OP_CHECKSIG work.
My question comes from the fact, why use another operator (OP_CHECKSIG) if is used the operator OP_EQUALVERIFY to does control ?
But I have another question on OP_DUP, the documentation say this
Duplicates the top stack item.
Why when the bitcoin run the script need to duplicate the items inside the stack?
to close, exist other documentation on Bitcoin Script language?