WEB3DEV

Yan Luiz
Yan Luiz

Posted on

Execution Stack Comparison: Revive (PolkaVM) vs EVM vs Bare Metal

I'm currently studying the revive-pallet and how to deploy Solidity contracts on Polkadot Asset Hub. Before diving into implementation, it's important to understand the execution model and its advantages.

This post looks at how a domain-specific rule, written in Solidity, is ultimately executed by the hardware. By comparing the execution stacks of Solidity on the Ethereum Virtual Machine (EVM), bare metal code, and Revive on PolkaVM, we highlight how Revive reduces abstraction layers through LLVM compilation to RISC-V and execution on a lightweight virtual machine.

This approach brings smart contracts closer to the hardware, enabling faster and more efficient execution. It echoes the insights from this Reddit discussion: What makes languages blazingly fast? where fewer layers lead to better performance and control.

Revive (PolkaVM with RISC-V ISA)

[ Your Solidity Code ]
       ↓
[ YUL → LLVM → RISC-V (via Revive) ]
       ↓
[ PolkaVM Interpreter (RISC-V-based) inside Substrate Runtime ]
       ↓
[ Host OS (e.g. Linux) ]
       ↓
[ CPU ISA (x86_64) ]
       ↓
[ Control Unit + ALU ]
       ↓
[ Transistors moving bits ]
Enter fullscreen mode Exit fullscreen mode

🔁 EVM (Ethereum Virtual Machine)

[ Your Solidity Code ]
       ↓
[ solc → EVM Bytecode ]
       ↓
[ EVM Interpreter or JIT (within Ethereum client) ]
       ↓
[ Ethereum Client (Geth, etc) ]
       ↓
[ Host OS ]
       ↓
[ CPU ISA (x86_64) ]
       ↓
[ Control Unit + ALU ]
       ↓
[ Transistors moving bits ]
Enter fullscreen mode Exit fullscreen mode

⚙️ Bare Metal (C, Rust no_std, ASM)

[ Your Code (C, Rust no_std, ASM) ]
       ↓
[ CPU ISA (x86_64) ]
       ↓
[ Control Unit + ALU ]
       ↓
[ Transistors moving bits ]
Enter fullscreen mode Exit fullscreen mode

🔍 Key Differences

Aspect Revive (PolkaVM) EVM (Ethereum) Bare Metal
Abstraction Medium (LLVM → RISC-V VM in runtime) High (EVM + Client + OS) None
Execution Target RISC-V -> PolkaVM EVM bytecode in virtual CPU Native CPU ISA
Toolchain Solidity → YUL → LLVM → RISC-V Solidity → EVM bytecode C/Rust → Native machine code
Performance High (RISC-V, register-based, low-overhead VM) Low (heavily sandboxed, gas metered) Max (no layers, direct execution)
Environment Polkadot node (Wasm runtime, no full OS in VM) Full OS + Ethereum client stack Bare hardware or minimal bootloader
Security Model Controlled, sandboxed in Substrate runtime Fully sandboxed, audited Fully exposed, manually secured
Compilation Recompilation to efficient RISC-V ISA Bytecode interpreted or JIT Native binary directly executed

📌 Conclusion

Revive brings Solidity much closer to hardware than traditional EVM. By compiling YUL to RISC-V using LLVM and running it inside a lightweight register-based PolkaVM, it strips away multiple abstraction layers present in standard EVM execution. While it's not true bare metal, it's architected for performance and low-latency execution, with a design much closer to the "bare metal" spirit than legacy EVM chains.

Let me know if you want this turned into a visual slide or blog-ready Markdown.

Oldest comments (0)