Skip to content

Latest commit

 

History

History
60 lines (31 loc) · 3.02 KB

smart-contracts.asciidoc

File metadata and controls

60 lines (31 loc) · 3.02 KB

Smart Contracts

Introduction to Ethereum High-Level Languages

The Ethereum Virtual Machine is an emulated computer that runs a special form of machine code called bytecode, just like your computer’s CPU which also runs machine code. While it is possible to program the EVM directly in bytecode, it’s unwieldy and very difficult for programmers to read, understand, and collaborate in a low-level language like bytecode. Instead, we use a high-level symbolic language to write our program and a compiler to convert it into bytecode.

Ethereum has several high-level languages, with the compilers needed to produce EVM-executable bytecode, including (ordered by approximate age):

LLL

A functional (declarative) programming language, with Lisp-like syntax. It was the first high-level laguage for Ethereum smart contracts, but it is rarely used.

Serpent

A procedural (imperative) programming language with syntax similar to Python. Can also be used to write functional (declarative) code, though it is not entirely free of side-effects. Used sparsely. First created by Vitalik Buterin.

Solidity

A procedural (imperative) programming language with syntax that is similar to Javascript, C++ or Java. The most popular and most frequently used language for Ethereum smart contracts. First created by Gavin Wood (co-author of this book)

Vyper

A more recently developed language, similar to Serpent and with Python-like syntax. Intended to get closer to a pure-functional Python-like language than Serpent, but not to replace Serpent. First created by Vitalik Buterin.

Bamboo

A newly developed language, influenced by Erlang with explicit state transitions and without iterative flows (loops). Inteded to reduce side-effects and increase auditability. Very new and rarely used.

As you can see, there many languages to choose from. However, of all these Solidity is by far the most popular, to the point of being the de-facto high-level language of Ethereum and even other EVM-like blockchains. We will spend most of our time using Solidity, but will also explore some of the examples in other high-level languages, to gain an understanding of their different philosophies.

What is a Smart Contract?

Building a Smart Contract

Testing Smart Contracts

Deploying Smart Contracts