> ## Documentation Index
> Fetch the complete documentation index at: https://docs.carletonblockchain.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# How the Blockchain works

> A high level overview of the technical aspects of Blockchain.

# What is a Blockchain?

Resources Used:

<Cards>
  <Card title="Bitscan" href="https://btcscan.org/" />

  <Card title="Anders Brownworth Blockchain Visual" href="https://andersbrownworth.com/blockchain/hash" />
</Cards>

> TLDR : Imagine a blockchain is like an append only, singly linked-list that anyone in the world can see.

# Key Concepts

<Steps>
  <Step title="Hash">
    ## Hash

    A hash is a fingerprint of some digital data.

    Regardless if the input data is 1 char or an entire library, a unique hash will be generated. SHA-256 (Secure Hash Algorithm 256-bit) produces a fixed-size 256-bit hash value.

    ```math theme={null}
    2^{256} = 1.1579209 \times 10^{77} \space \text{combinations}
    ```

    According to [Bitbo](https://bitbo.io/how-many-users), there is reportedly 200 million active Bitcoin addresses.

    The chances you randomly guess/brute force a seed phrase is about:

    ```math theme={null}
    1/8.6 \times 10^{-78}
    ```

    > TLDR: The odds someone hacks your Bitcoin address through guessing/brute force is essentially 0.

    <Frame>
      <img src="https://mintcdn.com/carletonblockchain/i-a8dAUgkm3FC6Jr/images/img/hash.png?fit=max&auto=format&n=i-a8dAUgkm3FC6Jr&q=85&s=24664355a988258dc35adbc7c50cac72" width="1191" height="423" data-path="images/img/hash.png" />
    </Frame>
  </Step>

  <Step title="Block">
    ## Block

    A block is a container that holds a list of transactions or data records.

    ### Components

    * **Data**: Transactions or records that the block stores
    * **Nonce**: A value used in mining to find a valid hash
    * **Hash**: Digital signature combining block number, data, previous block's hash, nonce, and timestamp

    <Frame>
      <img src="https://mintcdn.com/carletonblockchain/i-a8dAUgkm3FC6Jr/images/img/block.png?fit=max&auto=format&n=i-a8dAUgkm3FC6Jr&q=85&s=70eeceaec48e98e2abe941e78aa75621" width="1191" height="566" data-path="images/img/block.png" />
    </Frame>
  </Step>

  <Step title="Blockchain">
    ## Blockchain

    A chain of blocks that are cryptographically linked together.

    Blockchains are "immutable" because changing ANY data in a block will:

    * Change the hash of that block
    * Invalidate all subsequent blocks
    * Each block can hold \~4,000 transactions (1MB limit)

    <Frame>
      <img src="https://mintcdn.com/carletonblockchain/i-a8dAUgkm3FC6Jr/images/img/blockchain.png?fit=max&auto=format&n=i-a8dAUgkm3FC6Jr&q=85&s=97bd2377bb68101dee187c62d7d7b21d" width="1446" height="614" data-path="images/img/blockchain.png" />
    </Frame>
  </Step>

  <Step title="Distributed System">
    ## Distributed System

    The network is distributed, meaning:

    * Anyone can see the blockchain
    * The network accepts the majority consensus
    * The longest chain is typically considered valid

    <Frame>
      <img src="https://mintcdn.com/carletonblockchain/i-a8dAUgkm3FC6Jr/images/img/distributed.png?fit=max&auto=format&n=i-a8dAUgkm3FC6Jr&q=85&s=2d210489c96d6b202486fcd919559f60" width="1442" height="894" data-path="images/img/distributed.png" />
    </Frame>
  </Step>
</Steps>
