Opcodes are used in Bitcoin Scripts to represent commands or methods. Below you can find the value of the op_checksig code and an implementation in Python. A bitcoin script works with a stack of items. The op_code representing a method, usually takes or puts 1 or more items from the top of the stack.
OP_CHECKSIG | |
Integer value | 172 |
Hex value | 0xac |
Python code representation as used Bitcoinlib
def op_checksig(self, message, _=None): public_key = self.pop() signature = self.pop() signature = Signature.parse_bytes(signature, public_key=public_key) if signature.verify(message, public_key): self.append(b'\1') else: self.append(b'') return True