# BSV Transactions and SHA-256

#### What is a Transaction?

The **BSV blockchain** is an **electronic cash system** built on:

* **2.1 quadrillion indivisible units** called **satoshis**.
* A **shared public ledger** that records every transfer of ownership.

1 BSV = **100,000,000 satoshis**.\
Satoshis are the **smallest unit of account** in BSV. Ownership of any amount is transferred through a **transaction** — a record added to the ledger.

***

#### What a Transaction Contains

Each transaction specifies:

* **The amount** of satoshis being transferred.
* **The source** of these satoshis (**input UTXOs**).
* **The destination** of these satoshis (**output UTXOs**).
* Transactions **consume input UTXOs** and **create new output UTXOs**.
* Every UTXO has a **locking script** (lockScript or scriptSig) written in **Bitcoin Script** — a minimal, stack-based language.
* To spend a UTXO, the sender must provide an **unlocking script** (unlockScript or scriptPubKey) that satisfies the locking conditions.

👉 **Predicate system:** A script resolves to either **true** or **false**. If true, ownership of satoshis is transferred.

<br>

<figure><img src="/files/dLJ973TpKYqLXlFes20b" alt=""><figcaption></figcaption></figure>

#### Transactions and Digital Signatures

Every satoshi is part of a **chain of digital signatures** tracing back to Bitcoin’s **Genesis block (2009)**.

* Each transaction adds a new link in this chain.
* This ensures **ownership history** is preserved.

***

#### SHA-256 and Transaction IDs

Once a transaction is constructed and serialized into **raw hexadecimal (HEX)**, it is hashed using **double SHA-256**.

* The result is a **Transaction ID (TXID)**.
* TXIDs allow nodes to:
  * Organize transactions in **memory pools**.
  * Place transactions into **Merkle Trees** for efficient validation.

👉 **Key takeaway:** SHA-256 hashing ensures each transaction has a **unique, tamper-proof identifier**.

***

#### Example: P2PKH Transaction

**Raw HEX form:**

```
010000000167e7105b52e8534596af29dba949921cffe3dbaa555b8ed96121346c6755adae000000006a47304402206e4db9dee8449b861e5fdc00ba3bdb80fba8cd52c75489376c54bd65d26262650220453569438e6bc6f957b1f7ff6fff4af2e42edaae1ac885382373d42fa569b17c41210267d2d1f8b3affffa10b68b2756ba7f6f4efafcadbecd145181016178d00b379bffffffff019c276bee000000001976a914accd105073775756cc04962bc1e4893694f50c5588ac00000000
```

\
Below, is the same transaction decoded and presented in a JSON format:

```
{ 
    "version": 1, 
    "size": 191, 
    "locktime": 0, 
    "vin": [ 
        { 
            "txid": "aead55676c342161d98e5b55aadbe3ff1c9249a9db29af964553e8525b10e767", 
            "vout": 0, 
            "scriptSig": { 
                "asm": "304402206e4db9dee8449b861e5fdc00ba3bdb80fba8cd52c75489376c54bd65d26262650220453569438e6bc6f957b1f7ff6fff4af2e42edaae1ac885382373d42fa569b17c[ALL|FORKID] 0267d2d1f8b3affffa10b68b2756ba7f6f4efafcadbecd145181016178d00b379b", 
                "hex": "47304402206e4db9dee8449b861e5fdc00ba3bdb80fba8cd52c75489376c54bd65d26262650220453569438e6bc6f957b1f7ff6fff4af2e42edaae1ac885382373d42fa569b17c41210267d2d1f8b3affffa10b68b2756ba7f6f4efafcadbecd145181016178d00b379b" 
            }, 
            "sequence": 4294967295 
        } 
    ], 
    "vout": [ 
        { 
            "value": 39.999999, 
            "n": 0, 
            "scriptPubKey": { 
                "asm": "OP_DUP OP_HASH160 accd105073775756cc04962bc1e4893694f50c55 OP_EQUALVERIFY OP_CHECKSIG", 
                "hex": "76a914accd105073775756cc04962bc1e4893694f50c5588ac", 
                "reqSigs": 1, 
                "type": "pubkeyhash", 
                "addresses": [ 
                    "mwGeB8HZwx22snzWoXRRfL2dhmJ4QXZr9V" 
                ] 
            } 
        } 
    ], 
    "time": 1645757424, 
} 
```

#### Transactions consist of 6 serialised elements:

#### Transaction Structure

* **Transactions** consist of **6 serialized elements**.
* **Input UTXOs** consist of **5 serialized elements**.
* **Output UTXOs** consist of **3 serialized elements**.

👉 Each part plays a role in **locking, unlocking, and transferring satoshis** across the blockchain.

&#x20;

<figure><img src="/files/Wk1khFTlWkjwJDn6Nuz1" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/py7f4njsUKPgN8SRG7U4" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/un3jByhK2sV7vIRmnoXg" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/T68VWXK3jg4HdkLXE6c2" alt=""><figcaption></figcaption></figure>

#### Input UTXOs consist of 5 serialised elements:

The below breaks-down the input UTXO from the above example transaction.

![](/files/Lu5Fh6ehBlCdJ7qG5pON)

#### Output UTXOs consist of 3 serialized elements:

The below table breaks-down the new output UTXO(s) from the above example transaction.

<figure><img src="/files/uIv5XIEOVYgRmK2wp67p" alt=""><figcaption></figcaption></figure>

✅ **Summary:** In BSV, transactions define **ownership transfers** of satoshis using **locking and unlocking scripts**. Each transaction is given a unique **TXID** by applying **double SHA-256**, making the system secure, verifiable, and scalable.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-primitives-hash-functions/sha256/bsv-transactions-and-sha-256.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
