e-commerce p PART 2 PART 3 PART 4 PART 5 Blockchain Technology & Smart Contracts Learning Outcomes 30 minutes After completing this module, students will be able to: Definition of Blockchain and Smart Contracts. Uses of Blockchain. Running a program on blockchain. Similarities between a Contract and a Computer Program. Self - executing Contracts. How smart contracts effect legal practitioners. In Part 5, the main objective is to get a very basic understanding of what a Smart Contract is. The term “Smart Contract” is often used in the same sentence as “Blockchain”. We will therefore also have a look at what a “Blockchain” is. It is very important to take cognizance of the fact that Smart Contracts and Blockchains are from an academic point of view still very immature concepts. It is hard to find a single definition that everyone agrees with. The definitions still seem very slippery, with large corporations using and abusing the terms to fit their marketing messages. Things are still in flux and the meaning and definition of these terms may still change. Keep this in mind and try to track the process by adjusting and updating what is shared here, as you learn more about the field. What is said here may not be completely in agreement with how the consensus on the meaning of these terms will converge in the near future, but it still forms a valuable starting point. Smart Contract Blockchain A simple definition comes from IBM (not an acknowledged source of academic information, but still useful to aid understanding): https://www.ibm.com/sa-en/topics/smart-contracts “Smart contracts are simply programs stored on a blockchain that run when predetermined conditions are met.” Euromoney provides a simple definition of a blockchain: (https://www.euromoney.com/learning/blockchain-explained/what-is-blockchain): “A blockchain is essentially a digital ledger of transactions that is duplicated and distributed across the entire network of computer systems…” If this makes perfect sense to you, you can skip the rest of this discussion. But if you find these definitions a little hard to digest, please read on. The rest of this discussion will help you build an understanding of these concepts, starting from very simple and known building blocks: Important definitions: Ledger Digital Ledger When people interact, they cannot always rely on memory alone, in order to remember what was said and agreed to. People easily forget and often do not agree on what was said. This causes conflict and parties may easily end up in court. It is better to record important information, than to try to remember details. A ledger is a record of important information that people need to agree on. The term “ledger” is most commonly used in accounting to refer to a record of financial transactions. Financial transactions are typical important information with detail that should be recorded in a reliable and trusted way. A ledger can be in the form of a paper document. It is important to record information in a ledger in a way which cannot be altered. Using a pencil to record information in a ledger is a bad idea because it can easily be changed. This will erode trust in the correctness of the information in the ledger. Using a pen which cannot easily be erased, is a much better idea. A ledger does not have to be on paper. It can be in digital format and stored on a computer. Information in a digital format can be written and read much faster and in much larger quantities than on paper. It is much more efficient to implement a ledger digitally than to record the information on paper. BUT digital information can very easily be copied, and records can easily be deleted or changed, often without any trace that it has happened. This defies the whole purpose of recording information in a ledger in the first place. To be a trusted source of information, the ledger should be immutable (impossible to change). A digital ledger can be controlled by a trusted third party. A bank is a good example of such a trusted third party. The bank keeps the ledger and all its clients trust that the bank will not change or delete any of the transactions recorded in the ledger. The third party controls the ledger and can make changes for its own benefit. What if two parties want to transact with each other and cannot find a third party that they both trust? Is it possible to have a ledger where the two parties do not HAVE to trust a third party? This is where a blockchain comes into the picture. This kind of ledger will make it possible for people to transact with each other without having to trust a third party. Blockchain A blockchain is in simple terms an immutable (cannot be changed) distributed (spread over multiple computers) digital ledger which does not rely on a trusted third party. This is achieved: By storing copies of the ledger not only on a single computer but on a very large number (typically thousands) of independent computers. By grouping new information into blocks before adding the blocks to the ledger. By making every new block that is added, also depend on the information in the previous block that was added (chaining the blocks together). This chaining process relies on complex cryptographic computations which use a huge amount of computing power, making it very difficult and time-consuming to repeat. The result is an immutable digital ledger that can be trusted, because it is for all practical purposes impossible to change fraudulently: Because all the blocks in the ledger are chained (each block depends on the previous block). Changing information in a block fraudulently, requires changing all the blocks that were added AFTER this block. Since more blocks are constantly added to the blockchain and it takes a lot of computing to chain the blocks, this becomes virtually impossible. Because this process must be performed on multiple computers controlled by a very large number of independent parties, on which the distributed ledger is stored. Because the ledger is stored on so many independent computers, the trust in the ledger does not rely on trusting any single entity. Parties doing business can confidently use the information in a blockchain ledger without having to trust anyone else. Uses of a Blockchain An immutable ledger is a very powerful concept. Here are a few examples of where blockchain technology can and has been used: Cryptocurrency Cryptocurrency is the result of trying to create a digital version of paper cash which (among others): Can be accepted on face value (one does not have to contact a trusted third party to confirm that it has value). Cannot be spent twice (one cannot keep a copy after paying someone and use it again to pay someone else). Can be divided (to give change). A blockchain makes it possible to implement some of the core features of digital cash. Bitcoin is probably the best-known cryptocurrency using a blockchain. Bitcoin transactions, such as paying someone for a product or service, are recorded in a blockchain where no-one can change the records of the transactions. This makes it possible for parties to pay each other without having to trust a third party such as a bank. Ether (EHT-implemented on the Ethereum blockchain) is another example a cryptocurrency which is second only to Bitcoin in market capitalization. Storing Public Records Public records such as those held by the Deeds office (property registrations and antenuptial contracts) must be recorded and stored in a way that can be trusted by the general public. Storing this information on a blockchain means not even corrupt officials would be able to tamper with records. Recording Patent Registrations Recording patent claims and priority dates in an immutable, tamper-free ledger such as a blockchain have obvious advantages in insuring trust. (Have a look at: https://www.wipo.int/wipo_magazine/en/2018/01/article_0005.html) Running a Program on a Blockchain The developers of blockchains are typical engineers and computer scientists. They do not like repeating transactions manually. They probably very quickly made their own lives easier by implementing mechanisms to automatically execute transactions. Very quickly the value of more powerful computer languages, running on a blockchain was realized. Solidity is the name of one such a programming language designed to run on various blockchain platforms, in particular on the Ethereum blockchain. The benefit of running a computer program on a blockchain is that not only can the result of a transaction be stored, but the sequence of actions to arrive at the result, can also be stored in an immutable way. Smart Contracts One of the objectives when drawing up a contract is to record an agreement as clearly and concisely as possible. There should be no ambiguity as to what the intent of the signatories was. Contracts are often structured to include: (https://lawexplores.com/contracts-structure-and-interpretation/): The names and addresses of the parties Recitals (non-operative (no special legal effect) background explanation) Definitions Conditions Precedent Agreements Representations and Warranties Boilerplate Clauses Schedules Signatures Appendices A computer program has a similar goal: to record the intentions of the programmer in a way which will always produce the same result when executed by a computer under the same conditions. For this purpose, a language with a very structured format is used to specify computer programs. There are similarities between a legal contract and a computer program. In fact, the programming community has learnt and applied principles which legal practitioners use to structure a contract. Without trying be exhaustive, it is interesting to note that it is good practice to start a computer program with a block of comments explaining the background to what the program does. Similar to the recitals section in a contract, which does not have special legal effect, these comments are not executed by the computer. Another similarity can be found in the definitions at the start of a computer program and the definitions section of a legal agreement. Variables are defined at the start of a computer program and used later in the program as shorthand to refer to a value with very specific meaning in this program. By way of an example, let us consider a simple contract that is signed by a taxi driver and his passenger: Contract between Taxi Driver and Passenger The Parties to this Agreement: Passenger: Mr Smith Driver: Mr Johnson Definitions: Pickup Point: Mr Smith’s home address Dropoff Point: The Loftus Rugby Stadium FEE: R 250 Penalty: R 50 Agreement The Passenger requires to be transported from the Pickup-Point to the Dropoff-Point and the Driver agrees to offer this service in exchange for the Fee. This agreement commences when the Passenger contacts the Driver and the Driver accepts the call. If the Passenger should not be at the Pickup point when the Driver arrives, the Passenger will pay the Driver the Penalty. If the Driver arrives with the Passenger at the Drop-Off-Point, the Passenger will pay the Driver the full FEE. Signed by: Driver: ___________ __________ Passenger: Date: ___________ __________ Date: Place: ___________ __________ Place: However, the driver and passenger do not know each other and have no reason to trust each other. The passenger may jump out at the dropoff-point and run away without paying. The taxi driver may take a longer route and demand a higher fee than agreed, upon arrival at the dropoff-point. And although both parties may have signed the agreement, it may be very difficult for the driver to collect the penalty, should the passenger not be at the pickup-point. Self-executing Contracts If, instead of relying on the parties to comply with the terms of the contract, the contract could be programmed and executed by a computer system, the terms could be enforced without having to rely on the cooperation of the parties. The following is an example of what such a computer program implementing the Taxi Contract might look like when written in pseudo-code (computer instructions which look very similar to a real computer program). It is not important for you to understand the program below. The purpose is simply to give you an intuitive feel for the similarities between legal contracts and computer programs. Simply read the code at least once to get the gist of it. Please note that the following pseudo-code program does not include all the logic to implement the contract. It is an over-simplified subset, just to illustrate the similarities between a legal contract and a computer program. PROGRAM: Taxi Contract App; /* This program automatically pays the taxi driver when he arrives with the passenger at */ /* the dropoff point. */ /* The passenger pays a penalty if he is not at the pickup point when the driver arrives */ VARIABLES: PickupPoint; DropoffPoint; PassengerLocation; DriverLocation; PassengerWallet; DriverWallet; Payment; EndOfTrip = false; CONSTANTS: Fee Penalty = 250; = 50; BEGIN PickupPoint = PassengerHomeGPSCoordinates; DropoffPoint = LoftusStadiumGPSCoordinates; REPEAT{ PassengerLocation = PassengerCellphoneGPS();/* read passenger cell phone GPS */ DriverLocation = DriverCellphoneGPS(); /* read driver cell phone GPS */ IF (DriverLocation = PickupPoint) AND (PassengerLocation ≠ PickupPoint) THEN {Payment = Penalty; PassengerWallet = PassengerWaller – Payment; DriverWallet = DriverWallet + Payment; EndOfTrip = true; } ELSE IF (DriverLocation = DropOffPoint) AND (PassengerLocation = DropOff_Point) THEN {Payment = Fee; PassengerWallet = PassengerWallet – Payment; DriverWallet = DriverWallet + Payment; EndOfTrip = true; } } UNTIL EndOfTrip = true; END. Uber Example: The Uber taxi service is an example of a contract which partially self-executes. The Uber “Terms and Conditions” include the following clause: (https://www.uber.com/legal/en/document/?name=general-terms-of-use&country=southafrica&lang=en) Clause 4. Payment You understand that use of the Services may result in charges to you for the services or goods you receive from a Third-Party Provider (“Charges”). After you have received services or goods obtained through your use of the Service, Uber will facilitate your payment of the applicable Charges… You may elect to cancel your request for services or goods from a Third Party Provider at any time prior to such Third-Party Provider’s arrival, in which case you may be charged a cancellation fee.” These parts of the Uber contract have been coded into a software program. Instead of the passenger and driver entering into an agreement by signing a contract with pen on paper, the two parties enter into the agreement by performing actions on their mobile phones: The passenger uses the Uber app on his mobile phone to hail a driver and the driver uses the Uber app on his mobile phone to accept. The two parties agree that the passenger will pay the driver a certain amount when they reach the drop-off point. The agreement executes automatically. The software monitors the GPS position of the passenger mobile phone and does a credit card transaction as soon as the passenger arrives at the drop-off point. There is no risk that the driver will demand a higher payment than what was agreed. There is no risk that the passenger will try to get away without paying. The conditions that were agreed to, are self-executing. It happens automatically. Smart Contracts A self-executing contract can only work if the parties trust that the contract will indeed execute and implement what had been agreed to. In the case of Uber, the driver and passenger probably do not know each other and probably have no reason to trust each other. But since Uber controls the execution of the contract, it is not necessary that the driver and passenger trust each other, as long as both trust Uber. Putting a lot of trust in single organizations such as a mega tech-company or a government, poses challenges of its own. These trusted third parties my abuse the trust put in them and interfere with the execution of the contracts for their own purposes. Uber, for example knows exactly which places their clients visit and has been accused of snooping on the movement of celebrities and persons in public positions such as members of parliament. The ultimate self-executing contract would allow for two parties to enter into a self-executing agreement without the need to trust a third party. We have already seen that a blockchain forms an immutable record of transactions and that programs can be both stored and executed on the blockchain. When a contract is stored and automatically executed on a blockchain, it forms a Smart Contract. Two parties can agree to and record the details of a contract on a blockchain, without having to trust a third party. And after the contract has been recorded, they do not even have to trust each other anymore, knowing that when the conditions of the contract have been met, the result will be executed automatically. Example: Trust Fund for Children: A parent can set up a trust fund for children and use a smart contract to ensure that an inheritance amount will be paid out automatically to each child on his/her 18th birthday, or even that a monthly allowance will automatically be paid out to the child until the fund has been depleted. An Oracle Smart contracts often rely on external (to the blockchain) information to determine the conditions under which to execute. Obviously, it is of little use to have a smart contract which is executed on a blockchain and can therefore not be tampered with, BUT which relies on information which CAN be tampered with. An “Oracle” is a source of external information which can be trusted to form a reliable input to a smart contract. One way in which to create an oracle, is to obtain the information from a large number of independent sources. For example, if a smart contract uses a currency exchange rate to decide when to make a payment, a way to implement an oracle (reliable source of the exchange rate data, that cannot be tampered with), the average exchange rate can be calculated from a large number of independent companies and government departments reporting the exchange rate. This way it will be very difficult for someone to interfere with the execution of the smart contract. Examples of Smart Contracts Trading and Investing: Investors can draw up a smart contract that will automatically buy or sell stocks, based on the stock price, without using an intermediary (trusted third party) and without the buyer and seller even having to trust each other. The smart contract includes the payment transaction. Air Travel Refunds: A smart contract can monitor the real take-off times of airplanes and automatically execute the small print on the air ticket that states that the traveler will be refunded, should the airplane not take off within a certain time period of the scheduled takeoff time. How do Smart Contracts affect Legal Practitioners? Whenever computers take over work that has traditionally been done by a human, there are doomsayers predicting that people will soon be out of a job. In the case of smart contracts, there are those who believe it would soon put contract lawyers out of work. The reality is that technological advances often open up more work and more opportunities. It is doubtful that smart contracts will replace attorneys. The legal aspects of a contract still stay within the legal domain to be taken care of by legal practitioners. Technology cannot replace this. For example, an illegal contract is not legally binding, regardless whether it is “smart” and executed by a computer. And often the intent of the parties to the contract plays a major role in the validity of a contract. Smart contracts may be very abstract and hard to grasp for those without a technical background. The services of a legal practitioner will still be required. Smart contracts are here to stay and will most likely stimulate a closer connection between software engineers and the judicial system. Those legal practitioners who manage to embrace the new technology will probably find their services to be in high demand. Smart contracts are probably much more of an opportunity than a threat to the legal profession.