Vyper — Programming Language For Ethereum Smart Contracts
In previous articles, we discussed ways of creation of smart contracts on the Bitcoin blockchain, figured out what the Ethereum Virtual Machine (EVM) is, and considered several programming languages on Ethereum.
Now it’s time to talk about an active Python-like language called Vyper. The language is actively maintained by the development team. Currently, it is suitable for creating Ethereum blockchain smart contracts (All data presented in the article is checked as of October 18, 2018).
General Information On Vyper
According to the official portal, Vyper is a programming language that targets the Ethereum Virtual Machine (EVM) and is orientated towards Python in terms of its development. As a tool for writing Ethereum blockchain smart contracts, Vyper has several goals:
- Security. The security of smart contracts created on Vyper is a significant feature.
- Simplicity both of the language and a correspondent compiler. The structure of the code should not be complicated.
- Audibility. The structure of the code should be readable. This feature is considered to be the most important one.
Basing on the mentioned goals, Vyper developers have presented a set of unacceptable language features. These features are forbidden in Vyper in order not to run counter to the general ideology. Namely:
- Modifiers. They might lead to a misinterpreted code. Applying conditions and state changes does harm to audibility, making people search for a correspondent definition throughout the code.
- Class inheritance. Involves many files in the class hierarchy and makes the process of searching complicated.
- Inline assembly. Has an influence on the process of searching and requires assembly understanding as well.
- Function overloading. Several functions with the same name confuse readers forcing them to check which one might be called at different program iteration.
- Operator overloading. Brings a misleading code.
- Functions that call itself and create loops. These two types of loops do harm to the gas management and program logic understanding.
- Fixed point applied to binary. Removed in favor of a clear and transparent decimal fixed point.
Moreover, some post-Metropolis enhancements in Ethereum were banned in advance. They involve state changes after non-static calls and "inline" non-static calls. This precaution is intended to prevent re-entrance attacks and strongly differentiate call types.
By moving deeper into technical issues, we can see that Vyper has strict types that must be defined in advance. However, some basic types proposed by the compiler can be united and combined into complex user structures. Type interaction is also supported.
Basic types are boolean, integers, decimals, address, members, unit types, arrays, strings, references, lists, structures, constants. Language operators include common sets of comparisons, arithmetic, and bitwise processes.
Vyper also supports mapping, event logging used to report user on finishing significant processes, and low-level built-in functions. This is not about the assembly language but about some opcodes included in the Vyper code for the direct execution.
As it was mentioned above, Vyper is actively developed at the moment and has a chance to become a good alternative to the Solidity language. Still, the Ethereum core development team decided to stick with Solidity as it is the main language for smart contracts so far. Solidity will be the topic of our next article.