G7finance.com - Crypto Currency Updates logo G7finance.com - Crypto Currency Updates logo
2019-07-07 11:42:13

Bitcoin Transactions – Scriptsig and Scriptpubkey – locking and unlocking a transaction?

The Scriptpubkey is the puzzle set to a transaction in order for it to be solved and the script sig is the solution to the puzzle that allows it to be spent.

Historically the Scriptpubkey was named so as it contained the public key or address to be spent from – i.e. the address the transaction was locked to.
The scriptsig was called so due to its need to contain the signature – i.e. the private key of the address that wants to spend and to which the address in the scriptpubkey was locked to.



The Bitcoin transaction script language is a stack based execution language – to layman this is a very basic form of language that doesn’t contain loops and is Turing incomplete (i.e. can’t with an unlimited amount of memory, processing power and time solve everything) – it is designed for one purpose. The stack based execution language has a few important benefits such as its simplicity and minimal processing.

The script language processes from left to right. Numbers are pushed onto the stack and then operated acted on by the next function. There are conditional operators which give the result true or false which in the case of validating a transaction are true if the signature is valid.
The below example is the process of a simple pay to public key hash transaction.

stack based operating procedure for resolving the transaction


The above transaction shows the stack based operating procedure for resolving the transaction – i.e. unlocking it and spending it. To see the process in more detail see our different types of bitcoin transactions and the P2PKH – pay to public key hash transaction type.

Read the Disclaimer : All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer