Build with the Fluentbase SDK

Deploy on the Fluent Public Devnet

The Fluentbase SDK is in experimental development and is still a work in progress. All bindings, methods, and naming conventions within the codebase are not standardized and may change significantly. Additionally, the codebase has not been audited or fully tested, which could lead to potential vulnerabilities or crashes.


Modules

  1. bin

A crate with a binary application that is used for translating Wasm apps to the Fluent rWasm VM. It’s required only for creating system precompile contracts where direct translation from Wasm to rWasm is needed.

  1. crates

Contains all Fluentbase modules.

Crates
Explanation

A crate with a custom ABI codec for encoding/decoding input messages.

This codec is optimized for random reads that are used to extract only required information from passed system context.

It’s very similar to Solidity ABI encoding, but uses a more Wasm friendly binary encoding and alignment.

A crate with all system precompiled contracts that brings support of different execution environment (EE) compatibility, including the EVM, SVM, Wasm and all corresponding system contracts like blake2, sha256, etc.

Core of EE runtimes with EVM, SVM, and Wasm support including deployment logic, AOT translation and contract execution.

Contains EVM AOT compiler.

A program for creating genesis files for the Fluent L2 network with precompiled system and compatibility contracts.

Library for poseidon hashing.

The fork of revm crate, but optimized and adapted for Fluentbase SDK methods and which maps the original revm’s database objects into Fluentbase’s structures. It’s needed to execute EVM transactions inside reth.

A basic execution runtime of rWasm that enables Fluentbase’s host functions.

A basic repository for developers where they can explore all required types and methods to develop their applications. It also includes macroses, definition of entrypoint, allocator, etc.

Contains basic primitive types for all crates.

Implementation of the zktrie (sparse merkle binary trie).

  1. e2e (partially outdated)

A set of e2e tests for testing EVM transition and other Wasm features.


Supported Languages

The Fluentbase SDK currently supports writing smart contracts in:

  • Rust

  • Solidity

  • Vyper


Example Code

Fluentbase can be used to develop different types of applications; in most cases, the same interface is utilized. Here is one simple application that can be developed using Fluentbase.

#![cfg_attr(target_arch = "wasm32", no_std)]
extern crate fluentbase_sdk;

use fluentbase_sdk::{basic_entrypoint, SharedAPI};

#[derive(Default)]
struct GREETING;

impl GREETING {
    fn deploy<SDK: SharedAPI>(&self) {
        // any custom deployment logic here
    }
    fn main<SDK: SharedAPI>(&self) {
        // b"Hello, world": "b" here tells the compiler that the string should be treated as a byte sequence. 
        // This is called a byte string literal.
        const HELLO: &[u8] = b"Hello, world";
        SDK::write(HELLO.as_ptr(), HELLO.len() as u32);
    }
}
basic_entrypoint!(GREETING);

Fluentbase Operation

Fluentbase operates using Fluent's rWasm VM (reduced WebAssembly). This VM employs a 100% compatible Wasm binary representation optimized for zk operations. The instruction set is reduced, and sections are embedded inside the binary to simplify the proving process.

Limitations and Future Enhancements

As of now, Fluentbase does not support floating-point operations. However, this feature is on the roadmap for future enhancements.

Last updated