Skip to content

Blockchain Pt.1 : What ?

It was trending “recently”. And it is still kind of trending, just not in the same way.

Most people has heard of it, and most have a vague idea about how Bitcoin and cryptocurrencies work.

I’m by no means an expert. But i’ll try to explain the basics the best i can, and if you end up confused… don’t worry. It’s been a while since i taught (or even coded something like this). Note that this is a lengthy work I’m committing to do because it is really fun to examine the whole idea, and it will be posted in many (many) parts, as this work progresses. If you want to comment or even correct something i got wrong, leave a comment.

Blockchain is a decentralized, distributed and (most of the times) public ledger consisting of records called blocks. Using a peer to peer network, clients of this network share part or the whole ledger, and also participate working as an independent auditor/validator to the transactions (and relatively inexpensively) which is known as “mining”. That work will get you rewards whenever you are the one who discovers a new block which is then appended to the ledger, and that reward is where you get “coins”. And to store those coins, you need a “wallet”, which is basically your debit card of the crytocurrency.

That’s a condensed explanation and if you got it, then you might already know something about some or all of those things. But for a lot of people, that might sound like sci-fi so i will explain most concepts that you might barely recall or not even know about.

Glossary

Peer to Peer Network (P2P)

Do you remember Napster ? Too old maybe
What about e-Donkey, Emule, Kazaa, or BitTorrent ? For sure you might have at least heard of the latter.

Usually communication in Internet is mediated by a client (you) and a server. That server also communicates with a lot of other clients. This has many pros and cons, but the main con is that centralization causes that the information IS controlled by THAT server.
In a P2P network, the client doesn’t need to communicate directly with a server. Instead it communicates with one or more clients of the network directly or indirectly. That’s how Blockchain manages to be decentralized and distributed. Each client of the network shares (part or all) the information of the ledger.

Hash

 “A fixed-length unique sequence of random digits, which can be created from data of any size.” – https://en.bitcoinwiki.org/wiki/Hash

A Hash is used to identify the unique information from where it was generated. Note that this means you will get the same hash with such information, but you cannot get the information from the hash.

Ledger

“A book or other collection of financial accounts.”

Exactly what that says. The ledger is a big book/database containing blocks, each new one appended to the previous one. You can think of it as a personal diary, or a computer’s log.

Block

A block is a “page” in the ledger, identified by a hash calculated from its contents. Its contents are transactions that have occurred until that point, and must include a reference to the hash of the block it is appended to. That way, from any block you can follow the previous back to the first one.
Whenever someone “mines” a new block, that someone is awarded with “coins”. And the first transaction of the next block will be this one.

Wallet

As you get coins, you need somewhere to store them. This is done with a Wallet, which is generated using cryptographic* functions.

Whenever you transfer coins, the transaction is signed with a digital signature of your wallet. This allows ANYONE to track and verify where each coin is and who was/is the owner given that you can follow the coin from any block back to its origin. (For Bitcoin and others. There are some cryptocurrencies using untraceable transactions, such as Monero/XMR)

The digital signature is a way to identify unequivocally your wallet, and it doesn’t allow other people using your wallet.

*How cryptography is used will be explored later

Miner / Mining

As part of the network, you do work. That work is known as mining, and you (the client) as miner.

The work consists in validating/auditing all transactions done until now, and trying to solve a problem sent by the network. When you are the first to solve such problem, you “discover” the new block, and you send a message to other peers to validate that. When there are enough confirmations that the solution is correct, you are awarded “coins”. The transaction describing the award you get, is the first transaction for the next block.

Coin

A coin is just data associated to your wallet, and you can transfer that generating new transactions for the ledger and favoring the creation of new blocks.

So, how does that work ?

Lets try a visual aid :

  • Imagine the Blockchain as a file cabinet. And each block, as a drawer. And transactions, as each file inside that drawer.
    Whenever a new block is discovered, it is put on top of the previous one, chained one to the next using their Block ID. This ensures a block cannot be removed without destroying the whole chain.
    A block can contain any number of transactions. In the case of Bitcoin, a block is discovered each 10 minutes approximately, and can contain about 3.500 records.
    Whenever you discover a new block, you are rewarded “coins”. To date (aug/2020) each new block carries a reward of 6.25 coins for Bitcoin, which will halve every few years until all of the 21 million coins are mined.

If i managed to explain these concepts correctly, then you should already have an idea of how this works.

  • You and every other member of the network is working to find the solution to a problem. That uses processing time on your device, and when you find the solution, you submit the answer as “Proof of work” and are awarded with coins after other clients can confirm your work is valid.
  • Those coins get transferred to your wallet, and that information gets saved in a block in the ledger. As every transaction is saved inside blocks in the ledger, you can check who discovered a block, got awarded coins, and follow the coin to any wallet it might end up (for some blockchains).
  • This provides a hard record of everything. You cannot delete a block as each one references the previous one, and as the information is distributed among every client in the network you cannot just go and try to make a change that no one else can validate/audit.
  • This makes the discovery of these blocks and the coins awarded a really unique piece of data whose history is being recorded from birth, in a database that’s shared and validated by a (hopefully) huge group of clients. Being that unique and keeping that record pristine is what gives value to those coins.

Check it out, the value of Bitcoin has exploded since its creation. For reference : In 2010, a guy paid 10.000 Bitcoins for 2 pizzas. Have you checked how much 1 Bitcoin is worth now ? That were tens of millions of dollars worth of pizzas.

Have you read about people who lost their wallet and are offering enormous rewards to whomever is able to recover it ? That is a testament of how secure the system is at protecting the access to a wallet, and how if you are not careful, you can get locked out from your wallet FOREVER.

To be continued ……

Published inCoding

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Ivn Systems/Software ©2020