How Smart Contracts Will Change the World
Author: Juan Ignacio Nuvreni
As you may already know (or not), blockchain is a technology that creates trustless, immutable, uncensored and decentralised networks to transfer value. Meaning, we no longer need to deposit our trust in a centralised entity like a bank or institution to validate the transfer of value between peers.
To illustrate the above statement better, we can use Bitcoin to show how blockchain solves the "double spending problem".
The Double Spending Problem
Let's say that you're sending an email to your coworker and you want to attach a pdf file. When your coworker receives the email and opens the pdf, he or she sees the exact pdf file that you sent from your computer. Now both have the same pdf file, which is useful. That's how most file transfers work these days. Which is great, but what happens if you want to send a unique asset? What happens if you're going to send money, for example? We need something that validates that if you send $100 to your coworker, you don't have that $100 anymore. That's why we invented banks: to keep a record of transactions and to trust those institutions to validate the money moves from one account to the other.
The double-spending problem is the question: How can we ensure that we don't spend the same amount of money that we previously transferred to another party?
That is what Bitcoin solves in a decentralised way, with no need for a central authority.
But that's only one case (a big one): Transfer of money. But what happens with other unique digital or physical assets? For example, real estate, property rights, or rare collectable items in an online game? The way we create transactions on these examples is way more complicated than just sending money from one person to another. There are many parties involved and many rules to follow to execute a transaction. Therefore there is a need for a different blockchain, with different rules and more flexibility to allow more use cases.
The History Behind Smart Contracts
The first time the world heard about Smart Contracts wasn't with blockchain technology; it was in the early 1990s by computer scientist, lawyer and cryptographer Nick Szabo, who is one of the precursors of Bitcoin and Blockchain technology. At the time, it didn't have as much resonance in the broader community, as it does now.
Fast forward to 2008, Satoshi Nakamoto publishes the Bitcoin whitepaper, and the blockchain universe emerges. From that point on, the crypto community grew, and by 2013, many ideas were floating around Bitcoin and how it should keep evolving. One of those ideas was to expand the Bitcoin programming language, Scrypt, to include more operations in the language so that developers could program more complex scenarios in which the transfer of value is made.
This idea, initially presented by programmer and publisher of Bitcoin Magazine, Vitalik Buterin got rejected in the Bitcoin community — the main reason being that Scrypt language was specially designed to lack those features for security reasons. The Bitcoin language is "Turing incomplete" by design, meaning developers don't have all the complex operators and structures that exist in most of the other programming languages. Being Turing incomplete ensures that there's less room for bugs in the code, making it more secure, but at the same time, less flexible.
From that refusal, Vitalik Buterin wrote the white paper of Ethereum. A general-purpose blockchain with a "Turing complete" programming language called Solidity that allows developers to program a limitless amount of possible scenarios. Later on, similar projects appeared, EOS or Cardano are two examples. The code written on these types of blockchain is called Smart Contracts.
What Exactly is a Smart Contract?
For a formal and technical definition, a smart contract is a piece of software code (computer program) that lives in a decentralised environment (Blockchain). This type of code is immutable, transparent and automated – meaning everyone can see it, no one can modify it, and it can execute by itself with no need for third party intervention. Smart contracts act as agreements between parties, where the terms of the agreement can be programmable. The parties that execute smart contracts can be humans, machines or organisations.
Upon execution, Smart Contracts allow the performance of credible transactions without third parties. These transactions are trackable and irreversible. The entire process is automated and can complement or substitute legal contracts. This fact is one of the main aims of smart contracts - to provide security that is superior to traditional contract law while reducing transactional costs associated with contracting.
A good example, to understand how Smart Contracts work, is the vending machine. In this type of scenario, the user interacts directly with the vending machine and no intermediary (say a seller in a store). When we input money, the software checks how much money we've put in. Then, if it's enough, we have clearance to choose a drink. Once selected, the machine drops the "asset" for us. While this is a straightforward transaction, it clearly illustrates how a contract can work. In the digital world, the asset can be anything we want, as we have already seen when describing the double-spending problem. In a smart contract, we can uniquely represent any asset in the digital or physical world.
Contracts Got "Smarter"
Imagine a mortgage agreement. This type of arrangement is very complex, with many rules and conditions to meet. Many details need to be included in them, such as income mortgagee, credit score, as well as outgoings. There are a lot of third parties involved in checking these details, making the process lengthy and troublesome for the lender as well as for the loan applicant. Smart Contracts can be extremely useful in this scenario because they can remove the middlemen through code, automate the process, and all the information can be stored in a location accessible by all parties at all times. Once settled in the blockchain, the transaction becomes an irreversible truth, creating a ledger where anyone can check the records of the mortgage.
Now imagine an inheritance. Smart contracts can automate the transfer of assets from an estate without needing an executor. For example, envision a smart contract where a person "checks in" with his or her private key every year to prove they are alive. When that person dies, they can no longer check-in. The smart contract will realise that more than a year has passed without a check-in, and it will automatically distribute the assets of a deceased person to his or her beneficiaries. In this example, the Smart Contract has completely removed lawyers, notaries and asset managers from the process.
The ICO case
A type of smart contract that gained a lot of popularity in 2017 was the ERC20 token one. This smart contract defined a new standard for creating a custom cryptocurrency coin; it described the rules for currency distribution, the total supply, and how the transactions worked. The ERC20 standard contract allowed for the creation of thousands of new cryptocurrencies. The funding process for these new projects was called an Initial Coin Offering or ICO. Each project had a different smart contract with the rules of that specific coin. Investors would purchase Ethereum native currency (ETH) as the ICO's were held in the Ethereum network. They would then send ETH to the contract address, and the contract would send them the coins of that specific Smart Contract. Each coin or token would have a different use case bound to the context of the particular project. These coins were then tradable in different online exchanges.
As you can see, smart contracts could change our entire economy in ways that we still don't realise! These contracts have many real-world use cases. Banks and other financial institutions could use it for loans and automatic payments. Insurance could use this technology to process claims. Postal companies could use it as payment on delivery. Supply chain solutions can implement smart contracts for numerous operations.
Benefits of Using Smart Contracts
A few of the many advantages of using smart contracts are listed below.
If the smart contract is running on an open blockchain, as we have previously stated, it is filled with all the terms and conditions by which different parties engage. The code is available for anyone to see, in full detail, step by step, its planned execution. This openness eliminates the chance of disputes and issues arising at a later stage. Moreover, the detail and precision of the software code make it very clear to all parties the outcomes of the execution, eliminating miscommunication. A common term used in smart contract development is: "Code is law".
All rules and conditions are written in the Smart Contract before it's execution. The level of detail and accuracy needed to code those rules makes the contract a comprehensive agreement. When the Smart Contract executes automatically, it gets everything correctly done. Comparing that with regular legal contracts, there are chances of error as the person who is responsible for implementing it can make mistakes, or misinterpret the legal jargon.
The execution of a traditional contract might take several days, as a lot of intermediaries are involved with different schedules and times, and even getting paper documentation from law entities can be a bureaucratic process that consumes tons of time. Smart Contracts run through the aid of the internet as they are nothing but pieces of software code. Therefore the speed of completing a transaction is way faster than traditional contracts.
Safety and Efficiency
Strict and detailed rules define the automated implementation of smart contracts. Execution and validation of transactions based on cryptographic verification mean that smart contracts meet the highest standards on safety and efficiency.
With smart contracts, all transaction details store on the blockchain, so anyone among the involved parties has access at any given time. This immutable storage makes the blockchain the source of truth for any dispute regarding the contract terms in the future.
Running Smart Contracts can save up a lot of money. By removing intermediaries, we also remove the cost of hiring them. Moreover, as stated earlier, we also save money as paper-based documents are not involved in any of the processes.
By far, one of the most valuable benefits of blockchains is their trustless networks. The transparency and security of smart contracts running on blockchain make them trustworthy in most environments like business or government. Consensus algorithms used on blockchain networks ensures that all parties are correctly incentivised to do the right thing.
Smart contracts eradicate the use of paper. On the one hand, this saves costs while on the other, helps companies save their paper usage and promotes their contribution towards a more "green" society.
The Current State of Smart Contracts
We are at the very start of this revolution. Smart contracts don't have broad adoption yet, and there are still many challenges to face before there is mass adoption. In 2017, it became evident the power and the dangers of smart contracts with the ICO boom; millions of people made a lot of money, while many others were scammed. Companies are starting to recognise the power of smart contracts, and many of them are experimenting with different types of Blockchains and use cases, but it is still a work in progress. Governments are not sure which direction to take with regulations and bans. In this aspect, China seems to be leading the way on crypto adoption.
One of the main challenges smart contract platforms are facing is scalability. Currently, the Ethereum network can process around 17 transactions per second. As Vitalik stated a few months ago, it must process approximately 100,000 transactions per second to be a viable platform for the future. An illustrative example of this is the CryptoKities project that, back in late 2017, gained so much popularity it clogged the network.
Ethereum is not the only Smart Contract platform, but it's the biggest one, with the most developers and projects on it. Major competitors of Ethereum are EOS and Cardano. They are other general-purpose blockchains with different approaches to their Consensus algorithms and programming languages.
Many well-known crypto personalities in the space compare the current state of the industry with how the internet was in the early '90s.
The Future of Smart Contracts
Smart Contracts will change how we do business in the future. Let's look at the most common case that we discussed earlier: Legal Contracts. Governments and companies rely on legal contracts based on the laws of a country. The lawyers are the "coders" of our current system; they know how to write contracts and how to execute them. With this new paradigm, lawyers may have to learn how smart contracts work and become something close to a software developer to keep their work relevant. The legal sector may be one of the most affected in the future.
Smart contracts are so disruptive that it would be pointless to predict how it's going to turn out. As technology gets more efficient, we will start to see more and more innovative projects. The only certainty is that we still haven't reached the full potential of this technology.
There's no doubt Smart Contracts have the potential to change our entire economy and society. Whether through the supply chain, voting or autonomous organisations, it's easy to see that the potential is there. If we think about other technologies like AI, Robotics and IoT mixed with blockchain technology and smart contracts; we are looking at a whole different world. The great challenge in our future won't be the development of these technologies nor the mass adoption, instead - their purpose. Are we moving towards a more equal and inclusive society because of them, or a more segmented and unfair world? The beauty of blockchain lies in the decentralisation that gives us the power back. It is our responsibility to use it to create a better world.
About the author:
A software developer by profession, and a traveller by heart, Juan has lived and travelled in many countries. Once he recognized the power of Bitcoin and Blockchain technology there was no way back. Driven by the potential to create a fairer world through technology, he is now on a mission to educate and spread the word of Blockchain.
An Overview of 4 Smart Contract Platforms
Ethereum was introduced in 2013 by a Russian-Canadian programmer named Vitalik Buterin. This marked the introduction of smart contracts. Ever since then, Ethereum has not only experienced tremendous growth but also managed to gather one of the healthiest developer communities in the crypto sphere.
- Reasons for Creation of Ethereum
Buterin was inspired by the success of the Bitcoin network. However, he felt that blockchain technology could offer much more than just a payment system. He desired to create a platform that enabled developers to develop their blockchain applications on the Ethereum network. Ethereum was designed to be a peer to peer global operating system that would rent out computing power to a developer to build a decentralised app (dApp).
- Consensus Algorithm
Ethereum currently uses the proof of work mechanism. This mechanism involves computer nodes known as miners. Miners own specialised equipment such as GPUs and ASICs that solve cryptographic puzzles by spending real computational power. The first miner to solve this puzzle adds the next block on the Ethereum Blockchain and is rewarded.
With time, Ethereum will move on to the proof-of-stake protocol because it is considered less wasteful and more scalable.
With the proof-of-stake mechanism, the entire mining process is virtual. The miners lock part of their coins in the system. Each miners hashing power is directly proportional to the size of their stake. Validators earn by betting on a particular stake. If the bet is successful, they share the reward according to their stake.
Ethereum plans on implementing the POS mechanism through the Casper protocol in which a malicious validator has its stake slashed as punishment.
- Developing On Ethereum
Ethereum smart contracts are written in the Turing complete solidity scripting language. The fantastic thing about this programming language is that it can theoretically solve any problem if you provide enough resources and time. Because of this, halting mechanisms such as 'gas' on Ethereum are imposed to stop the smart contract when needed. Gas is a unit that measures the computational power required to complete a particular operation. All steps in the contract require gas; once the gas costs exceed the pre-paid fee, the smart contract is killed.
Ethereum conducts most of its governance off-chain through Ethereum Improvement Proposals (EIP).
These EIPs are mostly detailed design documents that suggest ways of improving the Ethereum Blockchain. The processes are not recorded, voted for, presented, or passed on the blockchain itself.
However, the platform still has a form of on-chain governance due to its proof of work consensus mechanism.
EOS is a smart contract platform based on the EOSIO software built by block.one.
- Reason for Creation
Although Ethereum paved the way for smart contracts, its design limits it to between 15 to 20 transactions per second. This level of latency is way too slow for modern dApps.
Eos was developed to become a decentralised operating system that supports industrial-scale dApps. The platform users will own resources in exchange for their stakes.
- Consensus Algorithms
EOS uses a delegated proof-of-stake DPOS consensus mechanism to transfer the validation of the blockchain to a consensus committee of 21 members.
In DPOS, all those who hold tokens in platforms integrated into the EOS software can choose the block producers via an uninterrupted approval voting system. Anyone is allowed to participate in the block producer election, and they will be granted a chance to produce blocks proportional to the votes they receive relative to all other producers. This works by having blocks created in the rounds of 21. The 21 block producers are selected at the start of each round.
- Development On EOS
EOS uses a governance model that allows you to stake your EOS tokens in exchange for resources such as network bandwidth, RAM, and CPU bandwidth. Since these resources are scarce, you are only allowed to hold on to them for a maximum of three years. Should you fail to use them within this period, your account is terminated.
EOS develops smart contracts using WebAssembly. Although this is not a coding language, it allows developers to use a language of their choice and then compile into a bytecode that runs on a supported browser.
WebAssembly was chosen because it is flexible, fast, efficient, open, debuggable, and safe.
Governance in EOS is maintained by establishing jurisdiction, choice of law, and other acceptable rules. This is done through the legally binding constitution. Every transaction on the platform must contain the hash of the constitution in its signature.
An Ethereum co-founder, Charles Hoskinson, conceptualised Cardano. The platform offers scalability through a layered architecture.
- Reason for creation
Cardano takes a unique approach since it is developed on peer-reviewed academic research and scientific philosophy. Instead of starting with the conventional whitepaper or road map, the team focused on embracing a collection of engineers' best practices, design principles, and avenues for exploration.
- Consensus Algorithm
Cardano uses a peer-reviewed consensus algorithm known as Ouroboros. This algorithm checks the distribution of the tokens in the ecosystem and uses random numbers to divide the world into epochs. Each epoch lasts for 20 seconds and is divided into slots. Each slot gets a random leader who acts as a miner in a proof of work protocol. A leader is only allowed to add one block.
- Development on Cardano
Cardano uses Haskell and Plutus languages to code and create smart contracts, respectively. Both of these languages are functional. This means that they are easier to reason mathematically and, therefore, more secure to use in the creation of smart contracts.
Cardano’s governance is taken care of by institutions such as Emurgo and IOHK. The smart contract platform also has a voting centre to ensure that the platform is being developed continually. Proposals to update the protocol or the software have to be put up for voting. Each user's vote carries a weight that is directly proportional to the stake he/she has locked up in the system.
4. Rootstock (RSK)
This smart contract platform is connected to the Bitcoin blockchain. The platform was developed to compete with Ethereum’s applications but using Bitcoin as the underlying cryptocurrency. The side chain was supposed to give the Bitcoin blockchain smart contract functionalities.
- Reason for creation
Bitcoin has the following advantages: a healthy community with robust hashing power, wide distribution, low running with proven security, and widespread awareness.
RSK was created to allow its users to users to get smart contract functionality and higher scalability while still benefiting from the advantages of Bitcoin.
Rootstock interacts with Bitcoin through a sidechain mechanism. A two-way peg is used to connect the sidechain to the Bitcoin Blockchain. When RSK users lock up their BTC, they get an equivalent amount of RBTC (rootstocks native coin) in the sidechain. They can use these coins to interact with smart contracts and dApps on the Rootstock blockchain. Block consensus is secured by merge-mining while the RSK Foundation secures the two-way peg.
- Consensus Algorithm
While Bitcoin’s proof of work mechanism has its downsides, it is the only consensus mechanism that can protect the blockchain from double spends and reorganisations.
Once an operation is done on this blockchain, its imprint will be etched in history forever. Nothing can be done to prevent such activity.
Rootstock uses merge mining to use the same hash rate as the Bitcoin blockchain. Currently, the sidechain sustains about 30% of Bitcoin’s hashing power, making it the most secure smart contract platform.
- Development on RSK
The RSK virtual machine is used to execute smart contracts. The machine has the following features:
- Users can run the Ethereum blockchain with the security of the Bitcoin blockchain
- RVM is compatible with EVM, which makes it possible for RSK to execute the Ethereum blockchain
- RSK can suggest performance improvement pipelines that are documented in many RSK improvement proposals (RSKIPs).
Although Rootstock is currently using a community-driven improvement proposal system, the platform’s original white paper proposes a long term governance model that represents the community actors, and a board of governance composed of five seats.
- Miners can vote (one vote) using hashing power
- Bitcoin and rootstock users have one vote through the proof of stake
- Web wallets and exchanges can vote through their participation in the federation
- Bitcoin and Rootstock’s core developers are given one vote through a unique threshold voting system
- The final vote can be offered to a Bitcoin non- profit organisation
Over to You
What do you think is a great use-case for smart contracts? Which smart contract platform do you prefer to use? Let us know in the comments below!
The above references an opinion and is for informational purposes only. Do not take this as personalised financial advice or investment advice. The views expressed by the author do not necessarily represent the opinion of BitPrime.
Last updated: 29/10/2019