Algorand-Blog-Algorand_Solidity-Blog_banner

Algorand Solidity: Compiling Solidity to run on the Algorand Virtual Machine with Puya

Algorand Python and Algorand TypeScript let developers write contracts in two of the world's most used languages, with the editors, linters and type checkers they already had. Today, we bring that experience to Solidity smart contract developers. A new compiler front end, open to early testers, compiles contracts written for the EVM to run on a network whose history has been secured against quantum attacks since 2022.

Under the hood, Algorand Solidity is a front end for the Puya compiler called puya-sol. It opens to early testers on December 1st, and Algorand wants Solidity developers to throw their hardest, weirdest contracts at it before general availability in early 2027. 

Algorand has spent years bringing contracts to the languages developers know

Algorand smart contracts have evolved from low-level TEAL and PyTeal to fully typed Python and TypeScript via the Puya optimizing compiler.

As the most common smart contract language, Solidity is an obvious next step.

Algorand Solidity hands its output to the same Puya backend that compiles Algorand Python and Algorand TypeScript. It emits an ARC-56 app specification too, so existing tooling can interact with a Solidity contract like any other Algorand application.

Every contract deploys to a chain that has prepared for quantum computers since 2022

Quantum computers may one day break the signature schemes that secure most blockchains today. A chain whose history rests on those signatures will have to retrofit its defenses later.

Algorand did that work early. Since 2022, Algorand's chain history has been secured by State Proofs signed with Falcon, a post-quantum signature scheme. Every contract compiled with Algorand Solidity runs on that chain.

Users have a post-quantum option of their own. Pera, the wallet built on Algorand, lets people open and hold assets in native post-quantum accounts. Each one is still an Algorand address and signs transactions the same way, so those accounts should work with Solidity contracts from day one.

A team expanding its project to Algorand doesn't need to build any of this. It comes with the network, along with instant finality and low, predictable fees. All while the contracts stay in Solidity.

Algorand Solidity is Solidity

Algorand Solidity will feel very natural to Solidity devs; it supports the latest language version and parses with solc 0.8.38. Inheritance, modifiers, libraries, structs, mappings, custom errors, events and even inline Yul assembly all compile. Each contract becomes one Algorand application. Evaluation order, checked arithmetic and storage slot numbering follow solc closely, emulating both `legacy` and `via-ir` modes and their subtle semantic differences.

Contracts can expose ARC-4 methods for Algorand clients. Projects whose callers already speak Solidity's EVM ABI can keep it.

Our goal with puya-sol is to let EVM developers seamlessly deploy their existing applications on Algorand. We want to make Algorand's speed, low fees, and quantum resistance instantly accessible in a familiar environment.

EVM smart contract archaeology

The compiler team has already checked that vision against real traffic. Besides solc’s own semantic testsuite, it took the mainnet history of several large and complex projects (AAVE v4, Succinct Lab’s SP1 verifiers, chunks of Uniswap, and Morpho, amongst others) on EVM chains and replayed it, call by call, on Algorand builds compiled with Algorand Solidity as extra behavioral tests; alongside exhaustive compilation testing covering all Ethereum L1 deployed contracts with verified source code.

An upcoming technical blog will cover how those replays work and what they turned up, along with design decisions taken to circumvent or mitigate architectural divergences.

The path from EVM to AVM

The AVM and the EVM are different machines, each with its own native types, limits, opcodes and quirks. Mapping one onto the other is full of subtleties, and not every EVM pattern carries over one-for-one. Where Algorand Solidity can't reproduce an EVM behavior, it says so at compile time instead of building a contract that quietly behaves differently. When emulation of the pattern is available, the error messages will point to a flag emulating the behavior and point to documentation on any subtle semantic differences, so the developer can decide to opt into any divergences according to their use case.

Early testers will no doubt find more, which is exactly what the early access phase is for.

Help shape what ships

Early access opens on December 1st. Developers can sign up at algorand.co/solidity-signup to try their own contracts and send feedback that will help shape the general release.

 

Disclaimer: The content provided in this blog is for informational purposes only. The information is provided by the Algorand Foundation ("Algorand") and while we strive to keep the information up-to-date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability, or availability with respect to the blog or the information, products, services, or related graphics contained in the blog for any purpose. The content of this blog is not intended to be legal, financial, or investment advice nor is it an endorsement, guarantee, or investment recommendation. You should not take any action before conducting your own research or consulting with a qualified professional. Any reliance you place on such information is therefore strictly at your own risk. All companies are independent entities solely responsible for their operations, marketing, and compliance with applicable laws and regulations. All third-party brands and trademarks are the property of their respective owners, and their mention does not imply affiliation or endorsement. In no event will Algorand nor any affiliates be liable for any loss or damage including without limitation, indirect, or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this blog. Through this blog, you may be able to link to other websites which are not under the control of Algorand; the inclusion of any links does not imply a recommendation nor endorse the views expressed therein. Any statements about future plans, integrations, or availability are forward-looking and subject to change.