How Do Ethereum Smart Contracts Work? It's Deceptively Simple (2024)

Ethereum didn’t invent the smart contract — Nick Szabo proposed the concept way back in 1995. But it’s probably not overstating matters to say that Ethereum brought the smart contract to life.

In fact, blockchain and smart contracts predate Ethereum, but in many ways Ethereum transformed both. Ethereum started with blockchains’ distributed ledger concept and built on it, dramatically expanding it to allow for more advanced commands than, say, Bitcoin.

This creates the opportunity for all manner of potential applications.

And although other blockchain platforms, including Bitcoin, can execute smart contracts, Ethereum was created specifically for that purpose. While Bitcoin is a peer-to-peer system used to track ownership of a digital currency, Ethereum is a peer-to-peer system used to keep track of changes to a decentralized database. This is what makes smart contracts possible.

You probably know what a smart contract is, but let’s start at the beginning, anyway.

Smart Contract Basics

Smart contracts are computer programs that act only after specific conditions are met. Put another way, it’s a protocol that executes the terms of a contract. Like a traditional contract, a smart contract defines the provisions and penalties around an agreement.

Unlike traditional contracts, a smart contract automatically executes those obligations, often through an escrow-like account. Also unlike a traditional contract, once the terms of a smart contract are recorded on the blockchain, they cannot be altered.

So what does this mean? Smart contracts allow parties –who can remain anonymous – to enter into a binding, transparent agreement with each other. Value can be transferred between parties or held in escrow inside the smart contract itself.

How Do Ethereum Smart Contracts Work? It's Deceptively Simple (1)

Now, let’s go a little deeper.

Creating Smart Contracts

Ethereum provides a decentralized virtual computer — the Ethereum Virtual Machine (EVM) — on which developers can build applications consisting of multiple smart contracts. Think of the EVM as a distributed global computer where all smart contracts are executed. (Ethereum is sometimes referred to as a “world computer.”)

Ethereum lets developers program their own smart contracts to define EVM instructions. The EVM executes a contract according to the rules the developer programmed.

Kunal Shah makes it sound a little less dry in thisHacker Noonpiece. “Smart contracts live in the form of bytecode within the decentralized database. This is the root of the innovation and disruptive potential of Ethereum.”

Contracts are written in Solidity, a Javascript-like language developed specifically for writing smart contracts. (We’ve been playing around with Solidity; you can read more about it here.)

Want an explanation from the source? Here’s how the Ethereum white paper explains it:

The intent of Ethereum is to create an alternative protocol for building decentralized applications, providing a different set of tradeoffs that we believe will be very useful for a large class of decentralized applications […] Ethereum does this by building what is essentially the ultimate abstract foundational layer: a blockchain with a built-in Turing-complete programming language, allowing anyone to write smart contracts and decentralized applications where they can create their own arbitrary rules for ownership, transaction formats and state transition functions.”

(If you need help explaining this concept, we recommend having your colleagues read “How to Explain Smart Contracts to Your Mom.” )

Paying with Gas

Whenever smart contract transactions occur within the Ethereum blockchain, it takes computational power to validate them across the network. To compensate for the time and energy it takes to perform those computations, transactions require a fee in the form of “gas” which is paid with ETH (define ETH). The amount of gas depends on the amount of computation required to complete the transaction. This gives developers an incentive to create simple and efficient smart contracts. Moreover, the gas limit — the maximum amount of gas allotted to a particular transaction —means buggy code won’t run indefinitely, costing an infinite amount of gas. (Unspent gas is automatically refunded, but if the transaction runs out of gas, it’s aborted and no gas is refunded.)

Online Casinos as a Use Case

Perhaps not surprisingly, online gaming offers an elegant example of how Ethereum smart contracts work in real life — and illustratesthe crucial role of trust. Because smart contracts police themselves, they essentially create trust: A smart contract’s code is transparent and immutable.

So, for our example, smart contracts allow users to publicly verify that a slot game’s historical data is fair and true, explains eth.casino, viaMalta Today: “This is because it is literally impossible for an online casino to alter or change the displayed payout ratio, as this process is cryptographically secure.”

That covers the trust. The automated contract execution(if A, then B) also makes it attractive.

“For example, if a roulette player gambles with Ethereum on red (the ‘if’), and the roulette wheel subsequently lands on red, then the smart contract is programmed to automatically return the winnings to the player’s private wallet (the ‘then’). This principle could be applied to absolutely anything in the online gambling sector, from fixed-odds sports, peer-to-peer wagering, to heads or tails. An online casino that can operate in an automated, transparent and secure manner has the ability to earn instant credibility from the gambling community.”

Numerous Ethereum-based gaming sites are up and running, but there are plenty of other applications that deploy Ethereum smart contracts.

Other Ethereum Applications

Developers can use Ethereum to build decentralized apps (dApps) that take advantage of Ethereums’ smart contract technology. Most dApps are built on Ethereums’ blockchain.

The Ethereum white paper outlines three categories of applications:

  • Financial applications, providing users with more powerful ways of managing and entering into contracts using their money
  • Semi-financial applications, where money is involved but there is also a heavy non-monetary side to what is being done (e.g., self-enforcing bounties for solutions to computational problems)
  • Non-financial applications, such as online voting and decentralized governance.

Because Ethereum makes it possible to decentralize any service, the potential applications are almost endless; among them, insurance, retail, microfinance, gaming, virtual worlds, currency exchange, identity-theft protection, financial derivatives, breach contracts, property law, credit enforcement, financial services, legal processes, crowdfunding, voting systems, title registries, and thousands of others.

Here are a handful of examples:

Insurance. French insurance company AXA is testing fizzy, flight-delay insurance. Buy the insurance and if your flight is delayed by the agreed-upon amount of time, you get paid.

Prediction markets. Gnosis and Augur are decentralized predictions platforms. Developers can create a prediction market for any event, such as the Super Bowl or an art auction. People can buy shares in an outcome, and the payout is automatic.

Intellectual property rights. Kodak (yes, that Kodak) is building a digital-rights management platform for photographs. Photographers will register their photos on the KodakOne platform and buyers will purchase rights using the KodakCoin. KodackOne will monitor the web for violations, and promises to “efficiently manage the post-licensing process to reward photographers.” (This isn’t quite up and running yet: The IPO is scheduled to launch Jan. 31.)

Computer power. The Golem Project is a sharing economy —like Airbnb, but for computing power. Individuals can rent out their unused computing power, or they can buy more power from other users.

This list barely touches on the potential of Ethereum smart contracts. As IBM explains it, ”As the contract is just code, the application is only limited by the developer’s imagination.”

Scalability is a Pain Point

Ethereum isn’t the only blockchain technology to support smart contracts. You can build smart contracts onHyperledger Fabricusing chaincode.

Some observers are completely sold. Sudhir Khatwanim for instance, wrote. “Just like the invention of the Internet has transformed human life, the Ethereum blockchain and smart contracts have the power to change human life in incredible ways.”

We’re quite not there yet, but things are moving rapidly. In December, the price of Ether topped $600 for the first time after the announcement that Swiss banking giant UBS would lead an Ethereum-based blockchain platform.

“The news that Ethereum is being used as a base identity layer in conjunction with some of the larger banking giants out there is a positive ratification of the technology,” Charles Hayter, chief executive of digital currency comparison site Crypto Compare, told CNBC.

But, beware of irrational exuberance. Issues abound, most notably, scalability.

Ethereum remains relatively slow at processing transactions. We’ve mentioned this before, and it remains an issue. In fact, it’s even addressed in Ethereums’ white paper:

“One common concern about Ethereum is the issue of scalability. Like Bitcoin, Ethereum suffers from the flaw that every transaction needs to be processed by every node in the network. With Bitcoin, the size of the current blockchain rests at about 15 GB, growing by about 1 MB per hour. If the Bitcoin network were to process Visa’s 2000 transactions per second, it would grow by 1 MB per three seconds (1 GB per hour, 8 TB per year). Ethereum is likely to suffer a similar growth pattern, worsened by the fact that there will be many applications on top of the Ethereum blockchain instead of just a currency as is the case with Bitcoin, but ameliorated by the fact that Ethereum full nodes need to store just the state instead of the entire blockchain history.”

The problem itself is simple and, as the white paper alludes, it’s a blockchain issue, not merely an Ethereum one: Decentralization makes scalability a challenge. Each smart contract and transaction executed on the network must be processed across all the nodes. As if anyone needed a reminder, theCryptokitties slowdowncertainly highlighted the scalability issues.

Developers, of course, are working to address this. In fact, in a Jan. 2, 2018, blog post, Ethereum founder Vitalik Buterin explained that it’s become even more critical to speed transaction times. “With the Ethereum blockchain reaching 1 million transactions per day, and both Ethereum and other blockchain projects frequently reaching their full transaction capacity, the need for scaling progress is becoming more and more clear and urgent.”

He announced that the Ethereum Foundation is redoubling its efforts and plans to collaborate with independent developers to improve Ethereums’ scalability.

Speed and scalability aren’t the only issues. Remember, Ethereum smart contracts are still very young —and they are not yet legally binding.

Nigel Montgomery, research director at Gartner, is optimistic about Ethereum, but for now, he has a rather dire warning for business: “Today the technology is immature and mercurial, and once live, the outcome is irrevocable. Smart contracts are something CIOs should invoke at their peril.”

We don’t completely agree: It all depends on the use case. The challenge is knowing when it makes sense for your business and when it doesn’t. That same theory applies to selecting a blockchain platform. Ethereum may be a perfect fit for your organization, but perhaps Fabric is. Or maybe something else.

How Do Ethereum Smart Contracts Work? It's Deceptively Simple (2024)

FAQs

How Do Ethereum Smart Contracts Work? It's Deceptively Simple? ›

Think of the EVM as a distributed global computer where all smart contracts are executed. (Ethereum is sometimes referred to as a “world computer.”) Ethereum lets developers program their own smart contracts to define EVM instructions. The EVM executes a contract according to the rules the developer programmed.

How does the Ethereum smart contract work? ›

In fact, a smart contract is a computer program stored on a blockchain. Smart contracts are self-executing pieces of code that execute when the preset conditions by the involved parties are met; for example, a smart contract that issues a token when someone deposits fiat.

How does Ethereum work for dummies? ›

Ethereum is a decentralized blockchain and development platform. It allows developers to build and deploy applications and smart contracts. Ethereum utilizes its native cryptocurrency, ether (ETH), for transactions and incentivizes network participants through proof-of-stake (PoS) validation.

What is a smart contract for dummies? ›

Smart contracts are digital contracts stored on a blockchain that are automatically executed when predetermined terms and conditions are met.

How does EVM work in Ethereum? ›

EVM interacts with the Ethereum network through nodes, which validate transactions and contribute to its Proof of Stake consensus mechanism. Nodes execute smart contracts and store the entire transaction history, contributing to the decentralized and trustless nature of the blockchain.

What is smart contract in simple words? ›

A smart contract is defined as a digital agreement that is signed and stored on a blockchain network, which executes automatically when the contract's terms and conditions (T&C) are met. The T&C is written in blockchain-specific programming languages such as Solidity.

How much ETH is locked in smart contracts? ›

Over 37% Of All ETH Is Locked In Smart Contracts: Will Ethereum Prices Roar Above $4,000? -

What is a real example of smart contract? ›

Examples of smart contract applications include financial purposes like trading, investing, lending, and borrowing. They can be used for applications in gaming, healthcare, and real estate; and they can even be used to configure entire corporate structures.

What is the point of a smart contract? ›

On blockchain, the goal of a smart contract is to simplify business and trade between both anonymous and identified parties, sometimes without the need for a middleman. A smart contract scales down on formality and costs associated with traditional methods, without compromising on authenticity and credibility.

What is an example of a smart contract in real time? ›

A smart contract is a self-executing program based on if-then logic. Vending machines provide a good analogy. If someone inserts $2 and presses B4, then the machine dispenses the cookies in the B4 slot. In other words, if the vending machine receives the required item of value, then it performs the requested action.

What is the difference between EVM and Ethereum? ›

The Ethereum Virtual Machine or EVM is a piece of software that executes smart contracts and computes the state of the Ethereum network after each new block is added to the chain. The EVM sits on top of Ethereum's hardware and node network layer.

What really powers the Ethereum virtual machine? ›

What Powers the Ethereum Virtual Machine? The EVM is powered by the collective computing resources of the Ethereum network. It operates on a decentralized network of nodes, which are essentially individual computers or servers run by Ethereum participants.

Why is it difficult to use EVM? ›

Implementing EVM requires careful planning and a structured approach. Project managers often find it challenging to set up the necessary systems and processes to collect accurate data for EVM calculations.

How much does it cost to run a smart contract on Ethereum? ›

Smart contract creation cost can be anywhere from $10 to $2,000 assuming Ether costs between $1,500 to $2,000. The biggest factors are 1) Ethereum price, 2) the size of the compiled contract (in bytes), 3) the current gas price on the Ethereum network.

What is the difference between Ethereum transaction and smart contract? ›

Transaction is the way the external world interacting with the Ethereum network. Transaction is used when we wish to modify or update the state stored in the Ethereum network. A smart contract is a software program that adds layers of information onto digital transactions being executed on a blockchain.

Are Ethereum smart contracts legally binding? ›

In general, smart contracts are enforceable as long as they follow the basic rules of contractual agreements. These include the following. As with any agreement, there must be an offer, an acceptance of that offer and consideration. Put simply, these are defined thusly.

Top Articles
Trading the 1-2-3 Reversal Pattern Setup - Forex Training Group
What Does Ecpm Mean and How to Calculate it? - SmartyAds
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 5612

Rating: 4.8 / 5 (68 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.