Blockchain is the underlying code that provides cryptocurrency with its functionality.
Now let me give you an idea of how that code works.
If you have an account balance of $200 and you have spent $300, which of the transactions are valid?
For centralised solutions, the problem is easy. What time or order did the transactions come in? Then just give the transactions a transaction number. Problem solved! Earlier transactions were subjected to a remaining balance. Once there is no more balance or all spending transactions exceed the balance total, the remaining transactions become invalid.
Why can’t this be done on the blockchain?
The first problem is that all nodes have different times and they can’t correct this without calling a central authority to give them the correct time. The second problem is very similar, there is no central authority for the numbering so transactions will end up with multiple transactions using the same number.
Blockchain solves these problems with blocks.
Let’s say as a node I put all my transactions in a box (this represents a block on the blockchain).
The block is just a group of transactions that total 1MB or at least they were before SegWit.
SegWit allows the separation of the transaction data from the signature (and the signature script). A common misconception is that the signature is then stored somewhere else. In fact, signatures and transactions are only stored on nodes that have been updated with SegWit. Nodes that have not been updated store only the transaction data.
Blocks also contain a hash pointer that points to the previous block, this creates a chain and makes an ordering system for the transactions. One final thing that needs to be put in a block is called a nonce and that is just a fancy name for a random number.
Finally, to secure everything inside the block, a hash function is used. It’s a unique code for everything in the block, so no other nodes can change what is inside.
When the number the hash function produces falls within the correct range the block is accepted as part of the blockchain and nodes start to point to it! This process occurs every 10 minutes on the Bitcoin blockchain. As nodes come and go from the network the difficulty level or hash range changes to ensure that it always takes approximately 10 minutes for 1 node out of the entire network to guess the nonce. Of course sometimes 2 nodes get the correct nonce at the same time. In this case, nodes point to the one they heard about first provided it is the longest chain.
And that is it! That is how the blockchain works. It is a whole bunch of computers essentially playing guess the number to win Bitcoins and have their blocks submitted!!
If there is a topic you would like me to discuss in this crypto vlog, just make a comment on the video and suggest it!