Blockchain: What's that about?

in blockchain •  7 years ago 

Blockchains are great, probably, tell me more...

Most people who use steemit probably have some idea of what a blockchain is, but I thought it would be good to tell the story in simple terms, explain the history and how it all works. I will keep it simple, and interesting, and factual.

Who thought of it, and why?


In 2008 the world had a bit of a banking crisis.

Banks lend money to people, who are supposed to pay it back with interest, which allows them to make a profit. But life isn't that simple. Banks can lend money to lots of people, to create a basket of debts which are being re-payed, and sell the basket to another bank. The second bank is told that the debts are mostly safe bets. But this got out of hand, because bankers lending money were not going to be the guys who were going to collect, so they loaned out lots of cash to anyone who wanted it, selling the baskets of debt to other banks which were not going to pay out.

Then, all of a sudden, somebody realised that these baskets of debt were not worth anything, because people were going to default. Banks stopped lending to each other. This led to a liquidity crisis, with some banks running out of money. Also, banks reduced their lending to customers, and started calling in loans from businesses, so businesses started to struggle, stock prices fell, we started to run out of cash.

A crashing stock market doubled up the headaches for the poor old banks. They had very little of the cash they were holding as actual cash. Almost all of it was riding on the stock exchange, because that was another way to make profits.


Don't worry, money is not a problem, we can print more!
The solution was to print more money. People knew the banks were to blame, but they looked to governments to sort it out, who printed more money and gave it away by buying bonds. This buoys up the stock market and the banks. Great, problem solved. Except ....


Satoshi Nakamoto
Somebody who called himself Satoshi Nakamoto (he kept himself, or herself, anonymous) decided that the ability of governments to print money anytime they wanted was a bad thing. When money gets printed all the people who have money find it is worth less. We were paying for the banking crisis. If you have some money there is no way to stop the government from "taking it away" by simply printing more. Its called inflation and we are all used to it. It goes on all the time, in every country, everywhere. A bit of inflation is considered "healthy" because it encourages us to spend our money rather than hoard it. But Satoshi wanted money that could not be printed by a central body, or anybody else. There are things that are like this, gold for example, but gold is hard to spend because its hard to divide and transport. It can also be hard to verify, even if you can see it and hold it, can you be sure it's gold? We needed a "trustless" money system. Very little in the world is "trustless". You are almost always trusting someone when you do things, especially involving money. It's a hard problem to solve.

So, what's the answer then?


To start with we need a Ledger...
Everyone knows what a Ledger is. A simple list of all the money going into and out of your account. Your bank will give you a starting balance, list of transactions, and ending balance. But in a trustless system you can't start with a balance, you have to go right back to the day you opened the account and start with 0, then see every transaction, to verify your balance.

No, that's not enough. To really verify your balance in a truly trustless system you need to know that every input transaction came from an account that had a sufficient balance, so you need to know who each one came from, and all of their transactions, back to the start, as well. So you need every transaction from everyone in the world, forever. No problem. Modern computers are good at that stuff, I expect.

Actually, still not enough. We need to be sure this ledger can't be changed by anyone. Computers are also very good at modifying data. If we don't trust anyone, we have to store copies of the ledger on lots of different computers. Thousands of copies held by thousands of people, with each person checking that their copy matches all the others. If there is a difference in any ledger we have to go with the majority view. As long as more than 50% of the people don't get together to attack the rest it will be ok.

That's starting to sound like a lot of data. There will be thousands of copies, with each copy containing every transaction ever, and everyone checking every transaction in every copy. Phew. Its going to be hard to do. How can we persuade all these people to create and manage these huge databases? And do it honestly.


We need to create value
This is the really clever bit. Satoshi knew a bit about cryptography. In mathematics you can have puzzles which are very hard to solve. He chose a puzzle that was hard to solve, in that the only way to do it is to guess an answer, check it, guess again, check, repeat. Eventually a guess will be quite close. By specifying how close you have to get you can change the difficulty so that it is harder, or easier. He then created the Ledger as a chain of blocks. Each block is a fixed size and contains a list of transactions which we want to freeze forever. To add a block to the chain you use maths with the list of transactions and also with the solution to the previous block, creating a solution to your new block, which you add to the chain. These solutions are hard to find but easy to check, so now nobody can change a transaction in this block since the solution would be invalidated, and also they can't change the previous block, since this solution depends on that as well. This makes the whole chain all the way back to the first block unchangeable. Unless you change them all of course, but that would be very difficult because the maths is so hard, and the chain is big.

The fact that you have to put in work to create blocks can create value, because we can create some new coins as a source of new money when each block is added. The person who finds the solution gets control of the block, and so gets a bit of money. They can spend it by creating a new transaction which someone will add to a future block, and which will move the money to someone else's address. It can work.

Another clever thing about the creation of blocks is that the difficulty of adding blocks is adjusted all the time to make sure the next block always gets found ten minutes after the last one. This is done by watching how long it has been taking to add blocks, then adjusting the difficulty for the next block based on the speed. This means that no matter how fast computers get, it will always be difficult to find that next block.

But we need to be able to put the money somewhere which is safe.


You need an address, and you need to keep it locked

We're nearly there, but we are still missing something. You need an address which you can tell people, like a bank account number, but there is no bank. So how are we going to get access to our money and at the same time lock it so that nobody else can, in a trustless system? Well, you can play a similar trick with maths to create secure addresses to store the coins. If we invent a mathematical puzzle like before, but this time we invent both sides of the puzzle, the question and the answer. We then keep the answer secret and use it as a key to unlock our address, and tell people the question so that it can be used as an address. These addresses are easy to create, and the rules of the software mean that when transactions have been created that transfer coins into the address you are allowed to move them out to another address as long as you supply the other half of the puzzle, the private key that goes with the public one.

So... where is my actual bitcoin?


My bitcoin is in my wallet, isn't it?

Well, really your bitcoin is kept on the blockchain. That's where the transactions are that show that coins were mined correctly, and transferred to your address, and not transferred out. What you have in your wallet is just that simple key. A long number that is the solution to the puzzle that is your address. With that key you can move money out of your wallet. So, you can print out your private key, and think of it as a printout of your bitcoin. It's not really a bitcoin though, it's a key that unlocks an address that has more incoming transactions than outgoing ones, if you see what I mean.

In summary


Suddenly it feels complicated again

Blockchains are weird. You think you have it, then it slips away.

Just to summarise, in case you got confused...

  • There is a chain. It is made of blocks of transactions, with each transaction transferring coins from one address to another.
  • There are addresses. Anyone can create an address whenever they want, and keep it locked by keeping a secret key.
  • In the beginning there are no coins, just a first block, but each time a block is added it is linked to the previous block by a difficult to solve mathematical puzzle.
  • There is only one chain, but there are lots of copies of it, all the same. Everyone checks it all the time, and if there are two copies which are both valid the system picks the one most people are working on.
  • Adding a block releases some coins, which are now controlled by the person who added the block. This means there is a race to solve the puzzle and add a block.
  • Creating an address is free, and easy. You invent a public key, which is the address, and a private key, which allows you to send coins from it, once someone has sent coins to it that is.
  • The blockchain contains every transaction ever sent by anyone, ever, in the whole world. And there are lots of copies of it. That's the only way to prove the coin is real when it is being sent. The person adding the block to the chain makes all the checks. If they get it wrong other people won't follow their chain, so they won't get paid.
  • If you keep a full copy of the chain you can add blocks, and earn money. You need to be first to find the next block, or you have to start again, on the following block.
  • Anyone, anytime, can look through the blockchain and see where all the money came from, and where it went.

I'm sure there are lots of questions. I also expect there will be lots of people (including me) wanting to answer them

Enjoy

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @kevsteem! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You made your First Comment

Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @kevsteem! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!