+5 votes
56 views
in Tips & Tricks by (242k points)
reopened
What is a blockchain?

1 Answer

+3 votes
by (1.6m points)
 
Best answer

Blockchains are distributed databases
Secure through cryptography
Establish consensus in the network
More than just money: smart contracts

You probably know Bitcoins - and if you want to know how the blockchain technology behind it works, read on..

image image

Blockchains are perhaps the biggest tech trend at the moment. And you are probably familiar with at least one application: the cryptocurrency Bitcoin. But what else can blockchains do? And above all: how do they even work? Here you will find a clear overview:

Blockchains are distributed databases

Basically, blockchains are nothing more than databases - storage for huge amounts of data. The main difference to a Microsoft Access database, for example: The Access database is available locally as a single file, the blockchain database is distributed over a network. This is a completely normal peer-to-peer network, as we know it from the previously popular file sharing via eMule & Co. However, with the difference that, as a rule, all data are with all users. As soon as you install the Bitcoin client, for example, the Bitcoin blockchain is synchronized with over 70 gigabytes on your computer. And so the first advantage is clear: the database cannot simply be deleted!

And another difference: Databases like Access store any type of data. Blockchains can do that too, but are primarily designed for transactions. Blockchains are often referred to as a ledger. The term comes from accounting and describes the central register with all cash flows of a company. And so the blockchain also primarily manages transactions. In the case of cryptocurrencies, a data record usually simply consists of the sender, recipient and amount; there is also metadata such as the time. It could just as well be saved where, for example, fishery products are currently located: the sender is the sea, the receiver is the cutter and the amount of the catch. In the next step, the cutter would be the sender and, for example, the factory in the port would be the recipient of the catch.It could go further with the factory as the sender, a truck as the recipient and filleted fish as the amount. So you could always see where a catch is or was. All these fish transactions can now be combined in a so-called block and attached to the existing chain of blocks - nothing else is a blockchain.

image
Track transport routes via blockchain, here in a demo on IBM's Hyperledger platform.

In practice, for example, in the supermarket you could see exactly where the fish in a canned product comes from - and with a look at the blockchain you could prove that this is actually true. Because blockchains are not that easy to manipulate..

Secure through cryptography

The really great thing about blockchains is this security against manipulation. And this happens in two ways: On the one hand, the participants in the network have to agree that every newly added block is a correctly structured data record - they have to establish consensus. So it is not possible to simply attach a manipulated block with fabricated transactions. On the other hand, the blocks, the name already suggests, are linked to one another so that the blocks cannot be changed afterwards.

Let's start with the simpler concatenation. A block consists of the actual user data and cryptographic data that are supposed to ensure the integrity. To put it simply, you can think of it this way: A new block contains a value that was derived from the data of the previous one. This value, also called hash, is calculated using cryptographic means and is therefore practically unique. And this hash is also used when calculating the next hash for the next block. If you were to change a block somewhere in the chain, its hash would also have to change in the following block - and its in its successor and so on..

image
A typical block at Blockchain.info: sender, recipient, value - plus a few metadata.

Establish consensus in the network

More complicated is the question of how a new block is appended to the chain. This is about the so-called consensus algorithm. The keyword you may know from the Bitcoin world is mining. When working with blockchain data such as Bitcoins, as already mentioned, transactions occur that are summarized in blocks and attached to the chain. And if you attach the block, you will be rewarded with Bitcoins in this case. Who that is cannot be predicted - and thus manipulated blocks cannot easily be added to the end of the chain.

In a very simplified way, this mining takes place in two steps. On the one hand, it is checked, but the block compiled by a miner is formally correct. On the other hand, there is a competition among the miners to determine who can contribute the block. In this case, the one who is the first to solve a cryptographic puzzle is allowed: If you use any cryptographic method such as SHA256, a specific hash is created for the block. Now the task can be to calculate a hash for the block that is smaller than a certain value, i.e. starts with four zeros. In order to get a different hash, something has to be changed in the block data. The transaction data and the hash of the previous block are of course taboo - so add a short string of characters to the block.The only purpose of this so-called nonce is to change the hash value of a block so that it starts with four zeros.

image
Nonce and hashes with leading zeros - a complex procedure cast in a few digits.

This consensus algorithm is called Proof of Work , because the solved puzzle proves that effort has been made / work has been done. Solving the riddle requires computing power, which in turn consumes electricity - a lot! Entire countries could be supplied with the annual consumption of the Bitcoin blockchain. In the early days of Bitcoin, this mining was also worthwhile for private users on normal hardware, today there is special hardware and associations of miners (mining pools) - so it has been professionalized. This goes hand in hand with the fact that the big miners naturally have an influence: instead of hundreds of thousands of private miners, a handful of professionals now determine the Bitcoin universe.

Proof of Work will not survive much longer in this form, the power consumption is simply not acceptable and in the long term it is better if private users can also participate meaningfully and on an equal footing. There are all possible alternatives to Proof of Work, but the only important thing is a basic understanding of consensus algorithms: Blockchain participants use a (practically) non-manipulable process to produce new blocks and take part in a kind of lottery that allows the winner to win his Add a block as a new component of the blockchain. He is rewarded for his effort.

More than just money: smart contracts

However, cryptocurrencies are not the only use for blockchains. For example, the fishing example above is an actual application . Banks and international consulting firms are planning to use the technology for internal transfers of digital goods, Toyota is using the tamper-proof data in the context of autonomous driving, and the benefits are also being discussed in the medical field.

The next stage is then smart contracts, such as those running on the Ethereum blockchain. These clever contracts can, in very abstract terms, automate transactions according to certain conditions. A simple example: You bet a friend for five euros that heise will publish the word "X-Mas" on its homepage on December 24th, 2017. This simple contract could be implemented as a smart contract so that an app automatically checks on the 24th whether the word can be found on heise and, depending on the outcome, transfers five euros (in bitcoins) from you to your friend or vice versa. By the way: Instead of an app, it should actually be called Dapp. The D for distributed means that the app does not run on a single server, but in the P2P network. So you don't need a trusteewho manages the money (and charges fees for it). And once set up, no one could unilaterally withdraw from the contract.

image
There is a kind of Dapp store for the Ethereum blockchain at StateOfTheDapps.com.

With such a simple bet, that's not really interesting - but insurance and stock market transactions are ultimately nothing more than bets. And since blockchains cannot be manipulated (well, should be), such larger bets and other transactions can also be automated and thus made cheaper and, in certain respects, safer. Of course, such blockchains do not necessarily have to be public, they can also be set up in-house.

If you want to look out for specific tools, here are a few recommendations: On the one hand, there are the large blockchains that anyone can use for any data, applications and smart contracts, especially Hyperledger (IBM, Linux Foundation) and Ethereum - both with the potential to turn the IT world upside down. On the other hand, there are of course also the classic small programs for the desktop, with which you can also set up a blockchain in private - assuming a lot of patience and fiddling: Openchain ( www.openchain.org ) and MultiChain ( www.multichain.com ) are both free and allow the use of a private blockchain with relatively little effort. If they work - blockchain is still a very young technology.


...