The Pay-to-Public-Key-Hash script is the basic form of making a transaction and is the most common form of transaction on the Bitcoin network.
Our other guide such as elliptic curve cryptography and digital signatures can show you why this is all that’s needed from a mathematical standpoint – the purpose of this guide though is to explain how nodes take the information using the Forth stack based programming language.
The ScriptPubKey and ScriptSig for a transaction is shown below:
<ScriptPubKey=OP_DUP OP_HASH160<Public KeyHash> OP_EQUAL OP_CHECKSIG
ScriptSig= <Signature><Public Key>
The ScriptPubKey and ScriptSig are joined together and executed in the following format.
Validation=<Signature><Public Key>OP_DUP OP_HASH160<Public KeyHash> OP_EQUAL OP_CHECKSIG
If the result is 1 then the operation is true and the transaction is valid! But first a run through of exactly how this works:
The process operates from left to right and the operators add to the stack in a LIFO process (Last in First Out).
First the signature is moved to the stack, then the public key is moved to the top of the stack. The OP_DUP duplicates the top item on the stack and then the Hash160 function hashes the top item on the stack turning the public key into its hash. The OP_EQUAL checks whether the two values of the hashed public key are the same and then the OP_CHECKSIG verifies whether the signature is true.
- Crypto Adoption on the Rise: Countries Pioneering Digital Asset Usage Sponsored
- Meeting FirstByte Media: Comments from Cosmin Mesenschi, CEO & Founder of FirstByte Media Sponsored
- Meet ZENIQ: The Decentralized Blockchain-Powered Ecosystem
- GAUGECASH Integrates Chainlink Keepers to Decentralize Automation of Novel Liquidity Pool, GAUGEFIELD
- Ariva Digital’s ‘Arivaman’ Gets Set To Embark On Epic Adventure
- WAGMI Games Partners With Cubix To Launch PvP Tower Defense Play-to-Earn Game
- How 5 Popular Smart Contract Platforms Compare to Nexus
- Is the “Decentralization” in the Blockchain Ecosystem Really Decentralized?
- Astra Protocol, a Compliance Layer for DeFi, Could Help US SEC, Other Regulators with Ensuring Consumer Protection for Crypto Investors
- TabTrader's Native TTT Token Launches on Gate.io
This website is only provided for your general information and is not intended to be relied upon by you in making any investment decisions. You should always combine multiple sources of information and analysis before making an investment and seek independent expert financial advice.
Where we list or describe different products and services, we try to give you the information you need to help you compare them and choose the right product or service for you. We may also have tips and more information to help you compare providers.
Some providers pay us for advertisements or promotions on our website or in emails we may send you. Any commercial agreement we have in place with a provider does not affect how we describe them or their products and services. Sponsored companies are clearly labelled.