Don’t code another Smart Contract without understanding the 4 languages in 6 minutes first
Do you know that there are 4 main programming languages in Ethereum for creating Smart Contracts and decentralized applications? Wanna know which one is the best option for your project? Keep reading to find out.
In this article I will provide you a concise overview of the most popular Ethereum programming languages available right now.
By the end of it, you’ll know exactly which option is the absolute best for your specific needs so that you don’t waste time and resources on something too limited or hard to maintain.
Be sure stick till the end for resources to learn more about each language.
Here’s the table of contents:
- Vyper
- Solidity
- Serpent
- LLL
- The best solution for you
- Final verdict
1. Vyper
Vyper is a language similar to Python. It belongs to the “simple” group of languages where the focus is on the contract’s security by simplicity.
Those who are looking for more security-oriented languages, Vyper is the go-to platform because the goal of Vyper is to create more readable and easier to understand contracts which are also fully transparent. Essentially, Vyper represents an amalgamation of Solidity and Python of sorts.
Viper is the successor to Serpent. It is under active development, mainly by Vitalik himself.
From their own github:
Vyper is a smart contract development language built with the following goals:
Security — it should be possible and natural to build secure smart contracts in Vyper.
Language and compiler simplicity — the language and the compiler implementation should strive to be simple.
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.
You can find it here: https://github.com/ethereum/vyper
Pros:
- Simple to use and highly readable
- Difficult to write buggy code because less complex functions remove the risk of making a mistake
Cons:
- Limited support for advanced functions
- Doesn’t allow calling external methods from other smart contract
2. Solidity
Solidity is an intentionally loosely-typed programming language, quite similar to JavaScript with “.sol” as the file extension. It is currently the most used and supported programming language.
It was influenced by C++, Python and JavaScript and is designed to target the Ethereum Virtual Machine. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.
The best way to try out Solidity right now is using Remix. It’s a web browser based IDE that allows you to write Solidity smart contracts, then deploy and run the smart contracts.
Pros:
- Intentionally simple to write secure contracts
- Multiple type-safe functions
- Shortages in the program can be easily rectified through alternative strategies
Cons:
- Because of it’s popularity is the focus for hackers to attack contracts so new vulnerabilities cause lots of damage
- Limited in posibilities. You’ll probably need an external oracle for more advanced projects
- Upgradable contracts are still hard to develop
You can learn more about it in the official docs: https://solidity.readthedocs.io/en/v0.4.24/
3. Serpent
Serpent is fairly similar to Python. Serpent has a minimalistic syntax and dynamic typing features. Originally, Serpent was developed for usage in real-time systems, especially interactive multimedia systems.
However, the appearance of Solidity exposed the many weaknesses of Serpent and ultimately kicked it to the curb. Nowadays it’s not recommended.
The Ethereum founder said about Serpent:
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.
Pros:
- Multiple independent instances can run simultaneously in the space of one address
Cons:
- Independent audit performed by Zeppelin identified 8 critical vulnerabilities
- The biggest flaw lies in the fact that hackers may change the date in which the REP token contract was created, thus freezing up the token supply
4. LLL
Lisp Like Language (LLL) is one of the original programming languages for developing Ethereum smart contracts. This programming language has recently gained more popularity.
Just like Python, it is meant to be simple and minimalistic. For instance, the platform offers direct access to memory and storage, therefore allowing for a more efficient performance. The code is simple, clean and straightforward.
There’s an excellent article written by consensys about that language for those that want to learn more about how to use it here: https://media.consensys.net/an-introduction-to-lll-for-ethereum-smart-contract-development-e26e38ea6c23
LLL doesn’t hide the highly resource-constrained nature of the EVM and enables efficient use of those limited resources.
LLL facilitates the creation of very clean EVM code whilst removing the worst of the pain of coding for the EVM directly: namely stack management and jump management.
Pros:
- Removes stack and jump management for more efficient development
Cons:
- Although it is simple, it is widely considered to be too basic
- The lower level coding nature of this language makes code harder to manage
- Not recommended for more complex projects due to its simplicity
You can learn more in the official docs: https://lll-docs.readthedocs.io/en/latest/lll_introduction.html
5. The best solution for you
All programming languages are developed to target a specific audience and cater to the needs of a specific user group. The “one-size-fits-all” principle is rarely applicable in the coding ecosystem as different developers want and require different features.
Moreover, the decision as to which program to use often is taken out of the hands of developers and lies with the business owners.
As far as developers are concerned, the division of simpler and more complex languages is clear. Use Vyper or LLL if you are looking for simple languages needed for less complex functions and smaller projects.
On the other side, I recommend you to go with Solidity if you want to work on more complex problems. Thus, based on your level of knowledge and experience, you will pick your language of choice.
Solidity is definitely the safest bet as it provides a great balance between simplicity, complexity and the overall quality of the final output.
6. Final verdict
As explained in the first part of the article, there are many different programming languages currently available. Depending on your needs, budget and vision, different developers or business owners choose whatever fits their needs the best.
In order to minimalize the risk, my advice would be to choose Solidity. Why? It is the flagship language at the moment. In the past, developers opted for Serpent and then LLL but ultimately the appearance of Solidity “retired” them, to put it simply.
Its combination of simplicity, multifunctioning, and the tendency to continuously upgrade and improve the platform make it the safest bet.
That’s it! If you want to receive articles faster than anybody about Ethereum development to learn faster than ever, join the mailing list where you’ll be guided as you learn here: http://eepurl.com/dDQ2yX
Become an Ethereum Developer with my book: https://merunas.io/book where you’ll learn more than you even need to get a highly paid job as a Blockchain Engineer, to create your own ICO and much more.