If you are following financial technology news you surely have come across the Bitcoin and Blockchain terms. While the future of Bitcoin is considered to be uncertain, everybody is convinced that the Blockchain is the future, next big internet revolution.

Blockchain what?!?

When we talk about the Internet, we’re talking about the “Internet of Information”. Anyone in the world can send information to anyone else, without censorship. A real open communication protocol that can be innovated upon with little investment. These innovations have disrupted a whole host of industries. The music, books and media, and taxi, hotel and travel industries will never be the same. There is still lots of change to come, but an even larger revolution is right around the corner.

This revolution is the emergence of the “Internet of Value”. Like the "Internet of Information", it offers anyone in the world a way to transfer value. Again completely secure, peer to peer, not censored in any way. Innovation is again possible at a low cost allowing anyone to do so. Value in this case is broadly defined. Cryptocurrencies like Bitcoin and even physical currencies. Other financial instruments like stocks, funds, bonds, both publicly listed and privately held. But votes in an election, real estate titles, insurance policies and so on are also value.

This system is build on the Blockchain technology. An open value exchange protocol that provides a distributed and secure ledger of transactions. A complete and transparant transaction history of every trade that cannot be corrupted. It moves away from the central data hub principle and allows all participants to trade in a peer-to-peer fashion. While at the same time making it faster and more secure, even outside of a companies protected network boundaries.

Exchanging value this way will disrupt all industries that provide trusted third party services. Banks, insurance companies, stock exchanges, notaries are all on the verge of becoming obsolete. And since innovation is cheap, it's only a matter of time before the next Uber or AirBNB takes over.

So how can companies in these industries stay relevant? By providing safe marketplaces for these exchanges and the real world backing of these digital value tokens. While the Blockchain provides the technology, it will be a user friendly platform or killer app that will win the day.

This is exactly where Kunstmaan can help your organisation. We are experts at building these next generation platforms and have a deep understanding of the Blockchain. Don’t hesitate and contact us to talk about your business.

So, how does it work?

Well, Blockchain is a technology that allows for the secure management of a public ledger of transactions. These transactions are verified and stored on a distributed network. These transactions are exchanges of digital value tokens, either having value themselves, or representing value in the real world.

Blockchain is a digital ledger

This ledger, often referred to as "the blockchain", is stored in a network where each node has their own copy of this ledger. A node is simply a computer or server that is connected to the network. A new node will download a full copy if the ledger when it connectes for the first time.

The ledger is a log of all transaction that were ever validated by the network. When an item of value is is traded, a new transaction message is sent to the network. These messages are distributed over the network and handled by the nodes.

Securing the Blockchain using mining

A mining datacenter - Photo by Marko Ahtisaari

Using a process called mining, each node will calculate the correct order of the pending transactions. The miner will store these transactions in that order in a "block" and calculate a cryptographic hash of the block. This hash is what secures the block against manipulation. 

In public blockchains these calculations are made harder than they need to be for the cryptographic verification. By making them a lot harder, a lot of computing power and electricity is needed to make these verifications. In return for this effort, public blockchains compensate the miners with e.g. Bitcoin.

This block also has an important header section. Each block header contains at least:

  • the time when the block was created.
  • a reference to a parent block. This is the hash of the previous found block, which links two blocks together. This is what makes it a "chain of blocks", a blockchain.
  • the so called Merkle root. A reduced representation of the set of transactions confirmed with this block. 
  • a hash of the block including the headers, which is the proof that the header has not been manipulated. This hash is also what the next block in the chain uses as a parent reference.

As soon as a new block is found, it is sent back to the network.

Blockchain prevents manipulation of it's ledger

Because of the distributed nature of the network, many miners will compete to find the next block. Often there are more then one, different yet valid blocks discovered and the chain is "forked".

Blockchain handles these discrepancies by comparing the different chains and selecting the "longest" one. The longest one having the most "security" of being the correct one. The node will then discard the conflicting block in the shorter chain. These blocks are called extinct or orphaned blocks.

Blockchains can be public or private

A public blockchain is a blockchain that anyone in the world can read, send transactions to and can participate in the mining. The combination of economic incentives and cryptographic verification limits the degree anyone can have an influence in the consensus process is proportional to the quantity of economic resources that they can bring to bear. These blockchains are generally considered to be “fully decentralized”.

A private blockchain is a blockchain where the mining process is controlled by a pre-selected set of nodes. One company or a consortium. There is no need for economic incentives to facilitate the mining process and as such is not subject to fluctuations in the value of the underlying cryptocurrency. These blockchains are considered to be “not decentralized”.

Where do I get a Blockchain?

The blockchain technology as such is more a guideline on how to build one than a specific software package. Since Blockchain has been invented as the basic technology that powers the Bitcoin cryptocurrency, this software is considered "the blockchain". There are however quite a few projects that either build upon this software, or provide a fork or even a complete rewrite to provide extra functionality.

Running a full Bitcoin node

If you want to run a full Bitcoin node, the easiest way is to install a clean Ubuntu 14.04 on the machine you want to use as a node. Afterwards install the Bitcoin desktop and deamon software.

# Add the Bitcoin package repository
sudo apt-add-repository ppa:bitcoin/bitcoin
# Update the apt cache
sudo apt-get update
# Install the Bitcoin desktop client
sudo apt-get install bitcoin-qt

Start the Bitcoin application from the "Dash" menu and accept the default location. At this time the application will start to sync the Blockchain (50GB) and your node is operational. You can also run a daemon instead of the desktop application, which is more suited to server environments.

Congratulations, you are now part of the Bitcoin Blockchain network!

Or do you prefer to try out Ethereum?

As Ethereum describes itself, it's a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third party interference. Ethereum is how the Internet was supposed to work.

Ethereum is a next generation Blockchain that focusses on so called smart contracts. Smart contracts are computer programs that can automatically execute the terms of a contract. Someday, these programs may replace lawyers and banks for handling common financial transactions. These programs live on the Blockchain nodes and are really distributed applications that have no single point of failure. This article will give you a good overview of smart contracts and their uses. 

Installing Ethereum begins again with a clean Ubuntu 14.04 on the machine you want to use as a node. Then run the following commands:

# Install Ethereum
bash <(curl https://install-geth.ethereum.org -L)

To start our own private test net, we need a genesis.json file. This file describes our Blockchain with some settings in regards to mining. Copy paste the content of the block below and put it into a file named genesis.json.

    "nonce": "0x0000000000000042",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "difficulty": "0x4000",
    "alloc": {},
    "coinbase": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "Custem Ethereum Genesis Block",
    "gasLimit": "0xffffffff"

Next we will start our blockchain and the console to interact with it. At the same time we log a lot of stuff to a file named geth.log. you can tail -f this file for some nice feedback on what the chain is doing.

# Start up the console and run your own private testnet
geth --genesis genesis.json --networkid 9876 -nodiscover -maxpeers 0 --datadir testnet9876 console 2>>geth.log

Using the console, we can then interact with the chain. The commands below will show you how to create an account, check the ether balance of that account and finally start the mining process on your testnet.

# Create a new account, this will return something like: "0xaba742b5ee75f1da4ccc7b6dc51c77b049b09e25"
personal.newAccount("my secret password")
# Check your ether balance
# Starting the miner to earn some ether

It will then start by creating a DAG file, afterwards the mining begins. More info on this mining process can be found in the Ethereum Wiki. After a few mined blocks, you can see your ether balance rising.

You are now ready to create your first smart contract on your testnet. The Ethereum site has some sample code to get you started.

Written by

Roderik van der Veer

Technology Director at Kunstmaan, passionate about innovation and the technology to do so.

Follow @r0derik