# What's Under the Hood of Bitcoin?
by David Jr. 2022/07/26
---
# TOC
* Topics
* UTXO
* Signature
* Merkle Tree
* Example
* Key Takeaways
---
# Topics
---
## 1. UTXO
UTXO stands for unspent transaction output. It is the amount of digital currency remaining after a cryptocurrency transaction is executed.
![](https://i.imgur.com/38T6Yxf.png)
---
## 2. Signature
Only the owner can spend these output, so we need to use our own private key to sign this transaction and have other miners to verify our signature with our public key, listed in Input.
----
![](https://i.imgur.com/B8IYQgq.jpg)
---
## 3. Merkle Tree
![](https://i.imgur.com/kVB8ULE.png)
----
Why Merkle Trees are Important For Blockchain?
----
1. every node in the network will have to keep a record of every single transaction that has occurred because it's decentralized system.
![](https://miro.medium.com/max/645/0*1B31atH5V153v5JP.jpg)
----
## Merkle Tree
2. Further on, such verification requests will require huge amounts of data to be sent over the network
![](https://i.imgur.com/5yhB10n.png)
----
## Merkle Tree
3. and the computer performing this verification will need a lot of processing power for comparing different versions of ledgers.
![](https://i.imgur.com/aal0vej.jpg)
----
Advantages of Merkle Tree:
1. Less disk space: Merkle trees occupy less disk space when compared to other data structures.
----
2. Efficient verification: Merkle trees offer efficient verification of integrity and validity of data and significantly reduce the amount of memory required for verification.
* Merkle Tree search- O(logn)
* Linked List search- O(n)
----
<!-- ![](https://i.imgur.com/cpvZk1l.png) -->
![](https://i.imgur.com/MNcmTym.png)
----
3. Tampering Detection: The miner can compare the Merkle root in the header with the Merkle root stored in the data part of a block and can easily detect this tampering.
---
# Example
<https://github.com/david30907d/blockchain-misc/tree/master/golang-blockchain>
---
# Key Takeaways
1. UTXO: Bitcoin use UTXO to record each address's balance
2. Signature: Use Signature to verify if your the owner of this UTXO
3. Merkle Tree: With this data structure, we can spin use light-weight node for wallet application
---
# Refs
1. [ref](https://ithelp.ithome.com.tw/articles/10215108)
2. [ref](https://www.geeksforgeeks.org/blockchain-merkle-trees/)
{"metaMigratedAt":"2023-06-17T05:28:11.755Z","metaMigratedFrom":"YAML","title":"What's Under the Hood of Bitcoin?","breaks":true,"description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"20f67950-8a5d-4f1d-a303-568606ddda38\",\"add\":3672,\"del\":1133}]"}