Klever VM and Smart Contracts

The execution of SmartContracts is fundamental in modern blockchain networks, and Klever has developed a swift and secure virtual machine for this very purpose.

The Klever VM, powered by WebAssembly, allows the execution of smart contracts in any programming language that can be compiled to WASM bytecode. It’s important to note that our support is currently tailored specifically for writing contracts in Rust.

Developers are strongly encouraged to opt for Rust when creating their smart contracts. Klever provides a dedicated Rust framework designed to produce exceptionally clean and efficient code for smart contracts, a rare feature in the blockchain industry. Additionally, a declarative testing framework is bundled for robust development.

For an optimal coding experience, developers can take advantage of the Klever IDE. Explore the sidebar for tutorials to kickstart your journey and refer to the Rust framework documentation for comprehensive guidance.

Advanced Features

The Klever VM is meticulously crafted for optimal speed and security. This commitment to excellence doesn’t impose unnecessary restrictions on smart contract capabilities. The VM provides a robust API known as the Klever Environment Interface, designed to be comprehensive and user-friendly.

Statelessness for Robust Execution

The Klever WASM VM operates as a stateless virtual machine. During smart contract execution, direct writes to the blockchain or storage are prohibited. This intentional design choice eliminates the need for reverting operations. Instead, the API accumulates changes made by the smart contract into a transient data structure. These changes are applied to the storage and/or blockchain only at the end of successful execution. Reading the global state is permitted at any time.

In effect, the global state remains unaffected until the execution ends.

Fast Execution Engine

The Klever VM executes code using Wasmer as an execution engine, operating as a just-in-time streaming compiler. Due to Wasmer’s design, smart contracts are executed at near-native speed.

The embedded version of Wasmer in the VM includes modifications for accurate metering with configurable costs per individual WASM opcode. Beyond metering, Klever has enhanced Wasmer to support preemptive execution control at runtime, enabling immediate cessation of a smart contract by the VM if necessary. Additionally, compilation efficiency has been improved, and floating-point operations have been forbidden to ensure strict determinism.