Smart contracts have pretty much become an integral part of the “blockchain offering” alongside cryptocurrencies. However, we are at a weird conjuncture wherein we are either overestimating or underestimating the real capabilities of smart contracts. In this article, let’s gain a clear perspective of what they are and how they can revolutionize different industries and sectors as we move towards the future. So, how do smart contracts work? Let’s begin with the basics.
How do you define contracts in the legal world?
Traditional contracts are human-readable, agreements between two parties. The agreements stated in the contract are a set of agreed-upon terms. Usually, one party needs to fulfill some tasks for the other party in exchange for a payment. A lawyer oversees this entire contract.
As you can imagine, this third-party acts as an obvious point-of-failure in the entire agreement. The only way that either of the parties will not get short-handed is if the overseeing party does a good job. What if one of the parties manages to corrupt the lawyer? In that case, it’s not really going to be a fair transaction now, will it?
Alright, so what’s the alternative? What if we somehow managed to make these contracts programmable?
That’s what smart contracts are. They are automated, self-executing agreements between two parties. These are computer protocols that will digitally facilitate, verify, or enforce the negotiation or performance of a contract.
The best part?
Smart contracts allow two parties to directly communicate with each other without having to go through an intermediary.
Nick Szabo, one of the greatest cryptographers of all time, came up with the term “smart contracts” back in the 90’s. Back then, he explained how smart contracts work by giving the example of a vending machine. How does a standard vending machine work?
So, in the functions above, there are two things that you should note about the whole interaction:
These are the exact guiding principles of all smart contracts:
Let’s take the smart rent system to understand how smart contracts work. You have the landlord and the Tennant. These two enter into a smart contract, wherein the tenant locks up the rent, with the condition that it will only release itself to the landlord if and only if the tenant has received the copy from the landlord. The landlord can send a virtual key to the tenant. The moment the contract detects this, it unlocks the funds to the landlord. Otherwise, the contract gives back the funds to the tenant.
As you may have noticed, smart contracts work with an IF-THEN-ELSE philosophy. IF the landlord passes the key, THEN release the funds over to them, ELSE payback the tenant.
The healthcare field is notorious for its silos. Smart contracts can help remove this barrier and give different departments access to cross-institutional data. Robomed Network uses tokenization to support smart contracts between medical service providers and patients. These contracts can oversee interactions between all patients and ensure that a certain level of service is continually maintained.
Voting can improve tremendously with smart contract integration. Over the last decade, we have had so many rumors of ballot tampering. However, with smart contracts, it will be impossible to do since they are non-tamperable, by nature.
The Tennessee General Assembly took a significant step in this direction on March 8, 2018, when they officially recognized blockchain signatures and smart contracts as legally binding. Several other US states are looking to join Tennessee and expand the legality of blockchain technologies.
Smart contracts can help take your supply chains to a whole new level. Track inventories with ease, finance supply chains, and reduce theft or fraud risk. Automate reports, invoices, checklists, and releases with smart contracts. For example, Name Bazaar is integrating its peer-to-peer marketplace with smart contract technology and allows users to swap internet domains.
As we have already seen, smart contracts can allow different parties to buy, sell, or rent through smart contracts. Propy, a real estate company, has already used smart contracts to sell a $60,000 apartment in Ukraine.
For these smart contracts to work, they need the execution environment to operate in. This environment has three specific segments to it.
Now that we know what smart contracts, how they work, and their benefits, let's now look at some popular blockchain chain smart contracts platform. We will be looking into:
Ethereum pretty much paved the way for smart contract platforms. Some properties of these smart contracts are:
Gas is the lifeblood of the Ethereum ecosystem. It’s the unit amount of computational effort you will need to execute a specific operation. Think of your smart contract as your car and Ethereum gas as petrol. If you don’t fill up enough petrol, you won’t be able to finish your journey. The same logic applies to smart contracts.
Remember, Ethereum is currently running on a proof-of-work (POW) protocol. You have specialized nodes called miners who use their ASICs to solve cryptographically hard puzzles within the ecosystem. The gas limit of a contract lets the miner know as to how much of their computational power will be used in executing it.
Ethereum’s Yellowpaper gives you a rough idea of how much gas a specific instruction costs.
Specifying the gas limit properly is extremely important for the smooth functioning of your contract. You can’t set your limit too high and you can’t set it too low, either.
If your gas limit is too low, the miners will simply execute the contract until the gas limit runs out. Following that, the contract will revert to its original state, and you will still have to pay them for their services.
So, how about the other end of the spectrum? What if we set the gas limit too high? Theoretically speaking, the miners will use whatever gas they will need and then refund the rest back to you.
However, if you bloat up the gas limit, then you are going to make your contract extremely unattractive for the miners, as well. You must remember that every single block in the Ethereum blockchain is limited by a 6,700,000 gas-limit. All the components that a miner adds inside the block must be less than the block limit.
Image courtesy: Hackernoon
This is the reason why miners will not be open to the idea of inserting bloated smart contracts into their blocks.
We have covered IOTA smart contracts in detail before, which you can check out here. IOTA happens to be one of the most exciting projects in the space. Instead of a blockchain, IOTA uses a “tangle” as its underlying protocol.
IOTA smart contracts are layer-2, in nature, and act as “immutable state machines.” The IOTA smart contract has three different components – Owner, Economic and Social Incentives, and Quorums.
The smart contract owners are responsible for:
Even though IOTA transactions are feeless, the owners and validators can charge a certain fee to ensure that there is some substantial economic incentive to take care of the overall network upkeep.
The quorum has access to a unique smart contract address and contains locked IOTA tokens. IOTA uses a unique Boneh–Lynn–Shacham (BLS) signature scheme to ensure that the nodes in the quorum have uniform authority over the tokens.
Commodity Future Trading Commission
Fintech firms from around the world are opening up their eyes to the possibility of smart contract integrations. As per the Commodity Futures Trading Commission (CFTC), building Fintech smart contracts has the following benefits:
One of the most fascinating ways that fintech smart contracts and blockchain integration has changed the way international transactions work. The removal of intermediaries and the reduction of time have been revolutionary. They will have a considerable say in how fintech apps process international payments in the future - at the very least!
It will be unfair to conclude this article and not discuss some of the main issues plaguing the smart contract space:
Smart contracts will soon get integrated into every single aspect of our life. This is not an exaggeration when you consider the sheer number of use cases that are out there. This article's purpose was to introduce you to smart contracts, its underlying philosophy, and functionalities. We hope that you gained immense value and knowledge from this article about the various nuances of smart contract functionalities.
Which reminds us, do you want to drastically cut down your learning curve when it comes to smart contract training?
If yes, then enroll for our world-famous blockchain education courses at Ivan on Tech Academy. The courses have been created by industry experts and our very own in-hour trainers. Check them out! They have been carefully curated and designed to give you the most value possible.
Get to work in a fast growing industry. Start learning blockchain together with our 20,000+ students today.
Use coupon code BLOG20 for 20% off.