How to Unlock Satoshi’s Bitcoins

Artiom Baloian
4 min readFeb 16, 2022

--

As the bitcoin blockchain is complex, I need to provide background information about the transaction, transaction output, locking and unlocking script, and then how Satoshi’s bitcoins can be spent.

Transactions

Transactions are the most important component of the bitcoin protocol. Everything else is designed to make sure that transactions can be created, processed and added to the blockchain successfully. The main goal of transactions is to transfer value (bitcoins) between participants. When Satoshi ran the bitcoin protocol for the first time in 2009 the first bitcoin transaction was made, which was a Coinbase transaction (newly mined bitcoins as a reward of mining a block) in the block 1. The block 0 (Genesis block) is hard-coded.

Transaction Output

Every bitcoin transaction creates outputs. The transaction outputs are the most important part of the transaction as it represents bitcoin value that can be spent. It is also known as unspent transaction outputs (UTXO). There is no value of balance in the bitcoin blockchain. A balance of your bitcoin wallet is the sum of all UTXOs distributed in the blockchain that your wallet can spend. The transaction output consists of two parts:

  1. An amount of bitcoin
  2. A cryptographic puzzle that determines the condition required to spend bitcoin

The cryptographic puzzle is known as locking script or scriptPubKey. It is basically a stack-based programming language with simple and limited operations.

For example, assume Alice has 1 bitcoin (UTXO’s value is 1 bitcoin) and she sends it to Bob. Alice creates a new transaction where input is her current transaction’s UTXO and output is a new transaction output. If the new transaction is confirmed by miners, Alices’ current UTXO will be unspendable and Bob will be owner of the new transaction’s output. In other words, it is a chain of bitcoin value movements.

Structure

I would like to illustrate the entire structure in the following figure where I tried to split the bitcoin blockchain into various parts from the top to the bottom that reach to the heart of the bitcoin; scriptPubKey or locking script.

Bitcoin blockchain structure from top to bottom

How Locking and Unlocking Scripts Work in Bitcoin?

There are different types of transactions, but when Satoshi ran the bitcoin network there was only Pay-to-Public-Key (P2PK) type. The scriptPubKey for the P2PK looks as follows:

scriptPubKey = <public key> OP_CHECKSIG

The above script can be unlocked (spend) by providing only a digital signature (bitcoin uses ECDSA) created by corresponding private key. The following would be unlocking script (it is called scriptSig) of the above locking script:

scriptSig = <signature>

We have to concatenate scriptSig and scriptPubKey and then execute a stack-based programming language. After concatenation it will look as follows:

<signature> <public key> OP_CHECKSIG

Execution starts from left to right and if there is no operator command it pushes the data into the stack.

script execution

The OP_CHECKSIG operator checks if the <signature> matches (digital signature verification) the <public key> and pushes TRUE to the top of the stack, otherwise FALSE.

The transaction is valid if the top of the stack is TRUE or any other non-zero value, otherwise it is not a valid transaction and bitcoins cannot be spent.

NOTE: scriptPubKey is on the blockchain but scriptSig must be provided by the wallet service of the user or the user can create a transaction and submit to the bitcoin network using existing libraries. If the transaction is confirmed by miners and the block is mined successfully the scriptSig will also be stored on the blockchain.

Later on the P2PK scripts were deprecated and Pay-to-Public-Key-Hash (P2PKH) was offered for superior security and convenience. It is also a complex script. There are other types as well, but the P2PKH is the most commonly used transaction in bitcoin.

Get Satoshi’s Transaction & Locking Script

Bitcoin transactions in the blockchain are encoded into the binary data. In the following picture I will show it in human friendly and readable JSON form.

  • The value is Satoshi’s bitcoin value (mining reward in 2009 was 50 BTC).
  • The script is the locking script. It consists of Satoshi’s public key and OP_CHECKSIG operation.
  • The addresses contains Satoshi’s bitcoin address.

How to Unlock Satoishi’s Bitcoins?

As you may have noticed, in order to unlock and spend Satoshi’s bitcoins you need to have Satoshi’s private key in order to create a digital signature out of it. You already have Satoshi’s public key on the blockchain, and we also know that Bitcoin Protocol uses Elliptic Curve Cryptography to generate a private key and then derive a public key from the private key. It is almost impossible to do the opposite: getting the private key from the public key.

Now you know how to unlock Satoshi’s bitcoins. If you want to try it, then good luck!

--

--

No responses yet