How to make a cryptocurrency: Part 1, demystifying the Bitcoin blockchain 12-01-2017, 07:25 PM
#1
How to make a cryptocurrency: Part 1, demystifying the Bitcoin blockchain
![[Image: bitcoin-australia.png]](http://bitcoin-currency.net/wp-content/uploads/2017/07/bitcoin-australia.png)
Cryptocurrencies are often viewed as very complex, and the Bitcoin blockchain is viewed as something magical that makes everything decentralized (it does the opposite, we'll talk about that later though). In this thread, I'm going to explain how the blockchain explained in the original Bitcoin whitepaper by Satoshi Nakamoto works, so you can start thinking about how to implement your own cryptocurrency.
What's a blockchain?
A blockchain is a data structure composed of 'blocks'. Each block contains the hash of the previous block, so earlier blocks cannot be modified without rebuilding every block after it.
Now, you may be wondering what a block is...
A block is another data structure, which, as described in the whitepaper, contains the following items:
- The previous block's hash
- The Nonce, which is a random number
- A Merkle tree of the transactions
- The hash of the Merkle root, the nonce, and the previous hash
Merkle trees:
A Merkle tree is another data structure, where each item is hashed, then those hashes are combined and hashed, and then those are combined and hashed...
Eventually, you have 1 hash left, this is called the Merkle Root.
The advantage to using Merkle trees instead of directly storing the transactions, is that once a transaction is old, it can be removed from the blockchain, saving space, without breaking the blockchain.
Here's a diagram which describes this:
![[Image: jUO0jcE.png]](https://i.imgur.com/jUO0jcE.png)
Since the hash of the previous block doesn't include the Merkle branches, only the Merkle root, the branches can be pruned without a problem.
Proof of work:
Bitcoin implements what is called a 'proof of work' mining system. Proof of work systems are often described as systems that make the miner computers solve 'complex math problems', and when a solution is found, they are awarded in Bitcoin. I hate this explanation, since it says nothing.
A better explanation is that they try to find a nonce value, that when the block is hashed, the hash is under a certain value. This is hard, since hashing takes a lot of computational resources, and each computer would need to go through a lot of values, thus a lot of hashes, to find the answer.
There are problems with proof of work systems, however... Bitcoin miners use enough energy, at any given moment, to power a large city. This energy usually comes from fossil fuels, which harm the environment... This is a huge waste of energy.
Conclusion
I hope you've learned from this. If you think about it, blockchains aren't really that complex, so all those people who say it is have no idea what they are talking about.
Keep an eye out for the next thread in the series!
It's possible that I got something wrong. If I did, post about it please.
Post below with comments, questions, or general discussion related to this.
Source: Bitcoin: A Peer-to-Peer Electronic Cash System by Satoshi Nakamoto - https://bitcoin.org/bitcoin.pdf
(This post was last modified: 12-01-2017, 07:28 PM by Blink.)











![[+]](https://sinister.li/images/modern/collapse_collapsed.png)

















![[Image: ezgif_com_gif_maker.gif]](http://image.ibb.co/jc44HH/ezgif_com_gif_maker.gif)
and sweet can't wait!