Vyper, Solidity and Scrypto: How the smart contract languages compare

A look at three different programming languages for blockchain networks and how they compare.

The Ethereum network brought smart contracts into the blockchain space, making concepts like decentralized finance (DeFi) possible. 

Smart contracts can automatically execute processes once certain conditions have been met. Along with this new technology, a new coding language was developed called Solidity.

As the blockchain industry continues to grow and new blockchain networks emerge, additional programming languages are being brought into the space, notably Vyper and Scrypto.

Programming languages are a set of rules that convert strings of text and numbers into machine-readable code. In simple terms, programming languages enable computers to understand instructions that are input by human beings. When it comes to the blockchain industry, Solidity, Python and Javascript are some of the most commonly used languages, yet they all work differently.

What is Solidity?

Solidity is an object-oriented and high-level programming language for building smart contracts on the Ethereum blockchain and other blockchain networks like BNB Smart Chain and Avalanche. The language was developed in 2014 and shares similarities with programming languages like JavaScript, C++ and Python.

Since Solidity is a high-level language, computer code is typed in an easily understandable and human-readable manner instead of ones and zeros. For example, Solidity code will include words and phrases like “function” and “contract,” as well as curly brackets and numbers.

Being an object-oriented coding language means that Solidity revolves around using “objects,” which are pieces of code that can be reused to create similar pieces of code without re-writing the original code each time.

Solidity also uses a compiler to convert the human-readable, high-level code into machine-readable code that is executed on the Ethereum Virtual Machine (EVM).

What is Vyper?

Vyper is a contract-orientated, pythonic programming language for smart contracts that is designed to be used with the EVM. The language was designed to improve on Solidity by improving the security and readability of the code. Vyper has a strong focus on the audibility of its code. Due to this, one of its principles is that humans should be able to read as much Vyper code as possible. 

Vyper also aims to make it as difficult as possible for anyone to write misleading code. Simplicity for the reader (i.e., an auditor) is more important than simplicity for the writer (i.e., developer). This way, it will be easier to identify malicious code within a smart contract or decentralized application (DApp).

What is Scrypto?

Scrypto is an asset-orientated smart contract language. The language was developed by Radix, is based on Rust, and keeps most of Rust’s features while adding specific functions and syntax for Radix Engine v2. Since Scrypto is asset-orientated, it can interact with assets such as tokens, which are a type of resource within the language. 

In coding languages like Solidity, ERC-20 tokens exist as smart contracts on the EVM. Assets within Scrypto are resources that exist within containers and vaults. In simple terms, it’s like having a bucket (the container) and filling it with coins (the asset) that can be stored inside a piggybank (the vault).

Recent: Demand for talent in crypto less dependent on market as industry matures

Scrypto also focuses on being developer-friendly by allowing them to only write the necessary code while interacting with the containers and resources to enable functionality within a DApp. Security is another principle with developers being able to give specific instructions to a DApp instead of giving out blanket permissions.

How the smart contract languages compare

Solidity has a wide range of online learning resources and a lot of community support due to its use in major blockchain networks like Ethereum. Solidity also has a wide range of features taken from object-orientated programming (OOP), making it modular and easier to troubleshoot when there is a problem. For example, if an object from a certain class was to malfunction, it could be traced back to the origin of the class. 

This works because Solidity uses encapsulation, meaning that every object is self-contained, with each function working independently. The modularity of the coding language also allows developers to work on multiple objects simultaneously, making it more efficient to build, fix and deploy smart contracts.

Vyper is a simpler coding language than Solidity, emphasizing transparency, simplicity of the language structure and audibility. Vyper also has fewer features than Solidity, which was done intentionally for security reasons. The limited feature set reduces the number of vulnerabilities malicious actors can exploit.

For example, Solidity employs modifiers indicating that checks have been carried out before and after a process is executed. However, Vyper does not use modifiers as the developers believe it makes it easier to write misleading code. It also encourages individuals to develop code that bounces throughout the file, reducing audibility. Since modifiers are not present in Vyper, it’s impossible to add any state changes to the code.

Another feature that is excluded from Vyper is inheritance. In Solidity, multiple contracts can inherit features from a parent contract. If there is a disagreement, it also necessitates that individuals understand the norms of precedence. Vyper does not use class inheritance because it eliminates a potential source of complexity in the code, which contributes to improved audibility. In general, Vyper is a more minimalist coding language that trades some functionalities for increased security and better examination of its code base to better protect users of Vyper-based smart contracts.

While Solidity may be one of the most popular and well-known programming languages in the blockchain space, some languages have easier learning curves for developers. In addition, simpler programming languages make it easier to attract new developers to the industry.

Adam Simmons, chief strategy officer at RDX Works — the developers behind Radix — told Cointelegraph, “Having the right tools for the job makes a big difference — and right now, blockchain developers don’t have the right tools. This isn’t just about making the languages more simple, but making developer tools that are intuitive and secure,” continuing:

“At its peak, DeFi grew to over $200 billion TVL in just two years — so clearly, there are very high levels of demand. Yet, despite this 200x growth in capital, the number of developers only increased by 2x, to a total of around 19,000 (out of around 30 million developers worldwide).”

Despite the high level of growth seen in the decentralized finance space, the number of developers didn’t grow to match the demand. Simmons believes that developers may have found Solidity to be too difficult for them to transition into blockchain development:

“Developers are hesitant to go full-time in Web3 due to the steep learning curve of Solidity and the high levels of risk around security. Despite the highly talented developers and millions of dollars spent on security audits, DeFi is still hemorrhaging money from hacks and exploits. This alone is enough to deter developers from entering the space.”

“Having the right languages and tools will enable developers to grow the whole industry far more rapidly. Just as game engines gave developers the tools to revolutionize video game production in the 90s, the right Web3 languages and tools will enable developers to accelerate the growth of Web3,” Simmons added.

Scrypto also focuses on security, simplicity and user-friendliness. Scrypto transactions are focused on assets. They define how the user wants system resources to be distributed. They may also indicate how returned resources should be handled by the user or another component in a multi-component transaction.

Transactions on Ethereum are usually a call to a smart contract (since DApps and tokens on Ethereum are smart contracts). In contrast, transactions on Scrypto involve moving assets from one component to another.

For example, if User A wants to send 10 custom tokens to User B, their transaction would show that they’re trying to withdraw 10 tokens from the vault that contains them. The transaction will also show that they will send those tokens to the deposit method of User B’s account component. Since resources (in this case, the tokens) need to be located somewhere, a bucket (container) will be used to transfer the tokens from User A to User B.

In the above example, the user transfers a bucket containing the resources (the tokens) to the deposit method of the second user instead of making a call to a token smart contract. Interacting with DApps works similarly, with users withdrawing tokens from their accounts and passing them to the relevant component they wish to interact with. In summary, Scrypto takes an asset-based approach, with users storing and passing along actual assets. The asset-based approach also makes it easier for developers to code DApps since it’s easier to interact with tokens (resources), token pools (vaults) and users (components).

For another example, if a swapping DApp (like Uniswap) was coded with Scrypto, the developers would only need to code the trading method for the swap. First, the DEX would need to identify a user’s incoming container of Token A, then calculate the exchange rate. Next, the incoming tokens will be deposited, and the DEX will send the correct amount of Token B back to the user.

Which programming language should blockchain developers choose?

Developers can use traditional programming languages (C++, Python, JavaScript) for blockchain development as well as specifically built solutions like Solidity, Vyper and Scrypto. Multiple programming languages can be beneficial for the blockchain space since it gives developers a range of tools to work with. 

For example, developers who are familiar with C++, JavaScript and Python may find Solidity attractive. Developers who are familiar with Python may gravitate toward Vyper, while developers familiar with Rust may choose to use the Scrypto language.

Recent: Social tokens will be the engine of Web3, from fanbases to incentivization

Simmons agrees, telling Cointelegraph, “With more languages coming to Web3, we will likely see a period of time where there are quite a few competing approaches. As these languages find product-market fit with developers and most importantly enable those developers to build powerful, useful and secure DApps, we will likely see the industry gravitate towards those that deliver the best results.”

Solidity will naturally be the choice for developers who want to work on Ethereum and similar blockchain networks. At the same time, Vyper and Scrypto could attract developers who prefer simplicity and additional security. Scrypto may also be preferable for developers due to its increased simplicity and asset-orientated approach.

Original

Spread the love

Related posts

Leave a Comment