They can play a role in everything from finance to NFT transactions. Here’s how smart contracts work — and why they matter more and more in the age of Web3.
The growth and influence of blockchain technology can come at you fast. With new cryptocurrencies proliferating faster than you can keep track and non-fungible tokens quickly becoming part of everyday conversation, you can be forgiven for missing out on a couple of key developments along the way.
The emergence of smart contracts should not be one of them.
Touching everything from inheritance to retail transactions and beyond, smart contracts exist with three main goals:
- Increasing transparency
- Cutting down on human error
- Keeping transactions secure
Let’s get smart.
What Are Smart Contracts on the Blockchain?
In short, a smart contract is an agreement between two parties where the terms are coded into the blockchain. Once those terms are met, the contract is automatically executed.
Often, you’ll see blockchain experts like tech lawyer Alexia Christie compare them to vending machines, and that’s actually a pretty good analogy. Imagine standing in front of a vending machine and deciding you want a $1 bag of chips in slot A5.
So… how does that bag go from the machine to your hands?
Well, first you need to insert your dollar. When you do, the machine will verify that the dollar is real. From there, you punch in A5. The machine is coded to know that A5 means to dispense that particular bag of chips. And so the machine does just that, enabling you to reach in and grab your snack.
A smart contract works in the same way: It’s programmed to know that when it is told of a certain event (A5 being hit on the vending machine), it needs to react in a certain way (dispense your bag of chips).
What Are Smart Contracts Used for?
Smart contracts are used to securely ensure that terms are met based on particular conditions. The potential uses, particularly in finance, are endless.
Here’s a simple example: Let’s say an athlete will get a bonus from a local store when that store sells a specific number of their jerseys. Each jersey sale is rung up and recorded on a blockchain, and once that desired number is hit, the contract automatically triggers a payout of that bonus to the athlete. There’s no need for the store manager to sit there crunching the numbers. There’s no need for the athlete to wait for a check or for the store’s bank to issue a direct deposit. Instead, once that final sale is rung up, the deposit is automatically triggered.
But because this is all managed on the blockchain, you know there must be additional practical applications for smart contracts that are, let’s say, of the non-fungible variety.
At their most basic level, all NFTs rely on smart contracts. When a user purchases one — think of it as putting a dollar into the vending machine, which can be our stand-in for a blockchain — that purchase is recorded and authenticated. Once this is settled, an NFT (your bag of chips) is dispensed.
But things can go even further than that.
Playground Studios, the Web3 company that manages NBA NFT pioneer LaMelo Ball’s blockchain business, uses smart contracts specifically to create dynamic NFTs — the next logical evolution of the non-fungible token. Unlike, say, a Bored Ape, which is minted and, while it can be bought or sold, its appearance remains unchanged, a dynamic NFT can do exactly what its name indicates once certain conditions are met.
In LaMelo’s case, Playground was able to create interactive NFTs that, with a click, will display various stats that are updated after each game:
Those stats are automatically communicated to the smart contract after each game, and the contract then changes the properties of the NFT based on it. That can mean an extra line on the back of the card (as seen above), a change in border color, or anything in between.
What Are Potential Obstacles Should I Know About?
Other than the literacy roadblocks that come with a lack of mainstream understanding around the finer points of the blockchain, smart contracts do come with their own risks.
For one, the technology often relies on additional, separate technologies for contracts to be executed properly. With this in mind, things can get messy. Here’s what we mean by this: Often, smart contracts depend on “oracles” — third-party programs that can aggregate and upload data — to determine when terms of the contract are met. So, what happens if there’s an error within the oracle? We could be talking about a simple human data entry error… or a more widespread file corruption.
Improper data being coded into the blockchain can be difficult to correct due to the decentralized, distributed nature of the technology. By the time an error is even first identified, the relevant contract could have already executed something both incorrect and irreversible, like a massive payment.
There’s also the potential for a nefarious actor to manipulate data to his or her advantage. Smart contracts are more book-smart than street-smart, so they may not be able to tell something is amiss the way a human could, say, identify a scam artist calling to tell you your car warranty expired.
And that’s not even getting into the legal drawbacks of smart contracts, whose jurisdiction is much more ambiguous than traditional contracts. If you go back to the example of the athlete and the store, is the store legally obligated to uphold its end of the bargain? A court might say yes, but without a written agreement and the legalese it comes with, this can get murky.