Blockchain: wherever it’s spoken, wherever it’s discussed, many argue about the economic aspects of cryptocurrency. But what exactly is blockchain technology? During his talk at Codemotion Milan 2018, Paolo Moro explained to us in detail the nature of blockchain and its future implications.

This technology is composed by a growing list of records, called blocks, which are linked using cryptography. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data (generally represented as a merkle tree root hash). Basically, blockchain is an open and distributed register that can store transactions between two parties in a safe, verifiable and permanent way. Thanks to these features many industries and companies have radically changed their strategies to exploit this technology in the most intelligent ways. Through Blockchain it is, therefore, possible to improve the security live, thanks to data encryption, making the interchange networks more robust, facilitating the verification of the transitions and the identity of the users.

Blockchain networks use a series of computer algorithms mathematically tested to eliminate security risks derived from human errors. In general, there are two forms of software infrastructures based on Blockchain: public and private. In the first, all participants are responsible for data storage and verification of transitions. In private cases, on the other hand, tests for the verification of transactions belong to a selected group of nodes and, in order to access such networks, a user must be invited to participate by another user or be included in a group chosen since creation of its own reference network.

Most probably private networks are less “democratic” than public ones, but in any case they seem to represent the ideal solution for companies (like banks). The advantage of networks that implement Blockchain technologies is that they can be completely decentralised and distributed, Thanks to these characteristics, these networks can escape a vast plethora of attacks, such as DDoS (Denial-of-service attack).

The decentralisation of the networks is a not indifferent aspect. In fact it ensures a greater level of security both for users and for companies, who can devote themselves to other aspects of their projects without having to always adopt new countermeasures to stem the attacks that are commonly launched against traditional networks. So the Blockchain technologies can help to boost cybersecurity in many fields.

For example, Blockchain could improve the security of the election system. In fact a Blockchain voting system would use a token-based approach that automatically ensures that each person gets only one vote and, once it enters the ledger, it’s permanent and unchangeable.

Blockchain can also revolutionise the world of contracts, using smart contracts Blockchain could eliminate the need for lawyers in some contract negotiations. This self-executing digital contract can be stored, replicated and managed by a computer network. It is also possible to manage the various contractual details such as payment, products and services.

For business-to-business transactions, Blockchain technologies allow the instantaneous transfer of currency and all the various intermediaries are eliminated. Another sector deeply changed by Blockchain is tradable certificate. The governments of many countries use this type of certificate to measure the levels of energy produced from renewable sources. In the past, tradable certificate required multiple steps of administrative and bureaucratic paperwork. Blockchains have greatly simplified the detection and transmission of data on renewable energy sources and their respective energy grids. Also, they encourage individuals to adopt similar solutions with the installation of household equipment.

Obviously, Blockchain reduces costs in banking transactions, because it simplifies the process of authenticating the parties involved while keeping personal information secure.
Also, since there are few or no humans involved, the process is much faster and the process could be done in a few seconds.

So the cryptocurrencies, like Bitcoin, are just the tip of the iceberg. However Bitcoin can help us understand how services based on Blockchain networks work.
 

 
As explained by Paolo Moro, companies are well aware of these capabilities of Blockchain networks. In fact, around such technologies were born projects like Lightning Network, that can be defined as a second layer of Blockchain. The Bitcoin Blockchain is a public ledger that records Bitcoin transactions. These transactions are defined using a Forth-like scripting language and consist of one or more inputs and one or more outputs. When a user sends Bitcoins, the user designates each address and the amount of Bitcoin being sent to that address in an output. To prevent double spending, each input must refer to a previous unspent output in the Blockchain. The users of this network keep their Bitcoins inside a wallet, which stores the information necessary to transact Bitcoins.

The cryptocurrency wallet also has specific functions:

  • it allows us to distribute the public keys created;
  • it allows you to monitor your output in the blockchain;
  • it allows you to sign transactions by spending your coins;
  • it distributes signed transactions in the p2p network.

 
Bitcoin, as well as other Blockchain networks, gives a set of clear rules so that the system works and the transitions can be adjusted. The key to functioning is precisely these rules and the consent of users (50% + 1 of the network confirms the consent if if considers the information true) within the P2P network. A system of rules can obviously be changed within the Blockchain networks but to do this it’s necessary to have the consent of the majority of network. This is one of the fundamental pillars of cryptocurrencies and the whole market is based on these rules of exchange and coexistence.

The problem of Blockchain-based payment systems, especially on the Net, was that of consent, which must be guaranteed and certified not by a central authority, but by all the parties involved in the system.

The first model used to solve the consensus node, the one implemented in the Bitcoin Blockchain, is the so-called proof-of-work algorithm. It is so defined because it rewards the nodes of the network that maintain the functioning system by performing a thermodynamic work: simply, the cryptographic function hash resolution.

Each transaction within the system, which every 10 minutes is enclosed in a block (10 minutes is the specific period in the Bitcoin Blockchain, but is a variable number in other systems), must be uniquely reconstructed by each node participating in that block of transactions, and then compared with previous hashes. When a block must be closed, it must be sealed with another hash function, a link to the hash function of the header of the block that preceded it, and a string that indicates its position within the Merkle Tree.

To definitively close a block, a network node (miner) must find a nonce, that is a number that uniquely identifies that block within the chain (of blocks). In fact, proof-of-ork is only one of the many algorithms that can be used to implement a secure and reliable Blockchain.

Paolo Moro continued his talk by explaining to us in detail about Lightning Network, a decentralised network using smart contract functionality in the Blockchain to enable instant payments across a network of participants. Lightning Network is dependent upon the underlying technology of the Blockchain. By using real Bitcoin/Blockchain transactions and using its native smart-contract scripting language, it is possible to create a secure network of participants which are able to transact at high volume and high speed.

The main features of Lightning Network are:

Instant Payments. Lightning-fast Blockchain payments without worrying about block confirmation times. Security is enforced by Blockchain smart-contracts without creating a on-Blockchain transaction for individual payments. Payment speed measured in milliseconds to seconds.

Scalability. Capable of millions to billions of transactions per second across the network.

Low Cost. By transacting and settling off-Blockchain, the Lightning Network allows for exceptionally low fees, which allows for emerging use cases such as instant micropayments.

Cross Blockchains. Cross-chain atomic swaps can occur off-chain instantly with heterogeneous Blockchain consensus rules. So long as the chains can support the same cryptographic hash function, it is possible to make transactions across Blockchains without trust in third party custodians.

Basically Lightning Network is a second layer of Blockchain in which it is possible to offer dedicated services to its customers. With this networks it is possible to work on a secondary Blockchain and to work off-chain (out-of-branch main-transaction chain). For example the Exchange work this way when you buy Bitcoin with a credit card.

Performing side-chain operations allows us to offer extra services to users, obviously guaranteeing their stay in the main Blockchain. For example, sidechain operations can freeze funds up to a certain date.

In Lightning Network is also possible to make Bidirectional Payment Channels. Two participants create a ledger entry on the Blockchain which requires both participants to sign off on any spending of funds. Both parties create transactions which refund the ledger entry to their individual allocation, but do not broadcast them to the Blockchain. They can update their individual allocations for the ledger entry by creating many transactions spending from the current ledger entry output. Only the most recent version is valid, which is enforced by Blockchain-parsable smart-contract scripting. This entry can be closed out at any time by either party without any trust or custodianship by broadcasting the most recent version to the Blockchain.

By creating a network of these two-party ledger entries, it is possible to find a path across the network similar to routing packets on the internet. The nodes along the path are not trusted, as the payment is enforced using a script which enforces the atomicity (either the entire payment succeeds or fails) via decrementing time-locks.

As a result, it is possible to conduct transactions off-Blockchain without limitations. Transactions can be made off-chain with confidence of on-Blockchain enforceability. This is similar to how one makes many legal contracts with others, but one does not go to court every time a contract is made. By making the transactions and scripts parsable, the smart-contract can be enforced on-Blockchain. Only in the event of non-cooperation is the court involved, but with the Blockchain, the result is deterministic.