Translated by: Bárbara Román Méndez
Smart Contracts: theory, practice and legals aspects
Smart contracts are probably one of the most trendy terms on the new technological initiatives developed by sectors as diverse as Legaltech, which we already covered thoroughly, Fintech (projects related to the new financial industry) or Insurtech (projects related to the new Insurance sector).
The thing is, why the concept of smart contract can join together sectors so different? My idea is that the smart contract is seen as a legal tool that if it ends up being commonly used, it could seriously alter the way we trade daily. In other words, taking into account that the smart contract is software, many of the advantages associated with it (for example, promptness, predictability and automation), could end up reaching these areas on a large scale.
However, if smart contracts are the legal instrument that joins such diverse industries, there is a technological element that allows today’s smart contracts and connects even more sectors. We are talking about blockchain. What’s that? Well, the technology under which currencies such as bitcoin or ether work nowadays. In fact, some people are starting to consider blockchain as one of the most revolutionary achievements coming from the Internet.
In summary, out of this somewhat cryptic introduction we should focus on to two terms. This long post will be all about them from a theoretical, practical and legal perspective. This way, we’ll talk about plenty of theory related to smart contracts, how to make one (even mortals such us :p) and some legal aspects worth mentioning. The trip won’t be short, and although I’ve tried to simplify the content as much as possible (getting rid of important concepts in order to get a better understanding of the basics), it won’t be easy. Having said that, let’s go!
As we said, all this story revolves around two terms that we should try to memorise. We are talking about Smart Contract and Blokchain.
1.- Back to the origin, what is a smart contract?
A smart contract is the use of computer code in order to articulate, verify and execute an agreement between parties. While a regular contract uses natural language, the terms of a smart contract use computer code, like the one from a script. That’s why we say that a smart contract is software.
Once the smart contract is written, a computer executes it according to the terms and inputs established in the contract. This way the smart contract auto-fulfills its own terms or conditions. For this reason, a smart contract will usually use instructions and conditions typical of computer code. And these instructions will follow the usual pattern of: “If this happens, do that. But if it does not happen, then do this instead”.
Then, once the execution of the contract begins, both parties lose the control over its compliance (we’ll come back to this when talking about the legal aspects).
Therefore, a smart contract is a computer program with conditional instructions that one (or more) computers verify and execute in order to assure its liability.
It sounds new and futuristic, doesn’t it? However, as in so many other instances, the smart contract is not a new concept.
The term itself was coined by the Hungarian jurist and cryptographer Nick Szabo during the 90’s. Even though he had already talked about them earlier (in 1996 on Smart Contracts: Building Blocks for Digital Markets and shortly after that in Formalizing and Securing Relationships on Public Networks), a brief paper written in 1997 and called The Idea of Smart Contracts is considered as the stepping stone on the concept of smart contracts.
On this paper, Szabo starts talking about how when we formalise our relationships through contracts, we establish the appropriate setting for an ideal level of security.
According to Szabo, the vending machine is probably the original smart contract: a device designed to transmit the property of a good (the can) in exchange for the appropriate input (the coins). Taking into account that the machine controls the goods, because they are sealed inside, the device is capable to enforce the terms of the contract.
Nevertheless, Szabo states that his idea of smart contract goes beyond the vending machine. According to him, it would be possible to embed the contract into any valuable object that is digitally controlled. He even calls it “Smart property” on his glossary. In any case, the starting point is always a mature security system that is required to protect the good or the service. Then, the continuous refinement of the safety system will bring it closer to the typical logic of the contracts (he gives a very good example about vehicles). Finally, during this refinement process based on the cryptographic security of the good is where the smart contract will be born.
«Nick Szabo: Block Size Increase a ‘Huge Security Risk’ «, by The Cointelegraph
1.1.- Therefore, what could you do with a smart contract?
Now we know that nowadays a smart contract is a contract that self-executes according to what both parties agreed on within the code; that its terms are written in a language that can be interpreted and executed by a computer; and also that such computer becomes the administrator and executor of that contract.
According to that definition, what could we do? There are no limits to it, to be honest. Theoretically, it could be programmed in order to:
1) Start up an option to purchase shares at a fixed price during a specific period of time just by just sending a message.
2) Verify and pay sports betting once checked the result in internet.
3) Check the beginning and end of a waiver period when shopping online, following the tracking of an order.
4) Verify the votes on a survey to find out if Game of Thrones is better than Star Wars? :p
And so on.
As we can observe, a distinctive feature of smart contracts is that the need for reliable human intermediaries is completely gone. Not because the mediation is unnecessary but because its role is taken by the computer that verifies and executes the code.
All this sounds really attractive. However, if the concept is almost 20 years old and its potential is so big, how is that no one has talked about smart contracts until recently?
The truth is that until recent achievements, smart contracts have mostly been great in theory. Even though we do have some examples of smart contracts, the DRM systems or Digital Rights Management necessary to manage licenses on digital content are among the most visible systems and as we mentioned earlier putting those into practice was almost impossible.
Smart contracts have been subject to 3 important limitations since their origin.
A) To begin with, how could the smart contract control the real assets in order to make someone fulfill the agreement? The soda vending machine has a physical control over the good since it is locked inside the machine itself. But how could the computer code do the same to control assets such as money or shares?
B) The money in its digital format, the same as the money reserves banks have, is subject to a very strict regulation, just like its use by people in general. Then how to make contracts that include economic transactions? Which by the way, are the most common used ones by far.
C) Last, which computer would receive a vote of confidence so as to execute the terms of the agreement? It should be a computer in which both parties could place their trust in. That is to say, the parties should not only agree on the term code, but also on the computer that will interpret and execute it. Besides, the computer should be verifiable by the parties in order to avoid fraud, manipulation or unauthorized access.
It is due to these limitations that very little has been done with smart contracts during the last few years. But, then?
1.2.- Then Bitcoin arrived llegó Bitcoin (and Blockchain with it)
The issue about smart contracts had a big turnaround with the arrival of Bitcoin on January 3, 2009 (even though its real significance will be fully valued years after).
To somewhat simplify, Bitcoin is a payment system and digital money or assets (I know there is some argument whether it is currency or not, but to make things easier will called like this, invented by the mysterious Satoshi Nakamoto (for those who love conspiracies, there are theories stating that Nick Szabo is actually Nakamoto).
The user of Bitcoin has a personal wallet, which allows him/her to send and receive bitcoins. All this makes most users believe that Bitcoin is the same as “Internet Money”.
Nevertheless, what is really interesting for smart contracts, and probably the true revolution, is the technology that makes Bitcoin possible.
In this sense, Bitcoin as a decentralized payment system allows transactions that take place among users without a need for intermediaries. Those transactions are verified by the network itself where Bitcoin moves and are registered in a database called blockchain.
Here is our second big concept.
1.3.- What is blockchain?
Blockchain, or the chain of blocks in its Spanish version, is an authorized and distributed database which allows appending all kind of data that can´t be reviewed or altered later on.
In its most poetic analogy, blockchain is a book with essentially endless pages and in which almost anything can be written (from a song to a computer program). However, whatever is written can´t be modified, although it can be looked up at any time. In fact, it is accessible to everyone. And indeed, the fact that there are millions of eyes observing what has been written in the book, almost makes it materially impossible for anybody to manipulate whatever is written.
Getting a bit more technical now.
What is particular to this database called blockchain is the way it is kept and updated, as this grants it a high level of trust. Since blockchain is not controlled by one single person, entity or organization, there is no one that has final control over it and its content.
So, the logical thing to ask is: Who maintains, updates and ensures blockchain then? All computers that are part of the chain (which can be up to hundreds or millions)
That way, each computer that is part of the blockchain always keeps a copy of all the annotations made. Each copy is maintained synchronized with the other copies. In case of discrepancy between the existing copies, the most common version is given the highest score by mathematical consensus . Then, that copy will be the one shared within the computer network and where additional annotations will be entered.
Or in other words, in order to successfully alter a blockchain 51% of it should be attacked and modified simultaneously (so that the mathematical consensus gives priority to the most common database, which in this case would be the altered one). However, this is something materially impossible for blockchains on which cryptocurrencies such as bitcoin or ether run, given their size.
On the other hand, as blockchain is constituted as an append-only database (t. i., it allows only to write and retrieve old data, but not to delete or alter any of them), whatever has been written there can never be deleted. In addition, since each annotation in the chain is secured by a cryptographic process, the chain itself is able to thus detect and reject any attempt to distribute an altered copy of the registered transactions.
Therefore, the constantly synchronized, distributed and authorized character of blockchain guarantees that there is only one record of the annotated transactions. That for example prevents a person from spending the same bitcoin in various transactions at the same time, and thus solving the so-called double-spending problem in systems with digital currencies.
As if that were not enough, those blockchains on which currencies like bitcoin or ether run are public, all transactions that have been made are visible (with nuances) to anybody. Also, we have to add that this is an open-source technology, which makes it easier to know what the software is doing or not at all times. That is, transparency at its best.
All this is what makes blockchain such an interesting technology, as it provides a system to create databases whose annotations will be highly reliable, as their manipulation is so unlikely to happen. These annotations can go from basic text to computer code (a code that the blockchain itself can execute).
As a closing point of this chapter, a very interesting and recently held TED talk on blockchain and its great potential:
1.4.- But how does blockchain affect smart contracts?
The patient reader who has reached this point, almost half of the post!, will surely say: «That’s all good and well and I have my brain half fried, but how is this all going to work with the smart contracts?» That is a good question.
By now, we already know that blockchain is a technology. That means there is not just one single chain of blocks. In fact, there can be endless chains. (if anybody wants to create his/her own one, s/he can fall back on services such as Chain or Slock.it)
By using the blockchain technology we can create payment systems (and their equivalent currencies), such as Bitcoin, Ethereum or Ripple, probably the three most popular ones. But it is not essential.
In fact, not even the public, auditable and 100% distributed characteristics of blockchain are necessary. That is, the financial sector is working on private and semi-controlled blockchains (which raises the question of whether these projects really use the chain of blocks). In addition, side-chains are also used (in Bitcoin), which are like lateral chains to the main one that allow innovation without having to start all over again and that can be nourished from the main chain (probably they are useful for smart contracts).
Having said that, out of the 3 most popular blockchains, Ethereum is probably the one that fits best for smart contracts. That is, although the blockchain on which Bitcoins sustains allows to make smart contracts, the process there is more complex.
It was that complexity of the Bitcoin chain that made that the Russian developer and cryptographer Vitalik Buterin suggested the creation of a blockchain other than Bitcoin in 2013. One that would have very much in mind the development of applications such as for instance the smart contracts. This is how Ethereum and the current enthusiasm for smart contracts originated.
But getting back to the nexus between smart contracts and blockchain, we have commented that the concept of the smart contract has existed for almost two decades now and yet has been barely used due to three major limitations: 1) the difficulty of the computer code to influence real assets; 2) the strict regulation concerning the movement of assets such as money and 3) the difficulty to find a trustworthy computer when executing the smart contract.
Well, blockchain as a technology solves completely or for the most part these three limitations. Ethereum, also referred to by some people as the blockkchain 2.0, makes this even a bit easier. But how does blockchain get around these limitations?
As far as the first limitation is concerned, blockchain allows the existence of fully digital assets, such as money, stocks, bonds, records and other that can be controlled by the smart contract computer code. The blockchain doesn´t have control over the asset itself, but over the cryptographic key that can be associated to it. And since that key cannot be altered, we know that bitcoin is that one and not another one. In addition, the huge digitalization of the economy and society, together with the arrival of the Internet of Things (which allows internet connection to the table where we eat), eliminates the problem even those related to physical objects.
As for the second limitation, obviously the strict regulation on the use of money still exists. But blockchain has generated the creation of new payment systems and currencies that in practice are operating regardless of any current regulation. Therefore, by creating an alternative road, the influence of this regulation has been considerably reduced.
Finally, the third limitation is also completely solved thanks to the blockchain. The computer on which to execute the smart contract code is the blockchain itself. That means, not just any specific computer that can be hacked, but hundreds of thousands of synchronized computers that guarantee that the contract cannot be modified and that it will be executed as instructed. The mathematical consensus becomes mathematical confidence with no need for third-party human intermediaries nor unreliable computers.
The (computer) code becomes more legal than ever.
Just as a curiosity, are there any projects already using blockchain in a legal environment? To only mention a few: 1) Blockai and its records of intellectual property for photographers and cartoonists; 2) Ujo enabling musicians to charge their fans directly and resolving at the same time the issue of licences through smart contracts; 3) NevTrace and its record of refugees for migratory crisis or 4) Sweden and their testings for a property record on blockchain.
Therefore, the combination of smart contracts and blockchain is what can make the first one the legal instrument of the future and the second one the technology that can force to redo many of the known schemes.
2.- Let’s go from theory to practice!
After presenting all the theory, it’s time to get our hands dirty.
However, if smart contracts are software, do we need to know how to program in order to create them? No we don´t, but it can definitely help. Especially now that we are still on very early stages. Besides, if one knows how to program his/her own contracts, we will have maximum control. Even though this could create problems that we will address later on in the third section.
Therefore, where should we start from?
As explained in A Lawyer´s Introduction to Smart Contracts, the smart contract is just another component within the system. For that reason, the smart contract would be the final infrastructure component that allows to create and operate such contracts. The module such infrastructure has, which permits its creation would be the Smart Contracts Platform (from now on SCP). On the other hand, we also have another component that could be added to the SCP and make our life much easier, which is the Smart Contracts Management System (from now on SCMS).
In other words, the platform for smart contracts or SCP would be for instance the blockchain of Bitcoin or Ethereum. As well as any other blockchain that allows to interpret, execute even store smart contracts created within it.
Whoever wants to work directly on this layer will need to have some knowledge on programming in order to be able to create his/her own smart contracts. If you wish to do it on the blockchain of Ethereum, for that purpose below we include a tutorial to get started. If you prefer Bitcoin click here to start.
Meanwhile, SCMS are a superstructure placed above the SCP that allow us to use smart contracts just as if they were another service. This way, we could have at hand in a graphic way, also very easy to use the following: a database of the signed smart contracts, a calendar in which to program the beginning and the end, an editor to create drafts of the contracts or a place to store and check the activity records. As said before, all with a graphic interface and without a need for programming.
Thus, blockchain would be the foundations of a house, whereas the SCP would be the furniture and the SCMS the facade, the tiling and the paint.
If we don´t know how to or don´t want to program a smart contract and all its aspects, we might be more interested in a SCMS because it is the closest we can get to a “Smart Contract as a Service”.
Are there many like it? Not too many by now. Codius could fit but it requires some knowledge on programming. The browser/wallet Mist from Ethereum allows something similar but very simple. The Smart Contract presented in this section is one of the most useful, powerful and easy to use ones I have ever seen. An American company that allows to create different types of smart contracts on the blockchain of Bitcoin and Ethereum, besides programming smart coupons and making payments according to the geographical area of a good. All of this without the need to program.
If someone wishes to try out the service, it is now free, I suggest that you do it on the test platform (which is more hidden than the regular one). That way one can experiment with it more freely.
What was the main goal when creating our smart contract? To experiment with the concept and to do it with a smart contract not related to payments, which is the most common type. Therefore, our intention was to use the smart contract just for verification, exchange and/or information supply.
2.1.- Using the changes in terms and conditions to create a contract
We have already mentioned that the smart contracts are computer coding based on the idea “If this happens try this. But if it does not happen, then try that”. Therefore the contract requires an external source of information in order to check regularly if “this” happens or not. That source might well be for instance the results of a Google search, through an SEO smart rank. For example, “When a website gets on the first page of Google, make the payment”. This option is provided by the service through the contract “Service Level”, for example.
In this sense, the information gathered in our Tracker of Terms and Conditions regarding all the texts that are monitored, is stored in JSON format. This means that in relation to every modification detected, data such as the name of the service, the type of document, the date of the change or the percentage of modified text, are being stored in a format that later on can be read and verified by a computer program. In this case, this computer program will be our smart contract
What do we want our smart contract to do? Since the terms and conditions change very often and since those changes are not always reported, we suggest a scheme in which to configure through smart contracts its obligation to inform and even the acceptance of the conditions when they are modified. All this according to the percentage of change in the monitorized document. Which besides obeying the law, automating a legal obligation and reducing the costs of its compliance, can also offer an extra in transparency and liability which the blockchain provides.
In other words, terms and conditions always include a term related to an eventual modification of the texts. Those modifications are tiny many times but other times they are substantial and even then the user is not notified nor his consent required again. Part of the problem is that the concept “substantial change” is barely defined. Well, our proposal/experiment is to have that term solved through a smart contract.
The process followed to achieve this, at a small and experimental scale, has been the following:
2.2.- Let’s do a smart contract!
Next, we create a test profile in “SmartContract”, we click on “Create Contract”, choose the option “Bitcoin Oracle” and click on “Create Oracle”. We are interested in this option because of the possibility of establishing conditions that can assess whether a value rises, stays the same or falls.
We fill out the field “Description”, attach the files we deem necessary, sign and send the contract to some gentle soul who can make the experiment even more social (it does not have to be a user of the service). It should show something like this:
And with this and a headache :p, we do have a smart contract.
Everything mentioned in this second section is the practical version of the theory described in the first section. Therefore, here we have created a smart contract on blockchain (with all its implications). Although the experiment is extremely simple and incomplete, I think it helps to understand the concept of smart contracts in reality. It proves at the same time the existence of powerful and easy services that already permit the use of this new legal instrument with no need of programming knowledge. In other words, something we can already use as lawyers, and our clients as well.
That said, let´s go ahead with the tests! Since this little experiment barely scratches the surface.
By the way, if somebody wants to use the Terms and Conditions Bulletin as an external source for her/his smart contracts or even monitor a specifically created text (like the one used in this example), please go ahead and feel free to use those already available. Or else contact us for any specific case.
Finally, we are going to look roughly at some legal outlines on the previously discussed.
3.- Finally, what about the legal part?
We should have by now some idea about what a smart contract is from a technical point of view, what it can be used for and how it could be created. However, what happens legally speaking?
There are already several good articles on the legal aspects of smart contracts, two good examples are the already mentioned A lawyer´s Introduction to Smart contracts or Smart contracts: an approach to the concept and basic legal matters (in Spanish). As all this is already getting a bit too long :p, I merely will comment on a few issues that strike me, with extra reference sources.
There we go:
1.- Although it is very common to hear of smart contracts as instruments that are neither contracts nor smart, the truth is that they can perfectly well accommodate all the inherent parts of a contract and even come to “think” for themselves. It is true that many smart contracts are no more than a simple redirection of an amount from one account to another, nothing else. But we can create a pure smart contract, as some people call it, a contract that is perfectly legal, both in form and substance. Therefore, it all depends a little bit on the use of it.
2.- As for its intelligence, most of the smart contracts are truly robots that under the principle of absolute neutrality simply do as instructed. But there are some developments in that area that will lead them to more. From the inclusion of AI in its writing and compliance to such complex and curious experiments as the DAO or Decentralized Autonomous Organizations. What is a DAO? Very briefly, a smart contract of smart contracts. Or, as some say, when a bot runs the company. Its conception and development are very interesting, as well as its defects and legal consequences (the biggest DAO was hacked a few months ago).
3.- One last remark on its intelligence, I find the idea that over time a smart contract can “represent me legally” interesting. In other words, a smart contract can perfectly identify a user, control certain digital goods of this user and contract or not services depending on the programmed instructions. Therefore, it is only a matter of time before somebody creates his “digital representative”.
4.- The wording, correction and interpretation of smart contracts will be a more complex task, especially at the beginning. First of all, because they are not written in natural language. Secondly, due to the fact that they are so fast and automatic in its execution, it will be important to analyze in depth their lack of errors in the code (a legal debug will be necessary). Apart from this we have to keep in mind that they may include third-party unknown or unaudited code. In any case, natural language contracts will not disappear, they will simply live together or even get mixed (our example was like that). After all, the flexibility of natural language will very often be sought by both parties.
5.- The fact that smart contracts are executed and stored on a distributed network like blockchain is a problem in terms of the applicable law and jurisdiction (if the parties don´t indicate it in the contractual terms). Especially in those contracts in which the parties are not identifiable or even the content of the contract is encrypted. That means, if the contract is verified, executed and stored in millions of computers at the same time, it is everywhere and nowhere simultaneously. What jurisdiction is applicable if the parties have not said anything?
6.- The fact that smart contracts are stored on blockchain, with no possibility for them to be altered and with a maximum level of transparency, can lead to problems in regards to privacy and confidentiality of information. In fact, this is boosting the creation of new private blockchains. And what will occur with the right to be forgotten in a blockchain? Isn´t there going to be some kind of clash between the established in the new European Data Protection Regulation and what technology permits? Probably that´s why we are already working on (private) editable blockchains.
7.- The logical thing is that systems like the one used in the example will be the usual way of creating smart contracts. In that case, the terms and conditions of the service can be of help in regards to applicable legislation and jurisdiction. Therefore, it is also reasonable to assume that these services will be the main focus when it comes to regulation by the governments. We can´t forget that these services will have access to thousands of contracts, to the personal and confidential information they might include and that they will be in charge of their custody. Should they look after the legality of their object? Maybe prevent them from encrypting against any possible setback? Will any legal knowledge be necessary in order to provide templates of smart contracts? They are a computer program after all, that nowadays are mostly created by programmers, not by lawyers, but there is a strong legal connotation to it. In fact, there are already markets to buy and sell smart contracts.
8.- Finally, services like the one used and other similar services have the potential to foster that a few people seriously affect big businesses that are highly regulated, such as sports betting, lotteries or loans. That means, if we can create easily replicable templates of smart contracts on a big scale, it is just a matter of time before somebody ends up creating from his home place an alternative to Bet365 or any other service like these. But obviously without meeting the many necessary requisites for this type of businesses.
Summing up, the legal part of smart contracts is going to pose new interesting challenges. In any case, so far my first contact with them or “Smart contracts are for the summer”. :p
This has been good practice to me, in order to learn in some detail everything surrounding this new area of knowledge. At the same time, this mega post aims (just with the right amount of technical terms) to put in order many of those ideas with the intention that more people can have access to it. As what has been explained here is just the tip of the iceberg and there is still much more to explore.
Although it is true that all that is happening around smart contracts and blockchain is still in its initial bubble stage, over time it will ease down and the revolutions will give room to real applications. But it is undeniable that the technology and its uses have a great potential already present and available. Even for mere mortals. ;D
Happy smart contract!