# How does Bitcoin work?

At the heart of Bitcoin lies the blockchain, a distributed ledger system that records every transaction ever made. This public ledger ensures transparency and immutability, preventing fraudulent activity. Transactions are initiated by users with digital signatures, verified by miners, and then added to the blockchain in blocks.

### Securing and Validating the Network

Mining is the process of verifying and adding new transactions to the blockchain. It also serves the essential role of securing the network through a computational puzzle called proof-of-work (PoW).

**Mempool**

New transactions are broadcast to the network by users. These transactions can involve sending Bitcoin, creating new contracts, or changing existing ones. The transactions are temporarily stored in a distributed memory pool, accessible by all nodes on the network. Fees act as a digital tipping system, guiding miners towards transactions that promise greater rewards.

**Block Creation**

Miners compete to collect and group unconfirmed transactions into blocks. Each block has a limited capacity, so miners choose transactions that maximize their potential reward. Miners add a "coinbase" transaction to each block, which is essentially a reward for themselves for successfully creating the block.

**Hashing**

Hashing is a cryptographic function that takes any data as input and generates a unique, fixed-length output. In the context of Bitcoin mining, the input consists of the block header, including the previous block's hash, timestamp, and Merkle root. Miners use specialized hardware called ASICs to perform billions of calculations per second, attempting to find a hash that starts with a certain number of zeros. It is often described as "solving a complex mathematical puzzle". This difficulty is adjusted automatically to maintain the average block creation time at approximately 10 minutes.

**Block Validation**

Once a miner finds a valid hash, they broadcast the new block to the network. Other nodes on the network verify the block by:

* Recalculating the hash and ensuring it meets the difficulty requirements.
* Validating all transactions within the block.
* Checking the block header information for accuracy and consistency.

If the block is valid, it is added to the blockchain, and the successful miner receives their reward in Bitcoin. Blocks are considered confirmed after a certain number of subsequent blocks have been added to the chain. This typically requires six confirmations, making it very difficult to alter or tamper with previously confirmed blocks.

**Disclaimer:**

The content of this document is for informational purposes only. It does not constitute (i) investment advice or recommendations, (ii) an offer, solicitation, or inducement to purchase, sell, or hold digital assets, or (iii) financial, accounting, legal, or tax advice. Digital assets (including FTs and NFTs) are subject to market volatility, involve high risk, regulatory changes, and may depreciate in value. The information is provided "as is," and we make no warranties regarding its accuracy. Please consult your legal, tax, or investment professionals to determine whether trading or holding digital assets is suitable for you.


---

# 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://docs.unisat.io/misc/knowledge-base/bitcoin/how-does-bitcoin-work.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.
