When it comes to the development of smart contracts, the Ethereum Virtual Machine (EVM) and WebAssembly (Wasm) both have their merits. But have you ever considered the potential synergy that can be achieved by combining the strengths of both platforms? Imagine a seamless integration that empowers developers to build robust smart contracts on a multi-chain infrastructure like Polkadot.
This very topic was explored by Torsten Stüber, the Chief Technology Officer of Pendulum, during his presentation at the recent Polkadot’s Sub0. Stüber highlighted the importance of bridging the divide between Solidity and WebAssembly (Wasm) within the Polkadot ecosystem, envisioning a future where smart contracts flourish. Pendulum is a parachain project on Polkadot that is on a mission to become the central hub for fiat-backed stablecoins.
What is EVM and Wasm?
EVM is a stack-based virtual machine that serves as a runtime environment for executing smart contracts. EVM smart contracts are written in programming languages like Solidity, Vyper, and LLL. It is widely used for decentralized finance (DeFi) applications, non-fungible tokens (NFTs), and other DApps that require complex logic and interactions.
Wasm is a binary instruction format that allows the execution of code at near-native speed in web browsers. Wasm is designed as a portable target for the compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications.
It is an improvement to the existing JavaScript that works alongside it and adds a new capability to the web apps. Wasm-based smart contracts are gaining traction in blockchain platforms like Polkadot and EOS, focusing on scalability, interoperability, and specific use cases.
Another thing to note is that while Wasm itself is not unique to Polkadot, it is integrated into the Polkadot ecosystem, making it a native technology for developing smart contracts on Polkadot and its parachains.
Choosing between EVM and Wasm
Speaking about the choice between EVM and Wasm, the CTO said that the decision isn’t as straightforward as it might seem. It involves considering two distinct layers: the programming language and the bytecode.
On one hand, developers can choose Solidity, the widely adopted programming language for Ethereum smart contracts. On the other hand, there’s Ink, a Rust-based language specific to the Polkadot ecosystem. When it comes to bytecode, EVM and Wasm are the contenders, with each offering different advantages.
Torsten pointed out that many developers currently combine Solidity with EVM bytecode or Ink with Wasm bytecode. However, he argued that, for the time being, the optimal approach is to start with Solidity and compile it to Wasm bytecode. He outlined the benefits of this approach, along with the challenges it presents and how they can be overcome.
He added that Solidity has a dominant effect in the smart contract development space due to its compatibility with various ecosystems. Ink, on the other hand, offers flexibility and safety through its Rust-based approach. When it comes to bytecode, EVM’s standard interface is an advantage, but Wasm is a widely adopted standard, even beyond blockchain.
Combining Solidity with Wasm: Wasm Deploy
In the course of the presentation, the speaker used data from an experiment to illustrate that compiling smart contracts from Solidity to Wasm resulted in faster execution speeds for computation-heavy contracts, further reinforcing the case for this approach.
Furthermore, he revealed to the audience Wasm Deploy, a tool created by Pendulum to make the compilation, deployment, and testing of smart contracts in both Ethereum and Polkadot ecosystems.
The Pendulum CTO said that with Wasm Deploy, developers can easily deploy a system of interconnected smart contracts on the Polkadot chain. It reduces the complex process involved, making it easier for developers to work within the ecosystem.
He also mentioned that when testing smart contracts in Polkadot with Wasm Deploy, there’s an option to incorporate a test runner, making it possible to smoothly migrate tests from Ethereum tools like Forge. This creates a unified testing experience for developers.
Pendulum’s hybrid smart contract processing
In the final section of the presentation, Torsten discussed how Pendulum is leveraging the hybrid chain approach, combining smart contracts and runtime logic.
In the context of blockchain and smart contracts, runtime logic defines how the blockchain network processes transactions and executes smart contracts. It ensures that transactions are validated, data is stored and retrieved correctly, and contract code is executed according to predefined rules.
This approach allows Pendulum to efficiently manage tokens and implement an efficient price oracle directly within the runtime, simplifying the smart contract’s role.
Torsten’s exposition points to the evolving landscape of blockchain development, particularly in the Polkadot ecosystem.
The shift from Solidity to Wasm bytecode presents promising advantages, and tools like “Wasm Deploy” are paving the way for smoother development and testing processes.