What are Ethereum Smart Contracts & How Do They Work?

The Ethereum protocol is a platform to build decentralized applications, known as smart contracts. Find out how they work with real-world examples.

The Ethereum protocol is a platform designed to facilitate the development of decentralized applications. They are decentralized in the sense that no external third-party or centralized authorities can intervene with their ongoing operations.

The applications built on top of the Ethereum blockchain are protected from censorship, fraud, third-party intervention, and have no downtime. It is a self-governing global infrastructure which is capable of moving value around frictionlessly, in a way that was not possible before.

Another classic way to think about Ethereum is that it is a global computer that is always on and anyone can use it at any time for any purpose by paying a small fee.

Ether (also known as ETH) is the internal cryptocurrency for Ethereum and is used to pay for computation time on the  Ethereum network. The ETH price fluctuates depending on the market supply and demand.

Ethereum Network

The traditional consensus model for the Ethereum network has been ‘Proof of Work’ and miners participating in it secure the network through a process called mining. Mining is how transactions are verified on the network, and new Ether is brought into the Ethereum crypto economy. However, with the current transition to the ‘Proof of Stake’ model, things could change drastically, but this remains to be seen.

Smart Contracts

Nick Szabo had initially coined the term Smart Contracts to describe a computer protocol that could help facilitate, verify, or enforce any contractual agreement between two or more parties. Smart contracts would improve the execution of the four primary contract objectives, which Szabo described as observability, verifiability, privity, and enforceability.

Smart Contract – Powered by Ethereum – Source: Shutterstock.com

Ethereum took this concept of smart contracts to a more practical stance and incorporated it with a Turing complete programming language (Solidity) that is now used to write practical smart contract applications within the Ethereum blockchain. Thus, smart contracts have become an integral component of the Ethereum ecosystem.

Technically, smart contracts are internally owned accounts within the Ethereum blockchain that encompasses a set of instructions in the form of code. When executed or activated, these contracts perform their contractual obligation as intended. Any agreement could be developed with the help of smart contracts, ranging from two to multiple-party agreements.

Ethereum Smart Contracts

Smart contracts can be compared to the operations of a vending machine, which are programmed in such a way that after a user selects and pays for an item, it will be dispensed accordingly.

To activate a smart contract, a user needs to spend a certain amount of ether in the form of GAS (which is a minimal amount of ether) through his/her crypto account.  It should be noted that smart contracts are usually small programs with a set of computer instructions. A 500 line long code base for a smart contract would be considered large.

How do Smart Contracts Work?

Ethereum might have become the de facto choice for smart contracts, but in fact, it was Bitcoin which first supported the basic principles of smart contracts as we know them today. Essentially, original smart contracts ran on the basis that all nodes in a network will only validate a transaction once pre-set conditions have been met by both transacting parties. 

How do Smart Contracts Work?

The original smart contracts on the Bitcoin network were effective but restricted to a handful of use cases. Instead, in Ethereum, developers can write code to encompass virtually any set of parameters in a smart contract, which the Ethereum whitepaper calls an ‘autonomous agent.’ 

Use cases of these Turing-complete smart contracts include the representation of physical contracts on the blockchain, for instance, the sale of real estate and subsequent transfer of deeds upon payment; or in a widely used example, signing off on multi-signature wallet transactions. 

To compute and execute these smart contracts, the Ethereum chain will run the smart contract code when a user initiates part of the contract condition – called ‘interacting’ with the contract –  provided they have enough transaction fees in the form of ETH. 

Ethereum Virtual Machine

For particularly complex smart contracts, interacting with the contract might require a higher ETH fee. This is because they will take comparatively longer to compute and process on the Ethereum network. Here, there is an important trade-off to be made between traditional paper-based contracts and blockchain-based smart contracts.

Once the ETH fee is covered, Ethereum’s Virtual Machine will then check the conditions of the contract have been met, and if so, execute the contract on the blockchain via ‘bytecode,’ binary code which is read and executed by the Ethereum network. Once all conditions have been met, and the contract executed, the details of the transaction are validated and stored immutably on the Ethereum blockchain.

Promising Smart Contract-Based Applications

Even though Ethereum has been around for ~3 years, it has taken the world by surprise with its endless possibilities of decentralized applications. Hence, a lot of projects have been developed using the Ethereum protocol over the last year. The protocol also allows for a new form of fundraising known as the ICO, where utility tokens related to a particular platform are sold to early adopters.

Recent ICOs have raised anywhere between 10 – 200 million USD within hours. As a result of this global participation, the cryptocurrency market has reached a market cap of  ~150 billion in less than a decade. Thought leaders within the industry have compared crypto boom to the dot-com era. There are numerous projects in the crypto industry, but some of them hold more promise than the rest.

OmiseGO

OmiseGO is a financial-based technology built on top of the Ethereum blockchain that intends to provide financial inclusion for everyone. As of today, a lot of people across the globe still have no access to financial networks and banking services.

OmiseGO Homepage

OmiseGO aims to solve that problem by proving a decentralized financial service platform where users don’t need to own bank accounts and can conduct instant, low-cost settlements.

Through the OmiseGO network, anyone can conduct financial transactions such as payments, remittances, payroll deposit, B2B commerce, supply-chain finance, loyalty programs, asset management and trading, and other on-demand services. The network is intrinsically agnostic for fiat as well as for cryptocurrencies and has a mechanism for fiat token custody.

Kyber Network

Kyber Network is another protocol that is built entirely using Ethereum smart contracts which allows exchange and conversion of digital assets with instant liquidity. A solution that neither centralized or decentralized exchanges have been able to offer.

Kyber Network Homepage

The network is compatible with various crypto tokens, and users can convert and exchange any token anytime as desired. As the protocol is decentralized in nature and doesn’t store any of the user’s funds, there is no security risk of digital assets being stolen or hacked. Furthermore, users can mitigate price fluctuations through derivative trading and hedging through the network itself.

Conclusion

As this new crypto industry forges, the right information is the key to stay ahead. The frontier is still unknown, and a lot of exciting developments are taking place every day. Newcomers face a steep learning curve, but like anything else, constant learning and sharing the right knowledge is critical to be on top. Stay ahead – learn, share, collaborate, and prosper!

References

Follow us on Telegram | Twitter | Facebook

Featured Images are from Shutterstock.

Blokt is a leading independent cryptocurrency news outlet that maintains the highest possible professional and ethical journalistic standards.