What is a smart contract and how does it work? In this article, we will showcase the use cases of smart contracts and explain why they represent such a crucial component of the Ethereum network.
Did you know that smart contracts support the majority of today’s decentralized applications and transactions? Without them, the blockchain industry would look nothing like it does now and enthusiasts would be stuck with Bitcoin’s stone-age ‘trustless’ environment.
When there is no trust between individuals, automatized and self-executable smart contracts are there to help. In this article, we will discuss what they are, how they came into being, and how they work on Ethereum.
Note that smart contracts are nowhere near as complicated as other forms of blockchain technology. With that in mind, you can relax and enjoy learning about a fundamental part of tech that fuels modern cryptocurrencies!
What is a smart contract?
The idea of a smart contract dates back to 1994 when Nick Szabo, a famous computer scientist and crypto figure from the U.S., proposed the concept of self-executable digital contracts. At the time, Szabo described these contracts as digital transaction protocols that execute specific terms which two or more parties agree upon, just like in a traditional contract.
Szabo was definitely ambitious with what he attempted to revolutionize with smart contracts. For him, the idea would vastly extend the capabilities of electronics transaction models and significantly an innovative economy for the internet.
Almost 30 years later, smart contracts managed to reach a state beyond the computer scientist’s imagination. Today’s blockchain industry has come far thanks to this piece of technology and it would be nowhere close to its current state of efficiency if it was not for Ethereum.
Nick Szabo’s original paper proposed smart contracts for the utilization of derivatives and bonds, which we already have. Furthermore, he also predicted a number of ideas that are now present and have preceded blockchain tech. With the entrance of decentralized finance (DeFi) to the stage, the market progressed even further. But that is another story for another time.
For now, we will focus merely on their historical background and explain how they work. But before we venture further let’s concisely put smart contracts and their definition into simple terms. In essence, a smart contract is a self-executable computer program that processes predefined agreements set between two or more parties
Why do we need smart contracts?
After a ‘what’ always comes a ‘why.’ Smart contracts definitely sound cool and they certainly give off a futuristic vibe. But after learning ‘What is a smart contract’ we must understand why the blockchain industry needs them and which gap this piece of technology fills.
If you are reading about smart contracts you might probably know the essence of blockchain technology. As such, you are aware that while blockchain networks eliminate certain problems they still lack specific solutions that make cryptocurrencies viable.
Blockchain networks are distributed and decentralized, but they are also trustless. As the word implies, such a network requires no trust to process transactions. But is that really the case?
Sure, decentralized networks may deliver a trustless system by eliminating the reliance on a single centralized entity. But that does not mean that blockchains are fully trustless. In fact, they have required A LOT of trust before the advent of smart contracts. Want to read about a scenario that showcases this? Give the following story a read:
Bob trusts Alice, Alice scams Bob
Imagine that you now live in 2011 and that you have mined 20 Bitcoins. After a sudden increase in price, you are naturally interested in selling your coins. You venture into an online forum where users can set up online deals that require no third parties.
A person with the online alias of ‘Alice’ contacts you and notifies you that she is interested in buying the coins for a sum that you completely agree with. So, what is the catch?
The real case scenario is that the user who seeks to buy your coins with real cash will remain anonymous. Even if that is not the case, there is literally no legal framework that could support you if you were to get scammed. Therefore, you will encounter the very first instance in which you have to rely on trust when creating a transaction.
Alice promises you that she will send you money via PayPal or another service once she receives your coins. While it certainly sounds ‘fun’ that there is no centralized entity that will manage the deal it does not remove the fact that you are essentially trusting a stranger.
If the other party does not follow up with the deal, you are losing 20 BTC. There is no one to contact after losing your coins and there is nothing that can help you. You have relied on trust and paid the price, the end of the story.
Bob and Alice create a smart contract, both end up happy
Five years later you (Bob) are yet again interested in selling Bitcoin after seeing the market rise almost parabolically. Remembering your last encounter, you turn cautious when looking for a buyer and setting up the deal.
Converting your Bitcoin into a stablecoin based on the Ethereum network (or into ETH) you notify buyers that the transaction will be made using a smart contract. The prewritten smart contract reveals that it hosts the seller’s (Bob’s) assets and that the buyer (Alice) will only receive them once the contract confirms that Alice has transferred her money to Bob’s bank account.
Functioning similarly to an escrow contract, both parties depend not on trust but on the agreements ‘set in stone’ within a smart contract. As such, they successfully bring forth a trustless system by relying on decentralized digital contracts. Most importantly, both Bob and Alice end up happy.
Ethereum - The #1 smart contract ecosystem
As we have seen in the previous examples, it is incredibly hard to even consider using blockchain technology for transactions and payments without having the ability to rely on self-executable smart contracts.
Smart contracts retain all the basic and fundamental features of blockchain networks. Moreover, they also take a step further by providing a real trustless environment. Because of that, many consider that Ethereum introduced an important piece of technology that Bitcoin does not have. But while Ethereum may not be able to replace the Bitcoin network, it can at least support it.
Nick Szabo imagined smart contracts decades ago, but Ethereum turned them into reality only a few years ago. As an ecosystem for both smart contracts and decentralized applications, the network enables users to create, define, and execute smart contracts in a simple and easy way.
Developing smart contracts with EVM
The main tool for creating smart contracts is Ethereum’s decentralized virtual computer, the Ethereum Virtual Machine (EVM). With it, developers can build applications that host numerous smart contracts. The VM itself hosts all of the network’s smart contracts and is often called ‘the world computer’ by the community.
Via EVM, developers can create a smart contract that is defined by computer code. The EVM then executes the contract based on the rules and agreements that the developer programmed into the smart contract.
Smart contracts and gas fees
Just like everything in life, nothing is free. To perform any basic contract operation within a smart contract a developer or user has to pay fees. After all, miners are working hard to verify and process these smart contracts and they need to get paid somehow.
To support the work done by miners, smart contract creators pay transaction fees. On Ethereum fees are referred to as ‘gas fees’ and their main denomination is called ‘gwei.’ Gwei represents a small piece of Ether (ETH), the protocol’s native cryptocurrency.
With gwei/gas users essentially pay for the CPU power used by the miners who verify the contract on Ethereum’s network. While this falls into a more technical territory, have in mind that each operation inside the EVM charges different rates.
Imagine that each line of computer code costs 1 cent to perform. With 20 lines of computer code, a user would have to pay the miner 20 cents to execute the contract. Some operations might be more expensive than others but these are trifling questions in the grand scheme of how Ethereum works.
Gas fees are usually incredibly small during bearish market seasons when there is no price volatility. However, Ethereum’s lack of scalability can turn gas fees extremely high. In 2020 we had cases where traders had to pay hundreds of dollars for a simple transaction no matter how much money they were transferring.
Obviously enough, this makes the network infeasible for real-life use cases. Who would pay $100 to send $50?
Turning Ethereum scalable with a Proof of Stake Network
At a certain point, Ethereum will have such a high number of users that they will end up clogging the network - turning it useless. As previously mentioned, no one is crazy enough to pay enormous fees which force the developers to think of a way to finally turn Ethereum into a scalable and functional network.
Traditional miners will have to say goodbye to the network as the project’s leading developers have thought of a way to introduce scalability at unimaginable levels.
A future iteration of the network called Ethereum 2.0 is set to fully launch by the end of 2021. Its main mission is to help ETH shift from a Proof-of-work (PoW) network to a Proof-of-Stake (PoS) styled consensus mechanism.
PoS theoretically makes it possible for blockchain networks such as Ethereum to thrive without any scalability issues. These types of networks employ validators who verify transactions by staking assets, which essentially replaces the need for miners.
The overall design of a PoS network can retain fundamental blockchain features such as decentralization and security. Moreover, it also solves the famous blockchain trilemma by enabling scalability as well which is an important piece of the puzzle.
But as previously mentioned the concept only works in theory and we have yet to see whether PoS networks can really support high amounts of users. In the case that it works, we can expect smart contracts to reach a level at which massive widespread global adoption can take place.
It is important to note that when this does happen we have the potential to see smart contracts being used in all areas of life. Whenever two or more individuals have to agree or something, they have the possibility to use smart contracts. By doing so it is possible to bring forth decentralization into the world and make the need for centralized entities nonexistent.
When developing blockchain technology Satoshi Nakamoto left out an important piece of the puzzle that makes the use of cryptocurrencies truly viable. The Bitcoin network may be decentralized, distributed, and anonymous. However, we cannot say that it is truly a trustless network.
It would be best if individuals could agree on transactions without having to rely on a third party. But to do that they have to rely on trusting each other. Truth be told, trust simply has no place in the cryptocurrency sector as we have our own tools that make decentralization feasible.
With the advent of Ethereum and smart contracts, blockchain developers have made it possible for people to create digital contracts. These contracts represent blockchain-based lines of code that execute prewritten rules which two or more individuals agree to. For the famous ‘What is a smart contract?’ question, you now finally know the answer.
At the time of writing, there is no smart contract ecosystem greater than Ethereum. But for Ethereum to truly succeed it must dominate both inside and outside the crypto sector. In order to battle with banks and other major financial institutions, users need a scalable network that can support millions of users and requests.
So far the only project that can turn this dream into reality is Ethereum 2.0, a Proof-of-Stake-based successor that is set to launch in full-capacity by the end of the year. If the concept remains faithful, such a network will be able to cater to the masses.
Crypto Portfolio Management
Maximize Your Crypto Portfolio
Each day Shrimpy executes over 200,000 automated trades on behalf of our investor community. And joining them is easy.
After you sign up and connect your first exchange account, you’ll deploy an investment-maximizing strategy in as few as 5-minutes.
Whether you create your own strategy or follow a premium community leader, we believe the power to automate belongs in the hands of every crypto investor.
With the Ethereum 2.0 beacon chain set to go live within mere weeks, and the ETH 2.0 deposit contract already made public, all eyes have turned to ETH staking. As you probably already know, ETH 2.0 staking requires a minimum deposit of 32 ETH.
What are the best smart contract platforms in 2021 and do we really need anything besides Ethereum? Plenty of projects compete in the arena of smart contracts, yet rarely anyone claims victory. With the arrival of ETH2 and rising stars like Polkadot, understanding this special segment is now more important than ever.