What are Smart Contracts (& How Do They Work)?

Share this article:
what are smart contracts and how do they work

Throughout 2021, ether (ETH) – the token associated with the Ethereum network – has consistently hit new all-time highs. The latest of these, on Monday, May 12th, 2021, saw ETH surpass $4,300 for the first time.

As the Ethereum network has continued to grow – and the price of ETH along with it – a number of investors have shown increased interest in Ethereum. Some have even drawn parallels between Ethereum and bitcoin, describing both as “store of value” assets.

Both of these assets do technically store value. However, there is a critical difference between the bitcoin and Ethereum networks. The difference? Smart contracts.

What are smart contracts?

Think of the last time you purchased a snack from a vending machine. You inserted your card or cash and pressed the button. After you paid and selected your snack, the machine automatically gave you what you asked for.

In this way, the vending machine is like a smart contract. Investopedia defines it as a self-executing contract with the terms between buyer and seller directly in the lines of code. Smart contract code essentially says, “if input ‘x’ occurs, then execute output ‘y.'”

Therefore, the vending machine acts as a smart contract between you (the buyer) and the snack vendor (the seller). The seller defines the conditions under which the machine releases snacks. I.e., that the buyer selects and pays, and the machine only gives out snacks if these conditions are met. When that happens, the machine automatically executes its programmed duties.

sample smart contract code
“A smart contract, like a vending machine, has logic programmed into it. Here’s a simple example of how this vending machine might look like as a smart contract.” Source: Ethereum.org

What are smart contracts used for?

On a blockchain like Ethereum, smart contract functionality spans far beyond snack food. People can use smart contracts for everything from cryptocurrency exchanges to royalty payments.

For example, in this latter case, one could program a smart contract to automatically send payments to band members every time their song plays on the radio. We could also program smart contracts to impose penalties. It can be adding a late fee when a mortgage payment hasn’t arrived on time.

How do smart contracts work?

The operating principle behind smart contracts’ computer code is quite simple – “when X happens, do Y.” Therefore, in theory, smart contracts can exist without networks like Ethereum. However, one can argue that smart contracts were not truly viable as trusted instruments (such legally binding like traditional contracts) until the advent of blockchain.

Why is this? Let’s look back at the vending machine analogy. Computer scientist Nick Szabo in the late 1990s initially conceptualized this analogy. It was more than ten years before the entity identifying itself as Satoshi Nakamoto invented blockchain. In an essay called “The Idea of Smart Contracts,” which Szabo penned in 1997, he said that smart contracts could only really work if the “breach[ing the] contract [was] expensive (if desired, sometimes prohibitively so) for the breacher.”

Instead of making contract breaching “expensive,” as Nick Szabo described, blockchain technology makes breaching smart contracts virtually impossible.

Why is blockchain technology important to smart contracts?

Because blockchain networks like Ethereum are decentralized, a hacker would need to compromise more than 50 percent of the computers used to uphold the network to make changes to a smart contract. In this way, smart contracts built on public blockchains are immutable or unchangeable.

how do smart contracts work digital vending machine
Source: Ethereum.org

Blockchain-based smart contracts are trustless and immutable

Additionally, suppose a smart contract formed between multiple known parties (i.e., a record company, a radio station, and a band). In that case, the contract could be such that making changes to it would require the approval of all involved parties.

Smart contracts can also form to facilitate interactions between two or more anonymous parties. For instance, a buyer and a seller on a cryptocurrency exchange.

Because these contracts are immutable, there is no risk that one party could bend the rules of the contract to exploit the other party. This is precisely why we can use smart contracts for things like building decentralized cryptocurrency exchanges (such as Uniswap). A smart contract will not execute transactions before the appropriate conditions have been met. Therefore, if someone is trying to underpay, the contract won’t automatically enforce the rule.

In this way, smart contracts are also trustless. As Nick Szabo explained, in other words, smart contract interactions “require little to no trust amongst the contracting parties.” In the vending machine analogy, “the vending machine has no choice but to deliver the goods upon receiving the money. The technological infrastructure of the machine is a guarantee that the contract will be fulfilled as intended.

Why is the number of transactions per second (TPS) on a smart contract-enabled blockchain important?

Ethereum isn’t the only blockchain platform that supports smart contract development. Polkadot, Solana, Terra, the Binance Smart Chain (BSC), Conflux, and many others also support smart contracts. As such, smart contract developers can use various blockchains to develop decentralized applications, or dAppsthat rely on smart contracts to function. Projects like AaveChainlink, or stablecoin USDC work thanks to them.

The number of transactions that a blockchain network is capable of processing at a time plays a vital role in dApp developers’ blockchain selection process. This is because each time a smart contract activates, it executes at least one transaction. Therefore, to keep smart contract-based dApps running smoothly, it requires a high number of transactions per second (TPS).

ethereum transactions per second
Ethereum transactions per second (TPS). Source: https://blockchair.com/Ethereum/charts/transactions-per-second

For example, Ethereum 2.0 may be capable of processing up to 100,000 transactions per second. Ethereum 1.0 – the version of the network that’s currently active – processes roughly 30 transactions per second. This low number of TPS has famously caused “traffic jams” on Ethereum. This leads to low transaction speeds and astronomically high fees.

How does smart contract functionality contribute to the value of ether (ETH) and other smart contract-enabled network tokens?

A number of analysts have claimed that Ethereum 2.0’s ability to handle such a high number of transactions per second could positively contribute to the price of ETH tokens. Similarly, analysts have noted that the adoption of other smart contract-enabled networks as the basis layer for dApp creation could increase the networks’ native tokens. Why is this?

The belief seems to stem from the fact that as more dApps appear. Thus, as dApp ecosystems grow larger – the larger the role that the network’s native token will have to play. For example, on the Ethereum network, transaction fees (“gas fees”) are always in ETH.

This is true even if the transaction involves ERC20 tokens, which are secondary tokens that someone created on the Ethereum network. Similarly, transactions on the Binance Smart Chain are always in BNB, even if the transaction involves a BSC derivative token.

Therefore, as dApp ecosystems grow, native tokens will be increasingly used. Therefore, more people will need to hold them. As more people purchase them, their prices will continue to increase. This is why some analysts predict that the price of ETH – which has already hit a number of new all-time highs in 2021 – could increase five- to ten-fold before the end of 2021.

How is the way that ETH derives its value different from the way that BTC derives its value?

In this way, the value of ETH and other smart contract-enabled network tokens can be considered representative of the size of the network’s dApp ecosystem. Therefore, smart contracts play an essential role in the development of dApps and the value of a blockchain’s native token.

This is arguably quite different from the way that a coin like bitcoin gains its value. Compared with Ethereum, the bitcoin network’s functionality is somewhat limited. At a basic level, Bitcoin’s primary technical function is its pseudonymous value transfer system.

For example, if Jane wanted to send bitcoin to Bill, she could do it without relying on a third party. She would not have to use a bank transfer network, like SWIFT, or a centralized payments service, like PayPal. The transaction could be directly processed through the network itself.

However, given bitcoin’s famous scalability problems, the bitcoin network’s functionality as a value transfer system is also quite limited. The network can only process an average of 3-4 transactions per second.

ethereum price chart until june 2021
The price of Ethereum from January 2016 until mid-2021. Source: https://coinmarketcap.com/currencies/Ethereum/

What are smart contracts good for?

Because bitcoin’s functionality has these limitations, BTC’s value primarily derives from its scarcity. Because there will only ever be 21 million bitcoins in existence, investors widely consider BTC a hedge against inflation.

The changes in monetary policy brought about by COVID-19 have caused concern of inflation for many institutional investors. Therefore, a growing number of institutions have added BTC to their balance sheets. However, as smart contract-enabled blockchains continue to grow, one could see ETH and other smart contract network tokens as increasingly attractive to institutional investors.

Coinmotion users can purchase ETH and other cryptocurrency tokens on the Coinmotion platform. To learn more, click here.

The following piece does not include any investment advice. It is worth noting that investing in any digital asset includes risks. One should carefully assess the risks before making important decisions.

Related articles
Start the discussion
Inline Feedbacks
View all comments
coinmotion logo

Not a Coinmotion user yet?
Sign-up for a free account right now!