The many languages of Ethereum: clearing up misconceptions about Solidity, Serpent, Vyper and the EVM

in #ethereum7 years ago

Recently I came across a question on Reddit about Solidity and how future proof and stable it is. Even the people who answered seemed to be a little confused so I thought I write up a little explanation about it. Let's do it in Q&A style:

What programming language is used by the Ethereum blockchain?

Every program (smart contract) on the blockchain is in EVM bytecode. It's similar to the executable files on your computer which contains very low level instructions for your OS and CPU. This is the only language. There are no others.

Then why don't I see developers writing EVM bytecode?

Because it is a target language. It would be very hard and cumbersome to write EVM bytecode because that was never the purpose of it.

OK, but how can I get EVM code?

You choose a language that can be compiled to byte code. Anyone can create such a language but the easiest way is to choose a popular one. Currently your best options is Solidity.

Why Solidity is the best option currently?

It is officially supported by the Ethereum project and the majority of smart contract developers use it. It has a fairly good documentation and some quite good frameworks around it (e.g. truffle).

Why do we need a new language? Wouldn't it be easier to use an existing language?

It seems like wasted energy but actually it is way easier and logical to have a completely new language for smart contract development. Our existing programming languages were designed to compile to regular machine code and they are very complex. The EVM is quite different and don't need all those features so it is much easier to create a language just for that purpose.

What about Serpent?

I'm not really sure about the purpose of the language because the first thing on the Github repo is this:

Being a low-level language, Serpent is NOT RECOMMENDED for building applications unless you really really know what you're doing. The creator recommends Solidity as a default choice, LLL if you want close-to-the-metal optimizations, or Viper if you like its features though it is still experimental.

So avoiding it seems to be a good idea.

I heard that Vyper (Viper?) is the new and fresh language that will replace Solidity. Should I learn/use that instead?

No. If you are familiar with Solidity then take a look at it because it's sure an interesting project but it's in a very early stage and to be stable and usable language is far-far away. And even than the adaptation won't be instant so Solidity will remain the best bet for the next couple years.


I hope I cleared up some misconceptions. If you have any further questions ask them in the comments!