What is the blockchain and how does it relate to cryptocurrency? Lets begins with a formal definition:

/“The blockchain is a distributed and decentralized ledger that stores data such as transactions, and that is publicly shared across all the nodes of its network.”/

Blockchain is not so different from a regular database. It stores information from the past and one of the main difference is that its decentralized. Everyone on the node has a copy of that database (ledger). There is no central authority to make decisions. It has unique attributes, such as:
* Decentralization – No single party has control over what information is written.
* ‘Write-Only’. You can only write and not edit what’s already there.
* New data can’t conflict with what’s already written
* Information can be accesses and replicated by everyone on the network

Let’s examine a simple bitcoin transaction, if I try to send myself one bitcoin from one wallet to another (A bitcoin wallet is what email is to the internet).
Everyone on the network can see that my second wallet has 0 and my first wallet has 1 ( our identities are not shown on the ledger, only the wallet addresses). When I send the bitcoin to my second wallet, the ledger on all the computers will update, this take some time since a mining process takes place, but we will get to that later.

What if I want to cheat the system and edit my ledger to say that I actually sent myself 2 bitcoins instead of 1? This actually has never happened and to understand why, we need to understand how blockchain security works:

The term blockchain comes from the way it works, the information is stored in groups called blocks and each block is timestamped and linked with the one before it in time. This created a linear chain of blocks.

Each block contains four types of information:
* timetamp
* lastHash (hash of the previous block)
* hash (the current blocks hash)
* Data (This can be any data – but for bitcoin it would be the transaction information)

A hash is a unique string of numbers that identifies each block. The hash is generated by a function that produces the same output with the same exact input. Each block has its unique hash. All the information in the block is passed through the hash function (timestamp, the last hash, current hash, and data)
The hash of the previous block is also part of the current block, thus creating unique hash. This is what makes blockchain so secure.

The graphic below shows how each last hash is a copy of the hash of the previous block:

But if I or someone tries to manipulate the block so the transaction reads 2 bitcoins instead of 1, this is what happens:

Block3 has the lastHash of block2. If I manipulate the data of block2, then the hash changes, meaning, everything in block 3 and beyond becomes invalid and breaks the chain. This forces the system to recalculate the hashes of each block.
But a blockchain network makes it intentionally difficult to find these hashes. A hash for a block is found on average every 10 minutes, this is done by a guess and check method. Computers (miners) in the network guess that hash until it finds the correct one, this is called ‘proof-of-work’ (PoW).
The process needs to take place on every miner. Imagen that the ledger exists on thousands of computers all over the world. In order to fake a transaction, you’d need to somehow get access to over 50% of the computers, and repeat the mining process for all the ledgers I control.
This would be extremely expensive, since I’d need an almost impossible number of computers.

What else is Blockchain used for:

Banking and payments

Bitcoin and other cryptocurrencies are making it easier to make payments and transfer money between people. Basically removing the middlemen (banks) thus making it cheaper.

Governments

Governments can leverage the power of blockchain to implement secure voting, public record keeping, identifications for citizens and even border control.

Healthcare

Medical records are very inaccurate and hard to transfer. If they were hosted on blockchain it would be more secure, associated to the patient instead of the clinic or hospital.

Supply Chain

Are the clothes that I am wearing original, do those diamonds come from an unethical source. If you put goods in the blockchain you can make this much more transparent.

Smart Contracts

We live in a world where most things are bond by contracts. Imagen a world that contracts can be automated. You get divorced and automatically it splits your assets.

This is just a few things blockchain can do, but there is much much more.