What are smart contracts?
While most blockchain-related mainstream news updates still cover the highs and lows of different cryptocurrencies, smart contracts are somewhat in the background. In the world of software, however, there is no doubt that they are and will continue to be fundamental for the evolution of technology for years to come.
In this article, we’ll explain what exactly is so groundbreaking in smart contracts and what makes them so fascinating for so many different industries and public agencies.
A short history of smart contracts
Telling a story about smart contracts wouldn’t give them justice without mentioning a now 27-year old Ethereum creator, Vitalik Buterin. As a visionary programmer and a writer for cryptocurrency-oriented magazines, Vitalik had an idea for a new blockchain that was supposed to be even better, more versatile, and more successful than BTC. So in 2013, he published a whitepaper about Ethereum, a blockchain platform designed for much more than just cryptocurrency. 2 years later, after a successful crowdfunding campaign, Ethereum blockchain was born.
Ethereum was a logical extension of Bitcoin. It was set to utilize blockchain technology far beyond just a payment network but also for decentralized applications and contracts fueled by ether (ETH), the blockchain’s currency. In short, ether is both a currency and a fuel for Ethereum-based applications.
What are smart contracts, and what are they used for?
The basic concept of a smart contract is a publicly available piece of software and data written into a blockchain. It executes an action after certain conditions are met. Here are some 101 facts about smart contracts:
- Each contract has an account on the blockchain, which means it has an account balance and can process Ether transactions
- It has a status, which can be changed according to the rules written in its code. For example, it can regulate user permissions and the number of tokens they have.
- Users can communicate with a contract in order to process transactions with each other. Any user can attempt to use a contract unless, but it can be rejected under specific rules written in the contract. For example, specific user permissions of current contract status.
- Transactions can initiate a certain action in a contract, such as Ether transfer from/to contract.
- Contract actions cannot be reversed.
To sum up, a smart contract can be considered a ready-to-go agreement template for blockchain users to utilize. By communicating with a contract, the user accepts the agreement and the blockchain is responsible for processing the action.
Like any regular contract, there could be specific regulations and penalties written into the agreement, which are also automatically executed.
ETH gas, a cost of smart contracts
Processes performed by smart contracts require computational resources. Depending on its type and complexity, more or fewer resources are required. Therefore, in order to deploy or use contracts, users have to pay for “gas”, which is a unit that represents a number of calculations. Every transaction that’s processed on-chain has to pay a gas fee to node operators.
At this point, the gas price is evaluated in “gwei,” which is 0.000000001 ETH (10-9). The price is dynamically changing every minute and can jump from 50 to 70 gwei in a matter of minutes. Depending on the price of ether and current network load, a simple transaction can cost from a few cents to even $70. Of course, the more complex the transaction, the more it will cost.
So, in order to pay someone 1 ETH, you need to send 1 ETH + gas fee that is required to process the transfer. Depending on the current demand for transactions, the prices of gas can be dramatically different, so the cost of transactions and using contracts can jump by XX% week to week.
Critical characteristics of smart contracts
The way smart contracts work can solve many issues across many industries. Let’s take a look at the most significant aspects that appeal to companies, founders, and even governments.
Blockchain-based contracts don’t have to involve any other parties besides two people or two organizations. That means there’s no need to involve any brokers or agencies.
The execution of smart contracts is automated, so it can potentially save many hours of work for different people in organizations.
Automated contract completion assures that there’s no risk of human error in the process of execution. Of course, as long as the contract itself is well-written. That, however, is not that straightforward. There still are frequent hacks that indicate that very few contracts are perfect at this point despite formal verification and bug bounties.
What blockchains have smart contracts?
Ethereum was the first blockchain to implement smart contracts. Since then, several emerging blockchains have done the same. Some of them were even named (or called themselves) “Ethereum killers,” but none lived up to the name. Still, the last one on the list, Cardano, currently (22.09.2021) holds third place on Coinmarketcap.
- Binance Smart Chain
- Cardano (added smart contract capability only recently)
How to write smart contracts?
In order to explain the technicalities, we have to start with Solidity, an object-oriented programming language designed specifically for smart contracts. It was initially proposed in 2014 by one of Ethereum’s co-founders, Gavin Wood. Right now, besides several Ethereum forks and side-chains (Binance Smart Chain, Ethereum Classic, Polygon, xDAI), Solidity is available on blockchains such as Hyperledger and Rootstock.
There’s also the challenge of applying complicated legal regulations into a smart contract. In some cases, a lawyer’s assistance may be necessary to ensure that a smart contract represents and regulates what it’s supposed to.
If you’re looking for some practical tips and exercises, stay tuned. I’ve heard from a trusted source that our CTO, Krzysztof Fonał, is working on a detailed technical article on how to write smart contracts.
What industries and fields can benefit from smart contracts?
At this point, the industry that was most influenced by smart contracts is finance. This is because they allow simplifying, securing, and automating many processes. But the same can be done for much more sectors.
A fascinating example is voting. Using smart contracts, remote voting can be much easier and better protected from any fraud. A simplified system will, of course, increase vote turnover. Similar improvements can be made in the insurance industry, land registry, medical data sharing, and more.
The future of smart contracts
According to this year’s interview for Bloomberg Technology, the key reason Bitcoin appealed to Vitalik Buterin so much was that it could have an extensive and meaningful impact on how the world works. The same aspect motivated him to create Ethereum and still inspires many blockchain developers, including one of our founders, cameel, who is one of the top contributors to the Solidity compiler developed by the Ethereum Foundation.
It’s difficult to predict how exactly blockchain and smart contracts will evolve in the next few years, but the value and potential of those technologies are indisputable. As a result, more and more industries and investors will be interested in smart contract-based platforms and applications each year.
Aspects like security, lower cost, and decentralization are appealing to many industries. As a blockchain-oriented software development agency, we’re excited about what’s coming.
And maybe you have an idea for the new utilization of smart contracts? If so, we’ll be happy to discuss it with you and make it real.