# The Data Elements

Now that we understand what a **Merkle Tree** is and why it’s used in distributed and peer-to-peer systems, let’s look more closely at its role within **Bitcoin, and therefore the BSV blockchain (BSV)**.

***

#### **Digital Cash and Data Integrity**

Bitcoin is a **peer-to-peer electronic cash system**, as stated in the title of the Bitcoin white paper.

Just as physical cash requires measures to prevent **counterfeiting**, digital cash systems must also prevent the creation or duplication of fake tokens.

To achieve this, Bitcoin employs **cryptographic verification techniques** that ensure the **authenticity** and **integrity** of its tokens — known as **satoshis**.\
One of these core techniques is the use of **Merkle Trees**, which verify every token and transaction from **issuance** through **each exchange of value**.

***

#### **Transactions as Chains of Custody**

Each **transaction** in Bitcoin represents an **exchange event**, where satoshis move from one custodian to another.

Every transaction is created by **wallet software** as a set of instructions written in BSV’s native language called **Script**.

At the very least, each transaction includes two parts:

1. **Unlocking Script (Input):**\
   Provides the **solution** to the locking puzzle created by the previous owner, proving the spender has the right to use the funds.
2. **Locking Script (Output):**\
   Creates a **new puzzle** that defines how the next owner can later unlock and spend those same funds.

Together, these define a continuous **chain of custody** for digital tokens.

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

***

#### **Digital Signatures and Script Templates**

These scripts commonly use **digital signatures** based on **asymmetric cryptography** (public/private key pairs).

The **wallet software** generates these keys using the **Elliptic Curve Digital Signature Algorithm (ECDSA)**.

A digital signature acts as an **encrypted stamp of authenticity** — verifying that the transaction data hasn’t been altered and that it originates from the rightful owner.

In Bitcoin, the most common script format is called **Pay-to-Public-Key-Hash (P2PKH)**.\
Here:

* The **transaction preimage** (raw data before hashing) is used to generate the signature.
* The **public key** itself is **hashed** to conceal it until the coin is spent.

This ensures privacy and prevents premature exposure of the user’s public key.

***

#### **Raw Transaction Data**

Each transaction is composed of **data fields** that define inputs, outputs, and metadata.

These data chunks are concatenated into a **string of raw transaction data**, which can then be **hashed** to produce a unique **Transaction ID (TXID)**.

This **TXID** serves as the fingerprint of the transaction — allowing it to be uniquely identified without revealing all internal details.

***

#### **Example: Structure of a Raw Transaction**

Below is a simplified table showing how BSV transaction data is represented in **bytes** and **hexadecimal format**:

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

&#x20;

Each transaction’s **raw data string** is then hashed to create its **TXID**, ensuring **uniqueness** and enabling verification across nodes.

***

#### **Key Takeaway**

Every BSV transaction is a **cryptographically verifiable record** linking inputs, outputs, and scripts together in a **chain of trust**.

Through **digital signatures**, **script execution**, and **Merkle Tree verification**, the system ensures that:

* Tokens cannot be **forged** or **double-spent**.
* Ownership and transaction history remain **transparent** yet **secure**.
* Every transaction contributes to a **tamper-proof record** that scales efficiently across the BSV network.


---

# 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-merkle-trees/merkle-trees-in-bitcoin-and-bsv/the-data-elements.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.
