Testnet launching soon!Join the Community

Guides

Migrating from Ethereum's Solidity

This page is a work in progress. It will eventually be a straightforward guide to porting contracts from Ethereum's Solidity to Firechain's Pyro, but for now, it's just an incomplete list of differences between the two languages.

What is Solidity?

Solidity is a contract-oriented, high-level language for implementing smart contracts. Its syntax is similar to that of JavaScript and it is designed to target the Ethereum Virtual Machine (EVM). Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

What is Pyro?

Pyro is our async-first language designed for developing smart contracts that run on Firechain's Async VM (AVM). It is a strongly typed language with a familiar syntax similar to TypeScript. Much like Solidity, Pyro supports complex inheritance, libraries and user-defined types. But the AVM is a different beast than the EVM, so there are some key differences between the two languages.


Differences between Solidity and Pyro

Ethereum's Solidity and Firechain's Pyro are both high-level languages that target the EVM and AVM respectively. However, there are some key differences between the two languages that you should be aware of before you start porting your contracts.

Synchronous vs Async

Solidity is a synchronous language, meaning that all functions are executed in a linear fashion. Pyro is an async-first language, meaning that remote functions can be executed in parallel. This is a fundamental difference between the two languages.

Fun fact: We originally called Pyro "Fluidity" and the earliest prototype was actually a superset of Solidity. However, we decided to create a new language rather than overhaul Solidity for a few reasons. One of the most important reasons was that the AVM is optimized for asynchronous execution and Solidity was not designed for this type of model, so we were sort of swimming upstream. We also wanted to create a language that was more approachable to developers who were new to smart contracts. Team has grown fond of the network's codename (Firechain), so we decided to go with the name Pyro.

Entities

Solidity is a contract-oriented language, meaning that all code is written inside of contracts. Pyro's entities are analogous to Solidity's contracts, but they are a bit more flexible. For example, Pyro's entities can listen to events broadcasted by other entities and schedule asynchronous jobs. This is not possible in Solidity.

Events

Solidity's events are essentially log entries that are subscribable by only off-chain clients. Pyro's events are similar to Solidity's events, but they are also provide other contracts with the ability to "listen" for them. This means that you can write code that reacts to events in real-time, which is not possible in Solidity. Pyro's event system provides a robust way to build decentralized applications.

Libraries

Pyro implements library functionality that feels a lot like Solidity's libraries. For example, libraries can extend types, or add functionality to entity that can operate on the entity's storage directly. One key difference is that Pyro's libraries are also able to maintain their own internal state, which can be shared across many importing entities. This enables shared functionality that can be used across multiple entities, including storage and event management.

Like in Solidity, Pyro's libraries are not directly callable; if the goal is to make the library's functionality accessible, an entity must import and then explicitly expose it.

Iterators

Pyro provides powerful iterator functionality that is not available in Solidity. For example, you can iterate over the keys and values of a map which is not possible in Solidity. You can also iterate over the keys and values of a map in reverse order, which is not possible in Solidity. Pyro also supports async iterators which can be used to iterate over remote data sources.

Previous
Introduction to Pyro