# Blockchain structures

The blokchain is designed to be immutable method for storing a digital ledger

Blocks and chains are the two main components that make up a blockchain.  Let's break them down:

## Blocks

Blocks are like containers that store information about transactions that occur on the blockchain network. **Each block contains a set of transactions, and it also includes a unique identifier called a hash.** The hash is generated using a mathematical algorithm that takes into account the data in the block. It acts like a digital fingerprint for the block. **Blocks are linked together in a specific order, forming a chain.** Blocks are what provide data storage

Blocks are designed to store data on the blockchain

* The headers provide important information
* The bodies store the actual transaction data

**Block headers** can vary from implementation to implementation, but they **usually have a few major fields**:

* **Timestamp**: When the block is created
* **Transaction root**: A value that summarizes the transactions that a block contains
* **Previous block hash**: This implements the blockchain's "chains"

Bitcoin, the original blockchain, has a few other fields

* **Version**: Tracks current version of the blockchain software
* **Nonce**: A random value used in proof-of-work consensus
* **Difficulty target**: Another value used in consensus

## Chains

**Chains are the connections between blocks in a blockchain.** **Each block contains a reference to the previous block's hash**, creating a chain-like structure. This linking of blocks **ensures the immutability of the blockchain**. It becomes very difficult to modify or tamper with the data stored in the blockchain because any change in one block would require changing the hash of that block and all subsequent blocks. The chains provide the security and integrity of the blockchain by making it resistant to tampering or unauthorized modifications.

**If blockchain is a digital ledger, a block is a single page in the ledger**

* Not very difficult to create or forge a valid block

The "chains" are what makes the blockchain immutable

Each block header contains the hash of the previous block header

* Changing/forging block N requires new versions of blocks N+1, N+2, etc
* The difficulty of making a fake blockchain grows rapidly with the number of blocks


---

# 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://davidjosearaujo.gitbook.io/online-courses/blockchain-security/fundamentals-of-blockchain-security/blockchain-structures.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.
