5 min read

The 6 Key Concepts of the Blockchain

The 6 Key Concepts of the Blockchain

Ms. Blockchain is a database. Not a traditional one. She is a distributed database. She is a decentralized database. She is an immutable database. Her father is Mr. Satoshi Nakamoto. Her birthday is January 9, 2009. She was born at Sourceforge. Her doting father named her Bitcoin. 

There are 6 key things you must know before your first date with Ms.Blockchain.

#1) Base-N Systems

We started counting using our fingers. We show 1 finger to mean 1 (though not always), 2 fingers to mean 2, and so on. We have ten fingers. Thus we championed base-10 or decimal system. In decimal system, all numbers are written using some combination of ten symbols – 0,1, 2, 3, 4, 5, 6, 7, 8 and 9.

 Likewise, in a base-2 (or binary) system, all numbers are written using only two digits – 0 and 1. A base-8 (or octal) system use 8 digits – 0, 1, 2, 3, 4, 5, 6 and 7. The number of symbols or digits is also called the radix. You can use any base as you like. The ancient human mathematicians of Sumer and Babylonia used base-60 or Sexagesimal system. That’s why we have 60 minutes in an hour and 360 degrees in a circle.  

 Here, we are particularly interested in base-16 (or hexadecimal) system. Hexadecimal uses 16 digits – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Hex digit A is same as decimal 10. Hex B is decimal 11. C is 12, D is 13. E is 14. F is 15. A hexadecimal string is usually written with the prefix 0x e.g. FA1B in hex is written as 0xFA1B. You can also use other popular notations like (FA1B)hex or (FA1B)16 . The case does not matter in hexadecimal – 0xFA1B is same as 0xfa1b. Converting one base system to another is very easy. Elementary math is all you need.

If you tell a girl that you have thought of her 100 times the last night, and if she is a programmer, she might eventually ask – “100 in decimal, hexadecimal, octal or binary?” And she is right. The number 100 can mean a lot of things.

#2) Reversing byte order

Take the hexadecimal string 0xAABBCCDD. It has 8 hex digits i.e. 4 bytes. The first byte is AA, the second BB, third CC and fourth DD. We always write it as AA BB CC DD – in that order, left to right like English. Computers however are 2 kinds – the first kind, known as the Big Endian, writes it like us. The second kind, known as Little Endian, however writes it right to left (like Arabic). They will write 0xAABBCCDD as DD CC BB AA. Bitcoin isLittle Endian. So to work with Bitcoin, we have to do lots of byte order reversals. It’s not difficult at all, just reverse the bytes (2 hex digits at a time) and you are done – AABB is BBAA, AA112233 is 332211AA.

#3) Unix Time

The Unix Epoch time stamp is simply the number of seconds that have elapsed since 1 January 1970 00:00:00

You can use an online tool like https://www.unixtimestamp.com/index.php to get the Unix time.

#4) SHA-256

SHA-256 is the heart of the Blockchain. It is one of the key concepts you will need. Why? 

Think SHA-256 as a Magic Hat. Any text can go in, any. What comes out is always 256 bits. You can take an input text – one single word, a phrase, a full paragraph, or even the text of the complete set of 32 volumes of Encyclopedia Britannica – and put it into SHA-256 box, you will always get 256 bits i.e. 256/8 = 32 bytes i.e. 256/4 = 64 hex digits. 

SHA-256 is truly one-way traffic and thus called as a trapdoor function. The 4 properties of SHA-256 are:

#5) First look at a Block

Blockchain is simply a very long string of 1’s and 0’s. At the time of writing this sentence, there are 534558 blocks in the Bitcoin blockchain. Every 10 minutes, a new block gets added. Blocks contain Bitcoin transactions like Bob sent 100 bitcoins to Alice. Bitcoin, with capital B, refers to the protocol whereas bitcoin, with small b, means the currency. 

This is how a real block looks like. This is block 170. Block 170 is a special block. It contains the first ever bitcoin transaction between two humans. Using this transaction, Satoshi Nakamoto, the father of blockchain, sent 10 bitcoins to late Hal Finney. Hal was a computer scientist, and one of the first set of enthusiasts who contributed to the development of Bitcoin. He coded Bitcoin’s Proof-of-Work system.

#6) Peer-to-Peer Network

P2P or peer-to-peer network is a socialist architecture. The opposite of p2p is a client-server architecture. In a client-server architecture any communication between two computers (clients) must go via a centralized entity (server).  

Instead think about a network where both you and me share a folder on our hard disks and start sharing files directly using internet. You see the files on my shared folder. And I see the files on your shared folder. If I have to send a file to you, I simply copy it to your folder. If you have to send a file to me, you simply copy it to my folder – exactly how a simple file share works. A file share, on a home or office LAN is in essence a simple p2p network.

 Now, instead of just two of us, if thousands of people connect with each other, start sending and receiving files directly to and from each other’s shared folders – that’s a P2P network in full glory. Unlike client-server, in a P2P network all peers are equal.

Bitcoin uses P2P network. Bitcoin by default allows 8 outbound connections. The number of inbound connections is configurable by the user. The software that you need to join Bitcoin’s P2P network is called Bitcoin Core. 

~~~~~~ Excerpt from the book “A date with Blockchain” ~~~~~~