Vyper is a smart contract programming language targeting the Ethereum virtual machine. If you want to learn more about the Ethereum blockchain I suggest you you head over to Ethhub. They provide an excellent overview on most topics related to Ethereum. The official Vyper documentation can be found here. The code for Vyper itself can be found here.


Vyper was strongly influenced by the programming language python. Just like python vyper was designed with simplicity and clarity in mind. This is achieved primarily by two measures: The language can handle relatively few key words and the syntax is reduced and optimised for clarity. As a result vyper contracts can be formulated much more concise and clearly than when using most other smart contract programming languages. Vyper, like Python and Haskell, uses indentations as a structuring element. This means, that depending on how far code is indented, it is executed differently.

The 'hello world'-contract of vyper:

stored_data: uint256

def set(new_value: uint256):
    self.stored_data = new_value

def get() -> uint256:
    return self.stored_data

Contract Structure

Vyper contracts always have the same general structure. At the beginning of a contract events are defined followed by the contracts state variables. Then the constructor is defined and the rest of the contract is made up of its methods.


Vyper principles/goals

Vyper was built with four principles/goals in mind. These goals can be found in the top read-me inside the official vyper repository on github.

For convenience we also list them here:

  1. Security: It should be possible and natural to build secure smart contracts in Vyper.

  2. Language and compiler simplicity: The language and the compiler implementation should strive to be simple.

  3. Auditability: Vyper code should be maximally human-readable. Furthermore, it should be maximally difficult to write misleading code. Simplicity for the reader is more important than simplicity for the writer, and simplicity for readers with low prior experience with Vyper (and low prior experience with programming in general) is particularly important.

Last updated