PYMNTS DeFi Series: What Is a Smart Contract?

DeFi, Smart Contract, Ethereum, Crypto

Welcome to the third installment of PYMNTS’ eight-part series on DeFi!

Over the coming days be looking at every part of decentralized finance — the biggest, hottest, most rewarding and risky part of the blockchain revolution.

At the end of it, you’ll know what DeFi is, how it works, and the risks and rewards of investing in it.

See Part 1: What is DeFi?

See Part 2: What Are the Top DeFi Platforms?

So, you want to know what a smart contract is, and why you should care?

Well, start with this. Smart contracts are what turned crypto into an industry.

Bitcoin may be the largest and best-known cryptocurrency, but other than it — and few other pure cash-replacements coins like litecoin, and stablecoins like tether and USD coin — every token runs on a blockchain that can properly be called a smart contract platform.

Smart contracts are the building blocks of decentralized finance, or DeFi. And non-fungible tokens (NFTs), and blockchain-based games, and streaming video platforms, and social media sites — well, you get the picture.

At the high level, smart contracts are what is threatening to upend big finance, reimagine the supply chains that move goods around the world, and even provide the foundation for the next-generation Web3 that supporters hope will end big tech’s dominance of the internet.

Smart contracts were brought to blockchain in 2015 with the launch of Ethereum, which is more properly known as a smart contract platform — despite the fact that its token, ether, is now the second-largest cryptocurrency with a market capitalization of more than half a trillion dollars. This gives you a sense of how important smart contracts are.

Immutable Agreements

More prosaically, smart contracts are agreements written on blockchains that run without any outside approval or human input when conditions are met. They are “self-executing” contracts.

The point is that once they have been written and agreed to, they are immutable — the terms cannot be changed or the agreement canceled. Any payment stipulated in the contract is locked into the contract at its creation, so there is no getting your crypto back, either.

This removes the need for a trusted intermediary to ensure that the terms of an agreement are enforced, such as Visa, which a merchant trusts to be sure they will be paid, and a customer trusts to make sure their goods will be delivered and not be defective.

Take a simple example from DeFi. Tom wants to borrow $10,000, so he goes to a lending protocol, and sets up a smart contract. Tom agrees to deposit $15,000 worth of ether (or another cryptocurrency) — 150% of what he is borrowing — as collateral into the contract, in exchange for $10,000 in stablecoins.

When Tom returns them, the smart contract will return his collateral, minus fees and interest. The point is to get cash quickly without selling the cryptocurrency Tom believes will keep going up in value.

However, the smart contract also states that if the value of Tom’s collateral falls to 110% of what he borrowed, the collateral will be liquidated — sold off at a loss during a downturn — to ensure that the lender doesn’t lose out if Tom doesn’t repay the loan.

There is no bank to charge Tom a fee and take a cut of the interest he pays. But, there is also no banker who can help him.

Caveats

The agreements are written in the “if-this-then-that” language of computer coding, so there are a few very big caveats to that whole “replacing trust” idea.

For one thing, just like computer code can be buggy, a smart contract’s language can have very nasty surprises if it doesn’t say what you think it does. Remember, once the contract is agreed to and locked, there’s no going back in to correct mistakes. The crypto industry term is “code is law” — which roughly translates to “get it right the first time, or else.”

Because smart contracts eliminate the need for trust, and because cryptographers should never be allowed to name anything the general public will use, they are called “trustless.”

This acts as a good warning for the other big caveat — specifically, caveat emptor — or let the buyer beware. As many cryptocurrency transactions are between (theoretically) anonymous parties, there’s no suing someone who sold you a gold watch that turns green when you sweat on it.

Next Level

Smart contracts can get far more complex, however. Because they are written in the language of coding, a sufficiently complex smart contract can be an application like anything on your laptop or smartphone.

So, that DeFi exchange you’re trading on? It’s a smart contract. That NFT you bought of Lebron James making a slam dunk? It’s a smart contract. Blockchain games as simple as CryptoKitties or as complex as the MMORPG Axie Infinity? They’re smart contracts.

Streaming video sites, social media platforms, metaverses — every app running on a blockchain is a smart contract.

Next Up: What Is Staking?

With one very notable exception of Ethereum, virtually all DeFi blockchains use eco-friendly staking as their consensus mechanism, in which “validators” put up what amount to bonds for good behavior in exchange for the rewards for adding a new block of transactions to a blockchain. Why do you care? Well, staking is a popular and increasingly easy way to earn passive income on your crypto holdings.