How Ethereum and Smart Contracts Work

       

NFTs are now drawing attention around the world, with a tweet by Twitter's founder and pieces of digital art fetching hundreds of millions or even billions of yen. Most NFT trading takes place on Ethereum. This article explains the basics of Ethereum and its defining feature, smart contracts.


What is Ethereum?

Because "Ethereum" is often used in phrases like "the second-largest coin by market cap after Bitcoin," some people may think of it as a type of cryptocurrency.

In Japan, the name "Ethereum" is often used for the cryptocurrency as well, so this isn't wrong. Strictly speaking, however, Ethereum is a platform that provides an environment for developing and building applications, such as games, using blockchain.

Applications developed on Ethereum are called "decentralized applications," which have different characteristics from conventional applications. We explain these later.

"Platform" is a somewhat abstract term, but it means a foundation for developing and running services, systems, software and so on. For example, an OS such as Windows is a platform for using software and systems. Social networks such as Twitter and Facebook (SNS, social networking services) are also platforms that provide a place for users to interact.

So how does Ethereum's blockchain, known as a platform-type blockchain, differ from Bitcoin's blockchain?


The Ethereum blockchain

In 2009, Bitcoin, the world's first cryptocurrency, went into operation. Conventional currencies need a central managing institution, such as the Bank of Japan for the Japanese yen, but Bitcoin has no central administrator. It can prevent fraud and tampering without a central administrator thanks to a new technology called blockchain, a distributed transaction ledger.

Bitcoin's blockchain records currency transaction information such as "when, who paid whom, and how much." Because the Bitcoin blockchain exists to run Bitcoin, it is specialized for cryptocurrency and optimized for storing and exchanging value.

In contrast, general-purpose blockchains such as Ethereum were developed so they could also be used for purposes other than cryptocurrency.

While the Bitcoin blockchain can record only transaction information, the Ethereum blockchain can record application programs in addition to transaction information. This made it possible to implement "smart contracts," the defining feature of the Ethereum blockchain.


What are smart contracts?

A smart contract means something like "automated contract": a mechanism that executes a contract automatically by programming its terms and execution conditions on the blockchain in advance. Smart contracts are the defining feature of the Ethereum blockchain.

The idea of smart contracts is not unique to blockchain. It was proposed in the 1990s, before blockchain appeared, by computer scientist and cryptographer Nick Szabo. One of the earliest examples of a smart contract that Szabo cites is the vending machine: when the condition is met — the buyer inserts enough money and presses a button — the contract to sell the item is executed automatically.

On Ethereum, smart contracts are implemented by writing source code in programming languages such as Solidity and Vyper.

As development tools and support continue to grow, smart contract development is likely to become more efficient, making it easier for many people to get involved.

What are smart contracts?

Advantages of smart contracts

In ordinary transactions, mutual trust is important, and ensuring it requires bringing in a third party or signing a written contract. With smart contracts, the contract executes automatically once the conditions are met, so parties can transact even without a relationship of trust.

As a result, no third-party intermediary is needed and the parties can deal with each other directly, which cuts the costs that would otherwise be paid to intermediaries and shortens the time a transaction takes.

Transaction details are recorded on the blockchain and made public, which keeps transactions transparent. And because a blockchain cannot be rewritten, records cannot easily be tampered with, which also helps prevent breaches of contract.


Use cases of smart contracts

Because of these advantages, smart contracts are being adopted, or trialed, in many industries.

DeFi

DeFi (Decentralized Finance) is an ecosystem of financial services built on the blockchain; in Japanese it is translated as "bunsangata kinyu" (decentralized finance).

Conventional financial systems require central administrators and intermediaries such as banks and securities firms, but DeFi executes transactions using smart contracts, so no central administrator or intermediary is needed. This saves time and cuts costs, and anyone can access it directly and take part in transactions.

Etherisc

Etherisc is a decentralized insurance platform that uses smart contracts.

Smart contracts automate the claims payment process that used to be handled by people, so insurers can cut labor costs and users pay lower fees. Decisions on whether a claim is payable are also made automatically, which helps prevent disputes over insurance contracts.

REX

REX is a real estate transaction service that uses smart contracts. In real estate transactions too, removing intermediaries brings the benefits of lower costs and shorter timelines.

Augur

Augur is a gambling platform.

Because it uses smart contracts, there is no operator (bookmaker), so users can get high payout rates. There is also no need to worry about fraud such as the operator manipulating odds or embezzling stakes.

Ujo Music

In the entertainment industry, including music, many intermediaries stand between a work an artist creates and the users who receive it, and the income that actually reaches the artist is often only a small fraction of sales.

Ujo Music is a music download service on Ethereum that built a platform on the blockchain to connect artists and users directly. Using smart contracts removes the need for intermediaries, and the money users pay for songs goes straight to the artists. Another advantage is that intellectual property rights such as copyrights, whose handling has long been criticized as opaque, can be made clear.

CryptoKitties

CryptoKitties is a blockchain game in which you raise and breed digital cats to create highly original cats. A rare cat turned into an NFT traded for ¥19 million, and the game helped spark the NFT boom.

Smart contracts are used for the genetic algorithm that determines breeding, so the cats born are random. Smart contracts are also used for buying and selling cats, so players can trade directly with one another.

These are already in practical use.

Efforts are also under way in many industries to expand the use of smart contracts into various fields.

Buying and selling electricity

Until now, the only option for surplus power from home generators was to sell it to a power company, but major power companies and others have begun pilot programs for trading electricity over P2P networks using blockchain. If this P2P electricity trading becomes practical, people who want to sell electricity and people who want to buy it will be able to trade directly. Trades will execute automatically through smart contracts once the conditions are met.

P2P electricity trading is anticipated not only because it benefits both consumers and suppliers of electricity, but also because it can provide power in emergencies such as disasters.

The sharing economy

The sharing economy is a natural fit for blockchain and smart contracts, which are expected to be built into its services going forward.

For example, private lodging rentals face problems such as lost keys, which electronic locks can reduce. An electronic lock key is sent to the guest's smartphone, and the fee is charged to their credit card when the stay ends. Because this entire flow runs automatically through smart contracts, private lodging stays should go more smoothly.


What are decentralized applications (DApps)?

Decentralized applications are applications on the blockchain that build on smart contracts to handle more complex processing.

Conventional apps (centralized applications) have a central administrator and run and manage the app on a single server, so if the server fails, the app's service stops.

In contrast, decentralized apps have no central administrator and are managed jointly by participants. Because servers are spread across the entire network, even if one server goes down, the app as a whole does not stop.

And because they use blockchain, the risk of fraud such as data tampering is very low.

Examples of decentralized apps include games such as CryptoKitties, mentioned above. Unlike conventional games, they can create an economy inside the game world, so characters you raise and items you collect in the game can be bought and sold. Because the game is on the blockchain, trades such as purchases and sales are carried out fairly.

Besides games, decentralized apps such as decentralized exchanges and prediction markets are in practical use.

What are DApps?

Disadvantages of smart contracts

Smart contracts are expected to be used in many industries, but they also have disadvantages.

Vulnerabilities

Because of the nature of blockchain, once a contract has executed, its terms cannot be changed. Even if the program contains mistakes or bugs, they cannot be fixed. If a bug is critical, malicious hackers may exploit the vulnerability.

Legal issues

Transactions such as purchases and sales via smart contracts are legal acts, but caution is needed because laws have not yet fully caught up with new mechanisms such as automated contracts.

The scalability problem

Scalability refers to the ability to handle growth in users and processing. The more people use smart contracts, the more transactions there are, so processing takes longer and the speed that should be a strength of smart contracts may be lost. And if fees rise as users increase, smart contracts may become harder to use.

It is hoped that these issues will be solved through technological innovation and other means.


About the cryptocurrency Ether

Ether (ETH) is Ethereum's native currency (the currency specific to that blockchain). As mentioned above, in Japan Ether is also called "Ethereum." Ether is used to pay the fees incurred when executing smart contracts or using applications on Ethereum. Transaction fees on Ethereum are called "gas fees (Gas)."

As with Bitcoin, new Ether is issued through mining, which uses a method called "Proof of Work (PoW)." In a P2P network without a central administrator, like Bitcoin or Ethereum, participants need rules for agreeing on whether data is correct (a consensus algorithm). PoW is one of these: the miner who first finds a nonce that makes the block's hash value meet certain conditions is granted the right to create the new block and is paid a reward.

PoW has advantages such as strong resistance to fraud, but winning the race to find the nonce first requires high-spec computers. Its disadvantages include domination by a few companies running so-called "mining factories" and concerns about the environmental burden of mining's enormous power consumption.

For this reason, Ethereum's next update (Serenity) is scheduled to move from PoW to "Proof of Stake (PoS)," which determines which validators receive rewards based on how many coins they hold and for how long.

Unlike Bitcoin, Ether has no issuance cap or halving to maintain scarcity.


The history of Ethereum

Let's trace Ethereum from its birth to the present.

The birth of Ethereum

Ethereum was conceived in 2013 by Vitalik Buterin of Canada, who was 19 at the time. In a white paper, Buterin stated that the purpose of the Ethereum project was to build a platform for developing decentralized applications using blockchain. The Ethereum Foundation was established the following year, in 2014.

Ethereum's ICO

An ICO (Initial Coin Offering), also called a "token sale," is the issuance of a proprietary token (cryptocurrency) to raise funds. It is a fundraising method similar to an initial public offering of stock.

Ethereum's ICO was held in 2014, and newly issued Ether was exchanged for Bitcoin worth about ¥1.8 billion.

The development of Ethereum

Ethereum's development has been led by the Ethereum Foundation. Development is divided into 4 stages, and each update has a code name: "Frontier," "Homestead," "Metropolis" and "Serenity."

The Frontier update

After a pre-public release on the Ropsten test network in May 2015, Ethereum with the Frontier update was released to the general internet on July 30, 2015. At the Frontier stage, Ethereum was still experimental and its specifications were aimed at developers; nothing was recorded on the blockchain, so that things could be redone and fixed if problems were found.

The Homestead update

The Homestead update came in March 2016, fixing bugs found in Frontier. Whereas Frontier was for developers, Homestead began recording to the blockchain, and Ethereum as a platform launched in earnest. In response, many developers joined the project and new technologies and programs were added. On the other hand, gas fees for using smart contracts and other features went up.

The DAO's ICO

The DAO's ICO took place in April 2016. The DAO (Decentralized Autonomous Organization) was a project aiming to build a decentralized investment fund on Ethereum. Unlike conventional investment funds, a decentralized investment fund has no central administrator and is a new kind of fund that decides its investments through a democratic voting process. This ICO raised one-tenth of the Ether issued at the time — about $132.32 million.

The DAO incident

The DAO drew investor attention as a new kind of investment fund, but on June 17, 2016, a malicious hacker exploited a vulnerability in the system and stole about $80 million — roughly one-third of the total funds — through unauthorized transfers.

Because of how The DAO worked, transferred funds could not be withdrawn for 28 days, including by the hacker who made the unauthorized transfer, so the theft had to be dealt with within that period.

After a vote, the Ethereum community decided by a large majority of over 90% to carry out a "hard fork." A hard fork is an incompatible update that permanently splits off from the previous chain. Major updates such as Frontier and Homestead are also carried out through hard forks. In The DAO incident, a hard fork split the blockchain back at a past block, undoing the hacker's unauthorized transfer and making the victims whole.

On the other hand, some people questioned using a hard fork to rewrite the past on a blockchain, where past records are supposed to be impossible to alter.

The group opposed to the hard fork chose to keep using the pre-split chain with the fraudulent transactions as "Ethereum Classic" (cryptocurrency ETC), and so Ethereum split in two.

The DAO incident

The Metropolis update

The Metropolis update was carried out in two stages: Byzantium in October 2017 and Constantinople in March 2019.

The Constantinople update was scheduled for January 2019 but was postponed after a vulnerability was found, and it was rolled out together with "St. Petersburg," which neutralized the vulnerability.

One of the key changes in Metropolis was the introduction of "zero-knowledge proofs (zk-SNARKs)." Zero-knowledge proofs are a technology that can prove a transaction is valid without disclosing private information, improving both privacy protection and security.

In preparation for the move to Serenity, mining difficulty was also lowered. This shortened block creation time and improved processing speed.

Because easier block creation and faster processing would increase the number of blocks mined — and with it mining rewards — the mining reward amount was reduced at the same time to compensate.

The Serenity update (Ethereum 2.0)

Serenity, Ethereum's final update, began in December 2020. Serenity is carried out in 4 stages: "Phase 0," "Phase 1.0," "Phase 1.5" and "Phase 2." Serenity, called Ethereum 2.0, runs temporarily on a chain separate from the existing Ethereum 1.x, and the two are scheduled to be merged eventually.

Development of the current Ethereum 1.x has also continued, with major updates "Istanbul" in December 2019, "Muir Glacier" in January 2020 and "Berlin" in April 2021.