June 4, 2021

The era of smart contracts


The era of smart contracts

Following on from our articles describing the technologies used by XSL Labs, such as IPFS and ZKP (which you can find on our blog), today we’re going to focus on smart contracts, in order to understand their history, their issues, and how they fit into our project.

If you are interested in blockchain, you may have already read or heard this expression.

Smart contracts are computer programs, which contain the terms of an agreement and are able to execute them.

Their creator, Nick Szabo, has been interested in the evolution of practices of contract law since the 1990s. He defined smart contracts as a computerized transaction protocols, generally accompanied by graphical interfaces, that allow transactions to be formalized and secured on computer networks.

He believed that the rise of digital technology made it possible to consider new ways of formalizing relationships between individuals. The idea here is to write “if, then” lines of code (condition, consequence) in order to create self-enforcing agreements. He sees this as a way to secure contracts, preventing contract breaches.

In his article “Formalizing and Securing Relationships on Public Networks”(1), Nick Szabo sees in the vending machine an ancestor to the idea of smart contracts. The vending machine is the contract, and by using it, any person can make a transaction with the seller.
In practice, the buyer inserts his coins, chooses a product, and the vending machine will automatically give the product to the buyer (the vending machine executes a code, the seller does not need to act or be present for the sales contract to be concluded).

According to the author, smart contracts can go further: they can apply to all sorts of property that are controlled by digital means. In the case of digital automobile security systems, a sales contract in the form of a smart contract would give the buyer the “cryptographic keys” to use the vehicle. Just as with the vending machine, the buyer and seller do not need to trust each other, and it becomes impossible to steal a vehicle.

Smart contracts are intimately related to the blockchain. Indeed, one of the characteristics of blockchains is that the information entered is immutable: once stored on the blockchain, the data is permanent. It cannot be modified or erased. This allows to deploy smart contracts with the certainty that they can’t be broken.

In practice, many companies have already taken an interest in the potential of smart contracts. For example, back in 2017, the AXA insurance group launched Fizzy, a flight delay insurance (2). The idea was that in case of a flight delay, the policyholder was automatically compensated. A smart contract was deployed on the Ethereum blockchain. An oracle provided the flight data, allowing the smart contract to proceed with compensation if applicable.

This avoided the hassle of seeking compensation as soon as a delay was detected, compensation was automatic.
Unfortunately, the Fizzy experiment ended in 2019, as it did not reach its commercial target. However, it was able to demonstrate the benefits of smart contracts in the insurance field.

As previously mentioned, smart contracts, due to their nature as programs and their link to blockchains, have multiple advantages over traditional contracts.
Firstly, their execution is automatic: when the conditions that have been written in the smart contract are met, then the program will automatically proceed. It is therefore impossible to cheat and decide not to fulfill one’s obligations. For example, the risk of non-payment no longer exists.
Secondly, transactions made through a smart contract are secure. A contract can be concluded with a complete stranger without having to trust him. The computer code alone enforces the terms of the contract, hence the saying “in code we trust”, and this code is registered on the blockchain, so it is public and unchangeable.
Finally, the smart contract can potentially eliminate costly intermediaries. We can imagine that tomorrow, vacation rentals on the Internet will be managed by smart contracts. In a future where access to a home is managed by an access code and no longer by physical keys, management via smart contract becomes possible without intermediaries, thus eliminating its cost.

However, smart contracts also have some weaknesses that need to be addressed.

First, they are self-executing algorithms, their content consists of lines of code, and like any code, they may contain bugs, which are not fixable once the contract is deployed on the blockchain. In 2016, an exploit on a Decentralized Autonomous Organization smart contract had dramatic consequences for the Ethereum blockchain (3).

The security of smart contracts is therefore an absolute priority, hence the recourse to audits and even bug-bounties: rewarding people who detect vulnerabilities in the programs.
Then, even if the contract itself is recorded on the blockchain, and is public and immutable, it may require the use of an oracle, as was the case with Fizzy program that we mentioned, and this oracle must therefore be trusted. Thus, there are always intermediaries when the conditions of the contract require querying databases outside the network. However, projects such as Chainlink aim to solve this problem by creating decentralized oracles.
Finally, because blockchains operate via their own assets, and because these assets can fluctuate significantly, an amount recorded on the smart contract can see its value greatly altered once converted to fiat currency, so there is some uncertainty here. However, new technologies are making it possible to use stablecoins, which allows to mitigate this risk.

The term “smart contract” refers to the very idea of contracts. In fact, a smart contract can very well formalize the terms of a contract, but it cannot replace it. As a matter of fact, the law governs this matter very precisely. Without getting into details, for example, a contract is only valid when the parties’ consent to it in a free and informed way. However, unless you are a computer specialist, understanding the content of an intelligent contract is complex, so it is difficult to give a legally valid consent to the execution of a computer code that you do not understand.
Therefore, the smart contract can only be the support of a contract in the classical sense of the term. It makes the execution of the contract easier, but cannot replace it, as alone it has no legal value.

It is easy to imagine practical uses for smart contracts, even if everything remains to be done to integrate them into tomorrow’s digital world.
Using the hypothesis of simple smart contracts, we can for example imagine that crowdfunding projects use these programs: people fund a project, and if the funding goal is reached, then the funds collected are released to the project creator. If the objective is not reached, the funds are returned to the investors.
In the same way, we can imagine sports betting being managed by smart contracts, and no longer by the classic betting websites. In such a case, an oracle would be consulted in order to verify the results of the event in question and thus redistribute the betting money among the winners.
It is important to understand that smart contracts still have a lot to prove and will gain in popularity over time. The previous examples show that it is possible to get rid of the various platforms and thus eliminate the costs associated with them (typically the remuneration of these intermediaries who are a for profit business).

Now that we have studied the ins and outs of smart contracts, we can consider other uses for them.
While Nick Szabo’s goal was to prepare for the securing of contractual relationships, his approach and the practice of smart contracts would tend to limit their potential. In fact, they are no more than computer programs, and as such, their potential goes beyond financial exchanges; their possibilities are in fact virtually infinite.

At XSL Labs, a smart contract is used to create the SDI.

The DID subject (the owner of the SDI) creates its own pair of keys, keeps the private key and then transfers the public key to the smart contract. It is thanks to this contract that exchanges with third parties become possible, since it makes available these public keys, references and information that the user chooses to share on a case-by-case basis. This smart contract, in addition to the creation of SDI and its updates, acts as a directory allowing the DID subject to manage its attributes. The smart contract gathers information outside of sensitive data, allowing the user to assemble their DID document (DDO).

Finally, the smart contract will also allow for the delegation of the DID if necessary (for example, allowing the implementation of parental control).

As you can see, this decentralized program is a real engine of the ecosystem, with multiple functions.

You can find this smart contract on our GitHub (https://github.com/XSL-Labs)

Smart contracts are likely to become increasingly important in the years and decades to come. If they were envisaged as early as the 1990s, and Bitcoin brought the first transactions, it is under the Ethereum blockchain, thought for smart contracts, that the first concrete applications emerged.  With each generation of blockchain, the possibilities open up further, so it is likely that more and more companies will decide to use them in order to gain in reliability, speed and security when it comes to running programs on the blockchain.

(1) for more information: https://journals.uic.edu/ojs/index.php/fm/article/view/548/469

(2) https://www.axa.com/fr/magazine/axa-se-lance-sur-la-blockchain-avec-fizzy

(3) https://medium.com/swlh/the-story-of-the-dao-its-history-and-consequences-71e6a8a551ee

Copyright © 2020 XSL Labs – All rights reserved