August 13, 2019
VirtualFinancePedia

What is the blockchain, and how does it work?

Blockchain

This question could turn out to be the most relevant one in the current century, and some of us believe it will be as crucial in years to come as the internet was a few decades ago or as Gutenberg’s printing press was centuries ago. Blockchain technology is a way in which we can apply cryptography to exchange value or information without the need for trust or central authorities.

Let’s say you and I make a bet. We will toss a coin, and we will risk a dollar each, and he who wins the toss takes away the two dollars. Traditionally we could organize our betting process based on one of three ways: trust, contracts or a third party. In the first case, we would trust each other to pay for each toss.

The problem with confidence is that not everybody is trustworthy and it would be too easy for one of the partners not to pay. We could also rely on a contract, and that wouldn’t need so much trust but if something goes wrong, validating the deal will take more time and money because legal processes are neither quick nor cheap. The third option would be to involve a third party.

You and I would give that other person our dollar before every toss, and then he would make sure the winner gets the money. But this option also has potential problems, namely, that the third party could run away with the cash. So while this third option is more complicated, it’s not that much more reliable. And it’s still based on trust and contracts.

Trust and contracts are solutions indeed, but they lack security because nobody likes to trust strangers and because contracts make things more formal, but they do not guarantee results. That is where the blockchain comes in. It would give us a way to finish our transactions quickly, cheaply, and, above all, securely.

If we chose the blockchain option to play our game, we could write a little program that runs over the blockchain, and we would both send that program our own dollars. Then the program would keep the money until it finds out the bet’s outcome in several data sources and then pays automatically off.

Both you and I would be able to check the logic in the program, but we won’t be able to stop it or change it once it’s running on the blockchain. Doing all this for two dollars per coin toss is, of course, absurdly complicated, but imagine if we were betting a thousand per toss or if we were selling a company, a house, or a car.

In this article, we will explain how the blockchain can do that trick without going into the mathematical details and technicalities too profoundly. We’ll skip them for the most part. The logic, the ideas and the mechanics in a blockchain are understandable for everybody, even if you’re not an expert programmer or a mathematician.

Bitcoin

The blockchain came into existence with the purpose of creating Bitcoin. It remains its most famous application. Bitcoin is a digital currency (also known as cryptocurrency) that you can use to pay for goods and services, just like with any traditional money. We’ll give you a look into Bitcoin to illustrate how the blockchain technology works.

In Marc Andersen words,

“Bitcoin gives us, for the first time, a way for one Internet user to transfer a unique piece of digital property to another Internet user, such that the transfer is guaranteed to be safe and secure, everyone knows that the transfer has taken place, and nobody can challenge the legitimacy of the transfer. The consequences of this breakthrough are hard to overstate.”

A bitcoin is a single unit of the Bitcoin (BTC) cryptocurrency. It’s worth nothing on its own in the same way in which US Dollars, Euros, or any other fiat currency is also worthless in itself. The paper (bank notes) or the coins have value only because a full society agrees to use them as a means to trade.

The Bitcoin ledger keeps track of all bitcoin transactions from the beginning; thus, the ledger knows the number of bitcoins owned by every user.

So who keeps the ledger itself? Where is it stored? It is one of the most crucial features in a blockchain: everybody maintains the ledger. The Bitcoin network is composed of “nodes.” They’re physically distributed all over the world, and they are storing and broadcasting the information that keeps the system going and also doing the calculations needed for things to work. Every node has a copy of the ledger file. Take a minute to realize what this means: no central authority or the user can alter the ledger because it’s stored all over the network simultaneously.

So how does a transfer happen? If we wanted to send you five bitcoins, then what we do is to send a message into the network. This message is cryptographically secured, and it essentially says our account should lose five coins at the same time that yours goes up by five. The message will reach every node in Bitcoin’s blockchain, and all nodes will update their copy of the ledger, so every node has the same balance for every user.

Because the ledger is maintained by many computers and not by a central server or authority, the system is very different from any traditional financial transfer. This has deep implications. In the traditional system, only you and your bank know your transactions. In a blockchain, everybody can find out anybody else’s transaction history.

Banks are usually reliable (if slow and expensive) when you need to do micropayments and other transfers. Bitcoin is reliable indeed, but if something fails, there’s nobody who can help you set things straight because there is no central authority.

The whole point in a blockchain system is that trust is beside the point. The system is designed to guarantee security and reliability through cryptographic technology. That allows people to come together to work or transact in a blockchain without the need to know or trust each other.

You can think of a blockchain as a system that enables a computer network to keep a ledger updated and secured. If you want to join the scheme and transact with other members, you need a particular piece of software called “wallet” which allows you to store and exchange your bitcoins. Your wallet’s identity is secured using both private and public key cryptography so that nobody else in the network can spend or sell the bitcoins you own.

When you encrypt a message using a public key, only people who know the companion private key can decrypt and read it. Also if you use a private key to encrypt your information, somebody else (even you) will need the paired public key to decrypt it. If I want to send you a bitcoin my computer will use my wallet’s private key to encrypt and broadcast a message into the network.

Only I can spend my bitcoins because nobody else knows the private key that opens my wallet. Once the word is out there, every node will cross-check that I am indeed ordering the transaction by using that public key to decrypt and read the message.

Your wallet’s private key thus works as a digital signature that the blockchain can use to verify that the operation is legitimate and authentic. Every signature is unique, and it’s used for one transaction only. That digital signature is a string of text. The system calculates it using further cryptographic technology (something called a hash) which is extremely sensitive regarding with the original message.

If a single letter changes, the signature changes dramatically. This is why no attacker can hack a bitcoin operation. Sending you a bitcoin requires for me to prove that I own my wallet’s private key, or I cannot encrypt my transfer request otherwise. The encryption key remains private at all times because the message is sent only after successful encryption.

Your Wallet’s Balance

There’s a ledger’s copy in every single Bitcoin node. How do the nodes know what your wallet’s balance is? Well, they don’t. They don’t care all that much about your balance, but they have all the information they need to compute it when it’s needed.

Moreover, if they do need to compute your balance, every node will do the calculation, based on your transfer history, and then they will all compare the result to make sure they completely agree, and thus your balance is verified. That’s called “consensus,” and it’s one of the reasons that make the network so safe.

The balance verification process is very efficient because it does not use the complete ledger but only the most relevant information for your transfer. If Alice wants to send ten bitcoins to Bob, she will create a transaction request. This new request includes links to a set of older transactions that are worth at ten bitcoins exactly. These links are known as “inputs.”

Every node in the network checks that the amount is correct, and that the income from the inputs is still available. Once an input has been referenced for a transaction, it will never be considered valid again for new ones. All this work is done automatically by Alice’s wallet. Then it’s verified and validated by the Bitcoin network nodes. In this way, only those ten coins are sent to Bob, using Bob’s wallet’s public encryption key.

It should be clear from the last paragraph that inputs are critical elements in the system. The next logical question would be: how can the system trust that the input transactions are valid? By reviewing all the past transactions done by your wallet to exchange bitcoins in your inputs’ references.

There is also a complementary ledger in every node which keeps track of unspent transactions only so that the process can be faster. This security mechanism ensures that every bitcoin cannot be spent twice.
In other words: if you look Bitcoin under the hood, owning bitcoins means that the ledger includes transactions assigned to your wallet address that has not been used as inputs so far (they haven’t been spent).

All the Bitcoin software is written and released under a programming philosophy called “open source” which means nobody owns the original code and nobody has to pay money or a license to use it. In practical terms, this enables anybody who owns a computer and an internet connection to run a Bitcoin node or do transactions, in principle.

But if there should be any mistake in the code that broadcasts that transaction requested, the bitcoins linked to that request will be lost forever. This kind of mistake is highly unlikely as the network like so many redundancies built-in. But, if you’re going in, you need to understand this risk, minimal as it is.

The core value in Bitcoin (and every blockchain technology as well) is decentralization, and every user, new or otherwise, must keep this concept in mind. It means the network will always be free of undue influence by big players, and it will remain free and independent always. It also means that there is not a customer service desk, no 1-800-Bitcoin, or anything of the sort.

If you forget your wallet password or a transaction goes wrong, there’s nobody who can help you correct the issue. So, if you want to keep your bitcoins as safe as possible, you should do two things. First, use an official open source code Bitcoin wallet (Bitcoin Core is a good one).

Second, make sure your wallet’s password and private key are stored safely in a place where you can’t lose them or have them hacked. An encrypted offline partition in your computer will do the trick nicely.

What about safety and where did that name come from?

If you have a VPN service, or if you know how to use the TOR network, then you can transact on Bitcoin in a very anonymous way. You’ll reveal nothing about yourself but your public encryption key, which is rather useless in terms of hacks unless you also have the private key.

But if you keep using the same wallet all the time, the network will be able to trace all those transactions to your wallet. No need to worry, Bitcoin allows you to have as many wallets as you want, and you can keep a low profile that way. Each wallet will have a unique set of public and private encryption keys so if anonymity is your priority, you’ll be able to keep it. That will allow you to transact from a set of different wallets in a way in which the network cannot trace all those transactions to a single wallet, or a single user, or a single person.

Bitcoin is designed to allow 2¹⁶⁰ wallet addresses. This number is just huge. Let us show it to you: 1461501637330902918203684832716283019655932542976. A number this big for addresses just makes it impossible for hackers to attack the network by randomly guessing anything. It also gives every user the opportunity to own one or several wallets.

But there is still a loophole. A very skilled hacker could recover a bitcoin even after spending it. This is possible in principle, but incredibly difficult in practice. Let’s explain it, just for the sake of completeness. Every node must have the full network’s transaction history (the ledger). But when a new transaction is made, it doesn’t reach every single node at the same time.

Because of the network’s size, it will always reach some nodes sooner than others. So an attacker could start a transaction, wait for the other party to deliver the service or good. Then it could send an inverse operation before all the nodes in the network become properly updated. This would create disagreement among the network’s nodes as some would consider the initial transaction valid and completed, but some would not.

Let’s be clear about something: this has not happened once in Bitcoin’s history so far, but the fact remains there would be no way of preventing this because a timestamp would not be an option for validation as it’s too easy to be falsified. In this event, the network is designed to detect a lack of agreement among nodes, and then use the best possible consensus to prevent any kind of fraud. While a timestamp is not an option to know the order of transactions, the network offers another option called “block.” Hence the name, “blockchain.”

The information flow in the Bitcoin network is organized into units called “blocks.” Every block includes a set of transactions and a link to the previous block. Because of that link, the blocks are ordered in a “chain” which is chronological and that’s how the network knows the timing for transactions without using timestamps. The blocks have a definite order, and no attacker can fake a full block. That is why this technology is called “blockchain.”

The network considers every transaction in a single block to have happened at the same time. Transactions that are not in a block, are considered unconfirmed. Every node has the ability to put transactions into a new block, and broadcast it to the rest of the network as a suggestion for a new block. This begs the question: how can the system agree on what’s the next block since all the nodes have the same authority?
That’s where math comes in.

Every new block in the chain has to come with an answer to a mathematical problem. It’s a very complex problem that involves solving a cryptographic hash function (SHA-256). It’s called a “collision” because there is no analytical answer, in order to find out an answer you need to do random calculations over and over again until you find a solution.

Your average computer takes about a year to come up with an answer. But the Bitcoin network is so big, that it finds a collision every 10 minutes on average. And that’s how it’s decided which node can broadcast a new block: it’s the node that’s found the collision that enables the existence of a new block. So broadcasting a new block, it’s a mathematical meritocracy of sorts.

What if two nodes solve the same problem at the same time thus having the right to broadcast two new, valid, but different blocks? First of all, this is highly unlikely because of the difficulty of calculating even a single collision. But the network knows how to deal with it anyway.

If such coincidence should happen, then both blocks would be sent into the network. Then, the other nodes will try to fit those blocks into the current block chain. The only one will work and be accepted by all nodes, and that will be the block that produces the longest final blockchain. As the new longest blockchain version spreads around the network, all the nodes will agree upon which was the valid block. In this scenario, the longest blockchain becomes the only option. Sometimes it’s all about size.

But as we stated before, this is almost impossible. It’s like two persons winning the lottery in two different countries with the same number. While it’s possible in principle, it’s really nothing to worry about. Not only because it’s so unlikely but also because the network knows how to solve this problem.

The most recent blocks in the chain are called “tails.” If there is a conflict among tails, as described above, those transactions in the shorter chain o back to be “unconfirmed transactions” and are reprocessed by the network. So in this scenario, no transaction is lost, just delayed until it can be included in a new block.

Let’s now go back to Alice and Bob and see how Alice could do a double-spending attack on Bob. Alice would initiate the transfer to Bob. Then Bob sends her the product or service. Because the longest tail will always be chosen by the network, if Alice can come up with a longer one for her transaction’s block, and if she can include in that block a reverse transaction as well with the same input references, then she will manage to get Bob’s product and she will have her coins back as well. But the system is aware of this possibility and can deal with it.

Every new block contains a reference to the previous one. This reference needs the solution of that cryptographic problem that can’t be faked. That’s how a brand new block is validated and it’s impossible to pre-compute the correct solution for the new block and place it in the new block before the network knows it.

So if Alice wants to defraud Bob successfully, she’s in a race against the whole network to solve that problem and create a consistent new block that will be picked up by all nodes. But even if she could come up with one, she would need two. And that’s highly unlikely because of the gargantuan amount of computer power needed to create every block.

What if Alice has access to an amazing computer that could actually compete with the network and solve the needed blocks faster? She would still lose the race because she would need to solve many blocks at the right time to inject them into the network, otherwise, if the timing is wrong, even being able to solve those calculations, won’t place her blocks in the chain.

Alice’s hack would succeed only if she could gain control of half of the network’s computing power, and keep in mind that this network is already spending as much electricity in such calculations as the whole country of Ireland.

A single user gaining half of the network’s control is a James Bond movie scenario, at best. And even if she could command that kind of power, her probability of solving two blocks in a row would be only of 0.25, which means she would fail three out of every four times she tried.

So the mathematical complexity involved in creating new blocks, which needs such a wide network of miners to come up with the results, in fact, protects the network’s security. No single player can get enough computing power on this planet to seriously challenge it.

The network’s structure makes transactions more secure with time as well. The actions performed in a block that was confirmed, say, an hour ago are more secure than the transactions that are included in more recent blocks, say, the last one. Because a new block is added to the chain every ten minutes, more or less, a transaction that’s in a block from an hour ago, is already permanent and irreversible.

The Mining Process

One of the most controversial questions in the Bitcoin world is, as well, one of the most important ones. We all know where gold comes from, but where do bitcoins come from? They’re not a natural resource, they have no physical existence, and this is one of the main reasons skeptics have to distrust the system. Let’s delve into that a little.

Bitcoin is bound to be a deflationary currency. Why? Because software errors and lost wallet passwords will end up taking some coins out of circulation regularly. This is unavoidable but it’s taken into account from the beginning. To balance that deflationary pressure out, those users who use their resources to solve the cryptographic collision needed to create every new block get rewarded by the system. They are rewarded with bitcoins. This process is called “mining” and it’s very similar to its physical counterpart.

These rewards are the incentive that keeps private people investing their resources to run the nodes that keep the network going. They don’t just create new blocks, they also keep transactions going, keep a copy of the ledger, and, in short, put in all the work that allows Bitcoin to exist.

As explained earlier, solving an SHA-256 collision is a huge problem. It has no analytical solution which means that you can only solve it by repeatedly guessing the answer, checking if it works, failing most times, and then trying again. Your own computer can do this, but it would take something like a year to find just one of the solutions needed to create a single blockchain. That’s why miners get together in groups called “mining pools.” This way they can share the work among all of them, find solutions much more quickly and share the rewards.

Some of the pools are really big. At least a fifth of the network’s computing power is in these big pools, and they are all competing to get the results as quickly as possible. This competition is one of the reasons the network stays safe, because, the more competition there is, the more miners there are, the more unlikely is that any single user can get ahold of the 50% computing power needed to hack the system.

The network is currently stable by solving a block every ten minutes. But this can’t stay the same for long because the network is growing bigger, and computer power is increasing all the time. So in order to keep things in check, the network increases the difficulty in the collision every few weeks. This keeps the network stable and secure.

Another feature in the mining process is that every four years, the mining reward gets cut in half. This makes it less interesting to keep mining as time goes by. But to keep things compelling, there are other rewards available.

A small reward is attached to each transaction for every node that creates the block that includes them. This means that those transactions that can produce a higher reward are processed more quickly than those with a smaller reward. As a user, this means that whenever you transact in Bitcoins you have a choice to ask for a faster transaction (which would be more expensive, due to the reward for the node that gets your block right), or a cheaper one (which will be slower).

Even in that context, Bitcoin’s fees are very cheap compared with those you can typically find in the traditional financial system. And they are not linked to the transaction amount, but with the speed.

The Blockchain: Pros and cons

So now you know. This is the blockchain, this is how it works, at least in the basics. There’s a lot more to learn of course if you’re interested in cryptography’s and computer programming’s more arcane aspects, but now you have a correct understanding of all the basics.

As you were reading this article you probably realized already why this technology is so interesting and powerful. Some of those benefits you may have noticed already are:

  • Whatever you own, is yours. There is no third party (bank, government or otherwise) that can limit your access to it, use of it, or take it away from you.
  • The transaction fees are very low. So even if Bitcoin becomes very expensive, micropayments are still a good option.
  • Coins can be transferred in minutes. And you can be sure about the transaction in an hour or so. In the traditional financial system, this is expensive and it can take days or weeks.
  • The blockchain is transparent. Anybody can check every transaction.
  • The blockchain is not just about currencies. It allows for the creation of decentralized applications in which the information and the value have the same advantages as the coins.

But, of course, nothing is perfect and the blockchain has a few challenges. Every coin has two sides. Even a virtual coin, such as Bitcoin.

  • Transactions can be completely anonymous. While this protects privacy, it also allows for illegal activities.
  • Digital assets are still not very easy to use as currency in the real world.
  • The coin’s price is very volatile, some would say it’s even erratic, and they’re not wrong.

But challenges are a natural part of technology as new as Bitcoin is. Such as it is, it has the potential to revolutionize many industries, even the world. The main thing about the blockchain philosophy is that it does away with the need for trust. You can get in the game and remain sure nobody will abuse you.

Since Bitcoin came online, many new use cases have been appearing all the time. Ethereum, for instance, found a way to create smart contracts using the blockchain as a base. Now Ripple is using it to change the world’s financial system, Tron means to use it to decentralize the web.

But remember that the blockchain is still in diapers. There’s a long way to go and many new exciting things to find along the way. Some even suspect a few fortunes will be made in the next few years. New projects are arising all the time that seeks to give the world a new way to deliver products, offer services and do things based on the blockchain technology.

Great things are afoot! And this is the website that will keep you updated!

[Image courtesy of Pixabay.com]

Disclaimer: All information provided through this article should not be regarded as investment advice, nor should be taken for granted for crypto trading purposes. Before making any investment or trading plans, make sure to inquire about the information diligently by carrying out your very own research. Thank you.

Related posts

Bitcoin (BTC)

Gannicus Oliver

Decentralized Applications Do Not Exist. Not Yet

Jorge Felix

Luxembourg adopts progressive posture on blockchain

Jorge Felix

The crypto community reacts to China’s changes in Bitcoin mining policy

Jorge Felix

Tuesday’s surge’s influence in the cryptocurrency market

Jorge Felix

Justin Sun on the blockchain’s technology core value: Trust

Jorge Felix

Leave a Comment

This website uses cookies to improve your experience. By continuing to use the site, you agree to the use of cookies. Okay, thanks Find out more