Connect with us

FEATURED

RISC-V vs. Wasm: a  game-changer for smart contracts

Published

on

Smart contract development stands at the brink of a transformative era, poised for unparalleled acceleration in processing speed thanks to the emergence of RISC-V as a formidable alternative to WebAssembly (Wasm).

At Sub0 2023, Alexander Theißen, Smart Contracts Execution Lead at Parity Technologies, explored the potential of RISC-V and its experimental virtual machine (PolkaVM) for smart contracts.

Navigating the Wasm Challenge

Opening his discourse, Theißen acknowledged WebAssembly’s long standing dominance in smart contract development. Yet, he highlighted significant hurdles — a leading pressing issue is the difficulty of compiling Wasm to native code efficiently. 

Developers have long awaited native compilation for improved performance, but it remains elusive due to Wasm’s complexity.

He added that when using Wasm, there is no guarantee that compilation will even be complete, making it challenging to execute smart contracts efficiently. 

Wasm’s compilation process is slow, and since it can’t be cached easily, it consumes block space or core time every time a contract is run.

Wasm’s underlying stack-based architecture also makes it hard to compile efficiently. Transforming it into a register-based system, similar to real computers, presents a daunting challenge. 

Furthermore, Wasm is continually evolving, making it less suited for blockchain purposes.

Introducing RISC-V

To address these issues, Alexander and his team turned to RISC-V, a simplified, open-source instruction set architecture. RISC-V’s simplicity, with only 150 essential instructions, makes it an attractive choice. 

It aligns more closely with real computers, simplifying compilation, and eliminating the need for complex register allocation.

However, there’s a challenge – RISC-V has too many registers for blockchain purposes. To overcome this, they introduced RV32EM, a variant with 16 registers, making the compiler straightforward.

PolkaVM – The RISC-V Virtual Machine

PolkaVM is a modified RISC-V virtual machine tailored for blockchain needs. While it initially supports 32-bit systems, 64-bit support is in the works. It also utilizes a custom container format, ensuring better control over the compilation process.

In performance comparisons, Alexa said that PolkaVM has shown promise. It significantly reduces compilation times compared to Wasm, making it a compelling option for developers. 

Even in its early stages, it outperforms Wasm compilation, and with further optimizations, it could become even more efficient.

Integration with Pallet contracts

Furthermore, he added that Pallet Contracts, an integral part of Substrate, is looking into integrating PolkaVM. This integration aims to enable seamless interaction between contracts compiled in different bytecode formats (Wasm or RISC-V). 

Developers won’t need to worry about the underlying bytecode, simplifying the migration process.

Theißen urged the community to actively participate in PolkaVM’s development journey. Future endeavors encompass 64-bit support, gas metering for contracts, and expanding compatibility beyond Linux x86. 

As the smart contract landscape undergoes a paradigm shift, PolkaVM stands as a beacon, illuminating the path to enhanced efficiency and unprecedented capabilities.

Read also; Moonsama unveils game-changing innovations in the NFT world

0 0 votes
Article Rating
Advertisement Earnathon.com
Click to comment
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Crypto News Update

Latest Episode on Inside Blockchain

Crypto Street

Advertisement



Trending

ALL Sections

Recent Posts

0
Would love your thoughts, please comment.x
()
x