Smart Contracts

Posted on May 26th, 2018

devnowBlockchain Education GuidesLeave a Comment

What is a Smart Contract?

Smart Contracts are pieces of computer code that are deployed on a blockchain network. They implement protocols for verifying or enforcing the performance of contracts, and can be used to perform transactions without the need for trusted third parties. Two or more people can make an agreement, implement the agreement by programming it into a Smart Contract, and then deploying the Smart Contract to a blockchain such as Ethereum. The blockchain acts like a large computer (or “virtual machine”) which executes the code based on certain conditions. For example, a Smart Contract might be deployed when you buy a car. As long as you continue to make your payments, the Smart Contract will allow you to continue to access the car. However, when you stop making your car payments, the Smart Contract will respond to this new condition by locking you from using your car.

 

Smart Contracts are written in various high-level programming languages (such as the Solidity and Serpent languages used with the Ethereum blockchain) and are identified by a unique address on the blockchain. They include a set of state variables, and functions which are executed when transactions are sent to the Smart Contract’s address. When those functions execute, they can change the values of those state variables based on the logic implemented in the Smart Contract code.

 

History of Smart Contracts

 

Computer scientist Nick Szabo first coined the term “Smart Contracts” in 1994, and proceeded to elaborate on the concept in future publications. Szabo conceived of Smart Contracts as digital products that use algorithms to automatically execute transactions when certain conditions are met. As revolutionary as the idea was, at the time, the necessary conditions for realizing Smart Contracts were not in place.

 

In 2008, the cryptocurrency Bitcoin was introduced, along with the revolutionary blockchain technology powering it. With it came the introduction of decentralized ledger technology, which enabled Smart Contracts to be realized. Shortly after, in 2013, computer programmer Vitalik Buterin introduced the Ethereum platform for deploying Smart Contract. From 2013 until now, many other platforms for creating Smart Contracts have been developed, such as EOS, Qtum and Lisk, but Ethereum remains the most popular.

 

One of the first Smart Contracts deployed was BlockParty, which has been used to incentivize people to attend events which they register for. In 2017, the CryptoKitties virtual game used Smart Contracts to track the features and ownership of unique virtual cats. The game’s popularity caused the Ethereum network to reach an all time record in transactions. As the blockchain space continues to evolve, more and more interesting Smart Contracts are being deployed, including those for crowdfunding, prediction markets, decentralized lending and insurance, freelance employment markets, digital identities, and many more.

 

Smart Contract Example

 

In this example, let’s take a look at a smart contract for a crowdfunding campaign. Users who deploy this contract would be able to set up a crowdfunding campaign goal and deadline. The smart contract would need to maintain information on each supporter of the campaign, including their blockchain address and the amount they have contributed to the campaign. Supporters would send transactions to a fundCampaign function in the smart contract along with the value (denominated in various cryptocurrencies) to contribute to the campaign. The funds that have been sent will be held in the contract account, and when the campaign ends, the owner of the campaign can check if the goal has been reached by sending a transaction to a checkFundingGoal function. If the amount raised is greater than the original goal, the funds are released to the creator of the contract, and if it isn’t reached, the funds are returned to the supporters. Everything needed to verify whether the goal is reached by the deadline date would be implemented as smart contract code in a language like Solidity.

 

10 Applications of Smart Contracts

 

Insurance

 

Smart contracts can streamline the process of processing and paying insurance claims by automatically triggering claims when certain events occur. For example, if you live in an area prone to earthquakes and have purchased earthquake insurance, the smart contract could trigger a payment as soon as an earthquake occurs. Not only would this allow consumers of insurance products to receive crucial payments quickly, it would also allow the insurance companies to reduce their inefficient administrative costs.

 

Internet of Things

 

Smart contracts can be used to control users’ access to Internet of Things devices. For example, a home security system could use a smart contract to make sure a door is unlocked only when trusted people are trying to enter. In addition, smart contracts could be used to facilitate payments for utilizing Internet of Things devices.

 

Supply Chain Management

 

By using Smart contracts to record ownership rights on the blockchain, companies can verify it’s products at each stage of its development and delivery process until the finished product reaches the customer. If a shipment is delayed, lost, or arrives with an important part missing, the company can check the Smart contract to precisely identify where the problem occured. The added transparency in supply chains enables more trust in the entire product development and shipment process.

 

Mortgage and Car Loans

 

Mortgage and car loans often require a lengthy process of checking the lendee’s income, credit score, and other information. Smart contracts can automate this process, saving borrowers from inefficient overhead costs. According to CapGemini, the banking industry could save at least $1.5 billion dollars by switching to smart contracts.

 

Employment Contracts

 

By signing a smart contract, employees and employers could have a clear, trusted description of the employee’s expectations and duties. This could lead to fairer wages and working conditions. In addition, smart contracts could be used to facilitate more trustworthy temporary and contract labor by preventing agencies from altering an employment contract’s terms after workers have started a job.

 

Copyrighted Content

 

Whenever a piece of media content like a song is used for a commercial purpose, the owner of the song’s rights is entitled to receive a royalty payment. Unfortunately, these copyrights can be harder to enforce, and are further complicated by situations in which multiple people contributed to the creation of a song. Often times in these cases, one of the song’s creators will receive the lion’s share of the royalties to the detriment of the other contributors. Smart contracts can be used to record ownership rights on a decentralized blockchain, making sure that royalties are distributed to the appropriate recipients.

 

Prediction Markets and Gaming

 

Smart contracts can allow complete strangers to participate in prediction markets and high stakes gaming, all without the need of a trusted third party. The participants can simply examine the smart contract code to make sure the prediction market or game is implemented fairly, and confidently deploy smart contracts that guarantee fair payouts with their gaming counterparties.

 

Digital Identity

 

With smart contracts, individuals can own their digital identity. They can control what personal information to disclose to other people and corporations. For their part, corporations will no longer need to hold sensitive data while verifying customer transactions, since they can obtain that information “on the fly” from a smart contract.

 

Record Keeping

 

Smart contracts can record legal documents such as land titles, and can even be used to detect fraud when property transfers occur. In addition, they can reduce auditing costs and automatically destroy records as required by law.

 

Securities and Finance

 

Smart contracts have numerous applications in settling trade and streamlining markets. Financial companies can use them for accurate and trustworthy financial reporting, stock market operators can use them to verify trades among counterparties, and auditing firms can use them to automate their tasks. In addition, smart contracts can make wealth transfers more efficient, adding greater liquidity to financial markets in the process.

 

Advantages of Smart Contracts

 

Savings

Smart Contracts eliminate the need for expensive middlemen and trusted Third Parties, such as lawyers, notaries, and banks.

 

Efficiency

 

Since blockchain networks can execute transactions very quickly, using Smart Contracts significantly speeds up many business processes.

 

Transparency

 

Once they are deployed to the blockchain, the terms and conditions of a Smart Contract are visible and accessible to everyone, making the contract indisputable for all parties involved.

 

Security

 

Smart Contracts on the blockchain use an extremely high level of data encryption, making them impervious to hacking. In addition, security checking libraries such as SafeMath are available so developers can keep their Smart Contracts from being hacked by bad actors.

 

Trust

 

The automatic execution of Smart Contracts eliminates the possibility of manipulation and bias. Once it is deployed, the blockchain guarantees the Smart Contract will enforce its obligations.

 

Disadvantages of Smart Contracts

 

Consumer adoption

 

Smart Contracts are a very new development and many consumers do not understand it yet. This, combined with the complexity of blockchain, has made many people suspicious of Smart Contracts.

 

Inflexible

 

Once a Smart Contract is deployed, there is no way of changing it’s terms. As a result, it can be difficult to make corrections to an existing contract. To deal with this, many developers are adding “Escape Hatches” into their Smart Contracts that allow users to change the terms as long as certain conditions are met.

 

Human Error

 

Even though Smart Contracts themselves are secure and trustworthy, the human developers creating them can make mistakes or sometimes even add malicious code into the Smart Contract. To avoid this, it is important that Smart Contracts be validated and audited. Organizations such as OpenZeppelin are establishing standards to mitigate the effects of human error or malice when creating Smart Contracts.

 

Different Blockchains and Smart Contracts

 

Ethereum

 

Ethereum was the first blockchain to implement Smart Contract functionality and is still the most popular. It provides developers with the Ethereum Virtual Machine (EVM) for executing Smart Contract code, and introduced the concept of “gas” as a means of pricing transactions on the network. Ethereum is powered by the Ether cryptocurrency, which grew over 13,000 percent in 2017 and is (as of present writing) the second most valuable cryptocurrency in the world by market cap. To promote usage of the Ethereum platform, a consortium of start-ups, research groups, Fortune 500 companies and non-profits created the Ethereum Enterprise Alliance (EEA) in March 2017. The alliance counts MasterCard, Samsung, Microsoft, Intel, JP Morgan, Merck, Cisco Systems, Deloitte, Accenture, Banco Santander, National Bank of Canada, BNY Mellon, ING, and Toyota among its members.

 

EOS.IO

 

The EOS.IO platform, developed by private company block.one, aims to be a decentralized operating system for industrial scale operations. block.one claims EOS.IO will be able to eliminate transaction fees and process millions of transactions per second, as well as providing decentralized storage solutions for Smart Contracts deployed onto its blockchain. The platform runs on the EOS cryptocurrency, which provides bandwidth and storage on the network in proportion to the amount of the token that has been staked. EOS.IO’s Smart Contracts will be implemented in WebAssembly, a language for running executable code in web pages that was developed by engineers from Google, Apple, Microsoft and Mozilla.

 

NEO

 

NEO is the name of both a blockchain platform and a cryptocurrency created to enable a scalable network of decentralized applications. It is the brainchild of founder Da Hongfei and his company OnChain. NEO supports 10,000 transactions per second by randomly selecting nodes to validate transactions and reach a consensus. NEO Smart Contracts can be programmed in a variety of popular programming languages, including Java, Python, Microsoft.net, and Go. It also features a set of tools that help developers efficiently deploy and scale their Smart Contracts.

Leave a Reply

Your email address will not be published. Required fields are marked *