Ethereum and Smart Contracts


If you’re watching cryptocurrency news, you’ve probably heard about Ethereum and the phrase “smart contract”. You may even know that Ethereum is the original smart contract platform but do you know what a smart contract is or how it works? If not, we’re here to help.

What is a Smart Contract?

If you’ve listened to talk about blockchain and cryptocurrencies, the words “smart contract” may have up come up. But what is a smart contract? How does it work? What does it do? How is it related to Ethereum?

What is a smart contract

Bitcoin is the original cryptocurrency and was designed for one purpose: to allow users to send and receive value (i.e. money) in the form of Bitcoin. Since people believe that Bitcoin has value and are willing to give fiat money (USD, Euros, etc.) for Bitcoin and vice versa, the system works.

Ethereum is based on the concept that using the blockchain only for financial transactions is a waste of potential. Blockchain is decentralized, meaning that companies can easily outsource computation and hosting for their products. Payment for outsourcing is built into the cryptocurrency environment, just pay the hosting nodes in crypto when your code is run. The built-in trustless nature of the blockchain makes it easy to verify that the information provided by hosting nodes is correct. With so many built-in advantages, the founders of Ethereum asked why only use this technology for financial transactions?

To expand the potential uses of the blockchain and cryptocurrency, Ethereum created the smart contract. All that a smart contract is is code that runs on the blockchain. Developers can write this code and post it to the blockchain and users can use the product whenever they want. Everyone win: developers get their code out for public use without the hassle of hosting it themselves, users get easy access to a variety of functionality, and cryptocurrency nodes get paid to run the code. These distributed applications or dApps have the potential to revolutionize computing and how we purchase and access new software and content.

How Does a Smart Contract Work?

Now that we know what a smart contract is, how does it work? How do you “execute code on the blockchain”? Here, we’ll talk about how the Ethereum network in particular (and smart contracts networks in general) works.

Normal applications and code run on a computer. Someone builds your computer, someone else write the operating system and then application developers write code that runs in that operating system to do whatever they want. The functionality of the code is dependent on the developer’s goals and the capabilities of the computer that it’s running on (you can’t run programs designed for quantum computers on your desktop at home). This isn’t the paradigm used for smart contracts, it’s completely centralized and running on hardware you own.

The next step up is a virtual machine. This is a program that pretends to be a standard computer but runs on another computer. This other computer could be your computer at home or one owned by someone else (which is how Amazon Web Services or AWS works). In Ethereum, smart contracts run on a virtual machine but instead of running on a single machine (either at home or the cloud datacenter), it runs on every node in the Ethereum network. The Ethereum development team created the Ethereum Virtual Machine (EVM) to allow smart contracts to run on the blockchain.

The Ethereum Virtual Machine

Ethereum virtual machine

Like other virtual machines, the Ethereum Virtual Machine has a set of predefined operations that developers can use to write programs. An important feature of the Ethereum Virtual Machine is that it’s Turing Complete. This means that code written for the Ethereum Virtual Machine can do anything that a normal computer or virtual machine can do. This makes Ethereum smart contracts extremely powerful.

When a smart contract is run on the blockchain, the code contained in it is run on the Ethereum Virtual Machine. It’s important to note that each node in the Ethereum network runs the Ethereum Virtual Machine and executes the same commands. The Ethereum network is massively parallel (every machine runs the same code) but the parallelism isn’t designed to speed up operations. Instead, the parallelization is designed to make sure that the network maintains consensus: everyone on the network agrees on the current state of the Ethereum Virtual Machine because they ran the same code and got the same result.


Running a Smart Contract

A smart contract starts when a developer writes code in Solidity (Ethereum’s programming language) and uploads it to the blockchain. Once added to the blockchain, the smart contract is assigned an address (just like any other Ethereum user).

Under the hood, Ethereum runs on messages. To run a smart contract, a user sends a message to the smart contract including some Ether and possibly some data. The Ether that is sent is used to pay the nodes running the contract for their effort.

Each operation in the Ethereum Virtual Machine is assigned a Gas value. In Ethereum, Gas is a fraction of an Ether and works just like gas in your car: you need to put some in to make it run and how long it lasts depends on how hard you’re working it (it takes more gas to pull a trailer uphill than to coast downhill). An Ethereum smart contract will run successfully is the amount of Gas required is less than or equal to the amount provided. The Gas used goes to the node in the network that creates the block containing the execution of the smart contract.


What is an Ethereum Token?

You may have heard of Ethereum tokens but what are they? Many of the new cryptocurrencies that have been coming out in recent years are Ethereum tokens. Ethereum tokens are coins hosted on the Ethereum blockchain that are designed for a specific purpose. It’s like a wristband that you get at an amusement park that gives you access to the rides. You buy the wristband using money but money won’t get you onto a ride, you need the wristband for that. The same principles apply to Ethereum tokens. Someone develops a product (like the rides at the amusement park) and you have to pay them in their chosen currency (the tokens). The way that you get a token is by buying it with Ethereum.

Here, we’ll briefly discuss how Ethereum tokens are created and some of the current more popular Ethereum tokens.


How Ethereum Tokens are Created

The creation of Ethereum tokens is one of the possible uses of smart contracts on the Ethereum platform. A smart contract to create an Ethereum token is pretty straightforward. In a nutshell, the token needs three things:

  1. An initial allocation of tokens (all to the creator is a common option)
  2. A mapping of Ethereum addresses to balances (lets people look up how much of the token someone owns)
  3. A way to send tokens from one address to another (in exchange for Ethereum’s token, Ether)

If a smart contract implements this functionality (along with the necessary checking for transaction validity), then it creates a functional Ethereum token. This can easily be implemented in less than fifteen lines of Solidity code, making the development of new cryptocurrencies on the Ethereum platform extremely easy.

To make things work more smoothly, Ethereum has released Ethereum Requests for Comments (modeled on how the rules for how the Internet works are named Requests For Comment or “RFCs”) that describe optional compliance standards for tokens. Compliance with these standards (implementing a few functions with set names and basic functionality) lets other smart contracts interact with the token, making interaction within the Ethereum environment easier.

If you want to create your own Ethereum token but don’t want to mess around with the details of coding it up in Solidity, there are other options. The simplest is to check out Token Factory, which provides a user interface for defining a smart contract for a new Ethereum token. By entering some necessary information (total supply, name, smallest acceptable denomination, and symbol), you can generate a smart contract that can be uploaded to the blockchain to implement your new cryptocurrency token.


Most Popular Ethereum Tokens

At the time of writing, there were a little over seventy-seven thousand smart contracts on the Ethereum blockchain that implemented tokens in existence (check out for an updated number). This is a huge number and going through each one to determine the details of its functionality would take quite a while, not to mention the fact that (since smart contracts can’t be removed from the blockchain once they’re added) some of them may be defunct or updated versions of other tokens.

In order to give a bit of a feel for the types of tokens that are doing well on the Ethereum platform (and what is possible), in this section we’ll explore the tokens with the highest market cap at time of writing. Due to volatility of the cryptocurrency market and the influx of new tokens (the first release of Ethereum was in May 2015 and within three years, there are over 77,000 tokens), this list is a snapshot of the state of the Ethereum ecosystem. By the time that you’re reading this, any one or all of these tokens may have been overtaken by a different token or Ethereum may have been dethroned as the leader in the smart contract space. For an up-to-date list, check out

  • EOS

Ironically, the Ethereum token with the largest market share at time of writing is EOS, a smart contract platform and direct competitor to Ethereum. Compared to Ethereum, one of the main selling points of EOS is the capacity for parallelization. On Ethereum, a smart contract can only run sequentially, one instruction at a time. EOS gives smart contracts the ability to take advantage of the parallel processing capabilities of the computers in the network. This increases the speed and efficient of the EOS network compared to Ethereum.

The EOS token on the Ethereum network is intended as a means for people to buy into the EOS network before its launch and for the EOS developers to raise money for development. Once an EOS network is launched, tokens will probably be transferred from the Ethereum network to the EOS network via premining (recording transactions in the first block of the blockchain that give tokens to people who have purchased them on the Ethereum network). Despite being a token that doesn’t do anything on the Ethereum blockchain, EOS tokens have the current highest market cap.

  • Tron

    Tron token

Currently, control of the media and news is pretty centralized. There are only a few large media and social media platforms and pretty much everyone goes to them to find out what’s going on in the world. This means that what most of the world believes is under the control of a small group of people who are incentivized to keep them on their platform as long as possible to get advertising revenue. This can be a problem (look at the fake news of 2016 for an example). The goal of Tron is to decentralize content distribution using the blockchain, cutting out the middleman of the media. By connecting content creators and consumers directly via the blockchain network and handling payment for content using cryptocurrency (cutting out the need for the use of advertising for revenue), Tron intends to make it possible for people to read and watch the content that they want rather than what the media wants them to see.

  • VeChain Thor

The goal of VeChain Thor is to provide supply chain transparency to companies and customers using the blockchain. This means that customers will be able to verify the authenticity of the products that they purchase through a straightforward process, rather than trusting manufacturers and vendors to properly manage their own supply chains.

In late February 2018, VeChain Thor (named just VeChain before February 28th) began expansion of their platform to enable the creation of smart contracts on top of their existing blockchain. With the wealth of supply chain information natively available in the blockchain, this should allow dApp developers to create new ways for consumers to shop and learn about what they are purchasing.