Blockchain is a word that got really hyped in the last few months. Even more since IBM, Canonical and Samsung show their interest in it, and that solutions like Rubix or Ethereum were built.
Behind this word, you may find a technology that could change society as Internet or Databases did.
What is a blockchain ?
A blockchain is a serie of blocks containing transactions. Those blocks are linked to each other as a queue, where each new block build a checksum that validates the previous ones. This ensure that older transactions contained in first blocks are genuine. A single modification on a transaction in the first block would drive to a completely different blockchain, with slightly different checksums in blocks.
Peer-to-peer block distribution ensure that every node holds the complete blockchain, providing a high resiliency and a real democratic security.
Blockchain is the main technology of crypto-currency, like Bitcoin, and the unalterable and undeniable characteristics of its transactions create a unique storage for genuine data.
Why using the blockchain ?
Blockchain is not providing any privacy or computing efficiency. It is not intended for company documents, or greedy program. Nevertheless, documents could be signed by a blockchain application, or a program could be moved to the blockchain.
This way, a signed document will have a mathematical proof of this signature, and a program will have its fulfillment published on every node of the blockchain. The blockchain turns from a transaction series to a data and program series.
Ethereum : Create a smart blockchain
The first application published for blockchain is Bitcoin. The only instructions available for this blockchain are transactions.
Ethereum is a challenging project, who has its own crypto-currency (the Ether), focusing on a programmable blockchain.
Programs can be sent to blockchain, and will run on every node of it. Be careful, we are not talking about a split code that will run on many CPU in order to be efficient ; a program will literally runs on every node of the blockchain.
Every instruction is performed inside a virtual machine called EVM (Ethereum Virtual Machine).
Of course, keeping all the resources of the blockchain for a simple program is not free ; you need to remunerate miners on the network that secure your program run. Every program commit consumes a resources called Gas. This resource is converted from Ether every time you need it. The value is continually revised to provide an almost cost regarding the real life.
The gas cost is directly linked to the CPU time, memory size and blockchain storage used by the program.
Gas have a upper limit, that a transaction cost must not overtake. This limit prevents attacks with infinite loop or very greedy usage of the blockchain. This limit depends on the hashrate of the miners.
Gas cost is estimated before any transaction is performed. A maximum limit is also fixed, in order for the sender to know the maximum cost of its transaction. A transaction that would overtake this limit will be cancelled and the Ether will be given back.
Program the blockchain
Programs inside Ethereum blockchain are called Contract. Each contract has its own EVM bytecode. This bytecode can be compiled from:
- Serpent, a language that looks like like Python
- LLL, a Lisp implementation
A contract can be seen like an account (with its own Ether balance), that is managed by an Ethereum account.
Contracts are public ; everyone can see code, balance and run functions on it.
Once deployed inside blockchain, Contract can receive transaction (Ether transfer), or messages (function calls).
The hype regarding blockchain comes from all the applications that can be used inside. There is no infrastructure cost, and a very light running cost.
Here are some examples:
- Blockchain could replace attorney regarding real estate. Each property can be a kind of token that users can exchange. As each transaction is definitive and undeniable, nobody could sell a token twice, or sell someone else token, even with the help of shady attorney (Not against anyone, just imagining an example).
- We could completely turn passports paperless. We would only have to give our first name, last name, place and date of birth, with a key. A program could turn those pieces of information into a hash, that will help custom officer to fetch fingerprints and picture to identify the person. A citizenship office signature could be added, and the custom officer could choose which office he will trust or not. A stolen passport could be easily spotted, and a fake passport from a compromised office can be blocked quickly. In the end, a voyager can identify itself without having any document, or using a simple QR-code.
- A wide organization (political, business, …) could run a ballot, allowing only its members accounts to vote trough a blockchain contract. Results would be unforgeable, and anyone could check voting method. All the votes will stay anonymous as well.
In this article, we only mention the public blockchain, but there is also a way to create our own private blockchain. This way, we will have to provide our miners to secure the blockchain, and the infrastructure cost cannot be absorbed by Ether selling (as private Ether does not interest anyone).
However, blockchain is a really good candidate for various applications in private usage, especially in financial field.
Latest posts by Cicatrice (see all)
- OpenShift: from early development to production in clouds - 29 April 2016
- Ethereum: Introduction to the blockchain - 23 March 2016
- #ShebangHero 004 – Timestamps, timestamps everywhere ! - 4 December 2015