Serpent is one of the high-level programming languages used to write Ethereum contracts. The language, as suggested by its name, is designed to be very similar to Python; it is intended to be maximally clean and simple, combining many of the efficiency benefits of a low-level language with ease-of-use in programming style, and at the same time adding special domain-specific features for contract programming. The latest version of the Serpent compiler, available on github, is written in C++, allowing it to be easily included in any client.
This tutorial assumes basic knowledge of how Ethereum works, including the concept of blocks, transactions, contracts and messages and the fact that contracts take a byte array as input and provide a byte array as output. If you do not, then go here for a basic tutorial.
The important differences between Serpent and Python are:
3^(2^254)
suprisingly evaluates to 1, even though in reality the actual integer is too large to be recorded in its entirety within the universe.[x**2 for x in my_list]
), dictionaries or most other advanced featuresextern
statement used to call functions from other contracts