The first article in this popular science series introduced blockchain, which is a very secure and reliable network that can exchange value and store data in an immutable ledger. Blockchain has spawned new monetary instruments such as Bitcoin, but its applications go far beyond that. It can also drive smart contracts (note: digital contracts with pre-conditions). The following will be discussed in detail in this article:

  • What is a smart contract

  • How do smart contracts create value

  • The evolution of smart contracts

– Current application mode of smart contract

What is a smart contract?

A digital contract is a digitally signed contract that operates over the Internet. For example, when a rider clicks “Agree” on Uber’s user terms, he agrees to pay the driver when the car delivers him to his destination.

In most digital agreements, the parties do not know each other, and in this case there is a risk if either party fails to comply. To avoid such counterparty risks, digital agreements are typically enforced by for-profit companies of sufficient size that can reliably enforce the terms of the contract. Such digital contracts can be signed between a user and a large company, or between two users, with the large company acting as a trusted intermediary. While this mechanism greatly reduces counterparty risk and broadens the scope of contracts, it gives these large companies a great deal of contractual control.

A smart contract is itself a digital protocol, but it is immutable software on a blockchain that is strictly governed by agreed terms. The simplest conditional logic is: “If event X occurs, perform action Y.” For example, if team A wins A sports game, Bob is paid. If team B wins the game, the payment goes to Steve. The smart contract does not need to manually enter the race result, but directly connects the race result data to trigger execution. When a smart contract receives the data, it automatically executes, usually to make a payment.

Business logic (i.e., contracts) is probabilistic, meaning that contracts may or may not be executed on the terms agreed upon; Smart contracts, on the other hand, are highly deterministic, meaning that the contract is 100 percent enforceable. Smart contracts execute flawlessly because of the decentralized, permission-free, tamper-proof, always-on nature of the blockchaining environment in which they operate. In this framework, contracts operate in a neutral decentralized network and are enforced through technical means.

The value of smart contracts

Smart contracts have the following advantages over traditional digital contracts:

  • Security: Running smart contracts in a decentralized infrastructure avoids the risk of single point of failure, removes centralized mediation, and prevents either party to the contract or the system administrator from tampering with the results.

  • Reliability: Multiple independent nodes in the network will process and verify the smart contract logic repeatedly, so as to effectively avoid the risk of manipulation, guarantee the network running time, and ensure that the contract is executed on time according to the specified terms.

  • Fairness: Using a peer-to-peer decentralized network to operate and enforce contract terms reduces the value of transactions extracted by centralized for-profit entities.

  • Efficiency: Automating back-end processes such as escrow, maintenance, execution, and delivery means that neither party to the contract has to wait for manual data entry, counterparties to perform contract duties, or intermediaries to process transactions.

The evolution of smart contracts

The earliest versions of smart contracts were called multi-signed smart contracts. For a transaction to take effect, a sufficient number of people (i.e. public keys) must sign the transaction using the corresponding private key. Bitcoin first introduced multi-signed transactions to the blockchain in 2012.

Developers then developed protocol-based smart contracts on top of this, embedding several core programming instructions (also known as OPcode) into the blockchain. Protocol-based smart contracts are blockchains that are incarnated as applications and are able to execute Opcode. However, such smart contracts are difficult to scale because a hard fork occurs every time the contract (or protocol) is updated, and a hard fork means that a whole new blockchain needs to be created and software needs to be updated at each node.

Ethereum made a big breakthrough when it released scripted smart contracts in 2015, turning the blockchain into a “world computer” that could run multiple different applications simultaneously. Smart contracts can be managed by developers and can be changed at any time without a hard fork. Scripting languages abstract low-level development problems, allowing developers to develop smart contracts in weeks or even days, whereas it would have taken months to years before.

Now we have another innovation, scripting smart contracts that connect to real-world data and systems down the chain. Smart contracts with external connectivity use a piece of middleware called a predictor to connect data down the chain to trigger contract execution. The predictor also allows smart contracts to send data to other systems, such as sending payment orders to traditional fiat payment systems and delivering smart contracts off-chain.

The current application model of smart contracts

While it’s still early days, we’re seeing smart contracts taking root in four markets, leveraging their unique strengths in security and reliability.

Rights Management (Token)

Token contracts create, track, and assign ownership. Such contracts embed specific functions in their tokens, such as providing dApp services/bandwidth to token holders (utility tokens), voting in the protocol by weight (governance tokens), allocating company equity (security tokens) and ownership of physical or digital assets (non-homogeneous tokens), etc. For example, SIA tokens can be used to pay for Siacoin’s decentralized cloud storage service, while COMP tokens can be used to participate in Compound protocol governance.

Financial Products (DeFi)

Decentralized Finance (DeFi) applications use smart contracts to recreate traditional financial products and services, including money markets, derivatives, stabocoins, exchanges, and asset management. Smart contracts can host user funds and allocate them to users based on results. For example, the Set protocol uses market data for automatic portfolio management, and the Opium exchange delivers options contracts based on real-time asset prices.

The game

Blockchain games use smart contracts to prevent fraud in games. One example is PoolTogether, a break-even savings game where users place their savings in a lottery smart contract that is connected to the money market. The deposit accumulates interest in the money market and is distributed to the winner based on a random number generation mechanism (RNG). After the winners are announced, everyone gets their initial capital back. Similarly, smart contracts can also use RNG to create rare game items, such as one-off magical swords. Chainlink’s verifiable random function (VRF) can be used to generate random numbers to convince users of the randomness of the results. Users can also independently verify the results to ensure that they have not been manipulated by game developers or data providers.

insurance

Parameterized insurance is a new type of insurance model, in which the indemnity is directly linked to the specific event set in advance. Smart contracts can provide a tamper-proof infrastructure for parameterized insurance, triggering contract execution based on data input. For example, Etherisc is working on a flight insurance smart contract that automatically pays out when it receives flight status information. Not only do end users get greater protection, but individual investors can also participate on the supply side of insurance through smart contracts, where they park their money in pools of contracted funds. Smart contracts distribute benefits based on users’ contribution to the pool.

Welcome to the Chainlink developer community

Look forward to our next post to learn more. The next article in this popular science series will explore the topic of smart contracts. Please follow us on Twitter and receive updates to this article. You can also join our Cable group for Chainlink updates.