What is the Core Purpose of Smart Contracts?
Have you ever played on an online slot machine? If you have, or maybe just have seen it, then you’re probably quite familiar with the premise of how it works - you wager some money, and press the button to play. If the outcome of the images that appear on the screen is in your favor, you will be paid out your winnings right after.
In other words, once you initiate the slot machine, the process happens automatically, and depending on the outcome, rewards are paid out automatically, as well. This is actually exactly how smart contracts function, as well.
In this section, we’re covering smart contracts. Specifically, what smart contracts are, how they work, and what they are used for.
Let’s get right to it!
Video Explainer: What is the Core Purpose of Smart Contracts?
Reading is not your thing? Watch the "What is the Core Purpose of Smart Contracts?" video explainer
What is a Smart Contract? (Explained with Animations)
What are Smart Contracts?
Officially, Smart Contracts in crypto are a set of pre-coded rules that will initiate some actions on the blockchain without interventions from a third party. You can call it a program, or simply, a blockchain app, with its own sense of how things should work in one situation, or another. Smart contracts are built by developers and launched on blockchains to bring some logic into people's actions. Let’s just say, it makes blockchains work smarter, and in accordance to set conditions.
So - what are smart contracts in human-speak, exactly?
Well, as the name implies, they are contractual obligations for something to happen. In other words, if you make an agreement with your friend that you’ll mow their lawn if they help you with your math homework, this can be considered a contract.
Obviously, the “smart” part in the term “smart contract” is the important bit. To put it simply, it signifies that the contract will be executed automatically, without human intervention, and that once it’s set, it cannot be altered.
A close example of this idea is if you’d decide to take out a loan. You would have to settle the details with your bank, and sign a contract. Once all of the details are settled, your bank would pay out the money into your bank account.
In this situation, though, the process is performed by a human - someone checks your information, and pays out your loan, or maybe not! With a smart contract, there would be no middleman - your information would be verified automatically, according to some set criteria, and the money would be paid out without human intervention, as well.
This is one of the core purposes that smart contracts serve, in the first place - they allow for certain processes to happen automatically, without the need for a human being to intervene. Think of a coffee machine - instead of boiling the water in a kettle, adding coffee to a mug, and then filling the mug with hot water, all that you need to do is push a button on the coffee machine, and wait - the process happens automatically! And YES, now you can call your coffee machine a smart one. Smart, because it works based on some initially programmed logic with no need for third parties to be involved. The absolute same can be said about Smart Contracts.
It’s convenient, fast, and effective. However, what if you decide that you actually want tea instead of coffee, midway through the machine making your drink? You could probably just press one button, and cancel the process!
Well, this is an opposite core feature of smart contracts - once they’re in action, there’s no going back. No matter what happens, a smart contract will be executed, once it’s started.
While this does sound a bit intimidating, I assure you - this is a good thing!
The strict nature of smart contract execution means that users won’t be tricked, once the contract is in motion. Let’s go back to the coffee machine example. Imagine that you really want a cup of coffee - you set the machine to start making your favorite latte, and then go to do something else while it does the deed. However, some guy walks past the machine, notices that you’re making coffee for yourself, and decides to press the “STOP” button, simply to pull a prank on you.
You come back, and the machine is turned off, with no coffee to be made - that’s frustrating!
Now, sure - this is nothing more than a minor inconvenience. However, since smart contracts usually involve money (and lots of it!), the risks would be far more dire and noteworthy.
In other words, malicious individuals would be able to scam investors out of their funds by promising something great and then simply running away with the money. Smart contracts help potential investors avoid this by checking out the details behind them, and providing the guarantees that, once initiated, the contracts won’t be altered.
How? Unlike coffee machine logic, smart contracts are public, so anyone can check and see what exact logic is set, and when and how it will proceed after you perform one action or another. And this is definitely a transparency question! If some blockchain activities involve hundreds or thousands of people, the community will always check what will happen according to the smart contract initiated for those activities.
How Do Smart Contracts Work?
Let’s look into how smart contracts work, exactly.
Ethereum is a “smart” crypto-powered network - a decentralized (no single authority-possessing) global node of computers, if you will. On it, people are able to create various applications, including smart contracts. Bitcoins’ blockchain network, is, let’s call it - the dumb one, because of its lack of smart functionality. So, no smart contracts on a Bitcoin network.
Namely, on Ethereum, smart contracts are built with the help of Solidity - a programming language that was specifically designed for developers working with the Ethereum network. These developers receive the criteria for a smart contract (for example, “if Sam pays me $10, I will send Sam the article”), and then create it by using Solidity. Essentially, a smart contract is basically an “IF something happens, THEN do this” function.
When a smart contract is created, it needs to be deployed on the network. Once that happens, the contract becomes active, and the terms of the contract can be executed.
As I’ve mentioned earlier, smart contracts work in an automatic manner. This means that, once they’re deployed, developers won’t need to add or change anything else - if the terms of the contract are met, it will perform its intended function.
Furthermore, I would like to reiterate the fact that smart contracts are immutable - in other words, they can't be changed. This makes them secure and reliable, as long as the conditions by which they were deployed were checked and verified to be fair.
That said, you might be wondering - WHY can’t smart contracts be tampered with? Specifically, how is this ensured?
Well, this is thanks to blockchain technology. I won’t go too in-depth with the technical stuff on how that works, since it’s an entire section of its own, but in essence, in order to change the terms of a smart contract once it’s deployed, you’d need to be in command of at least 51% of the blockchain that the contract is based on - this is practically impossible.
And also if you’d like to find out more about how blockchains work, make sure to check out the section on the topic.
What Can Smart Contracts Be Used for?
So - thus far, we’ve covered what smart contracts are, and also how they perform the processes that they do. As a final point, let’s take a look at some examples of what these pieces of technology can be used for.
For starters, let’s say that you’re a farmer who wants to insure their crops, in case there’s a drought this year. The insurance company uses a smart contract for your insurance, with these terms:
“If the air temperature between the months A and B is above 90 degrees Fahrenheit for at least C amount of days, consecutively, pay out the farmer X amount of money.”
The insurance company would then make the smart contract track the local weather news platforms that have high reliability. Thus, the entire process would be automatized - if there was a drought that year, you would automatically receive your insurance payout!
And what's most important is that nobody ever will change the rules you, as the farmer, agreed to.
Here’s another example - imagine that you want to receive a yearly bonus in your job, and are trying to negotiate it with your boss. Your boss lays down the requirements that you need to meet in order to receive that bonus and gives you a deadline. He also creates a smart contract that states:
“If A performs B, C, and D tasks until December 31st, 2022, A receives a bonus of X amount of money.”
In a situation like this, you know that you will DEFINITELY receive the bonus, if you meet all of the requirements by the end of the year - after all, once the smart contract is created, there’s no turning back! And your crazy boss will never change his opinion just because of bad weather!
These are just a couple of examples that illustrate the potential of smart contract technology. Truth be told, the opportunities for smart contract application are vast - this technology can be incorporated into a huge variety of different areas, and, frankly, smart contracts are making their way into the mainstream, as we speak!
So, in this section, we’ve covered all of the essential information that you need to know about smart contracts - what they are, how they work, and the variety of different ways of how we can use them. If you would like to learn about various crypto topics - check out our section about NFTs.