This is a quick guide that will help you to be productive in hacking Fluence.

Overview

Fluence is an open protocol, permissionless network and stack of open source Web3-oriented, p2p-based technologies. The network consists of Fluence Peers which run in browsers, as node.js processes, or, as a backbone of the network, Rust nodes. Peers are addressable by Peer IDs which are derived from a node’s public key.

Every Fluence Peer organizes local resources (storage, memory, compute), connections pool, and the control plane in between.

Local resources are structured as Services, where each service exposes one or more functions which are accessible from the network. Examples of services include:

WebAssembly-based services are portable, reusable and secure and can be deployed to Rust nodes. Fluence uses Marine as the WebAssembly runtime and provides the necessary tooling such as the SDK, REPL and testkit.

Alternatively, services can be programmed with TypeScript or any other JS-compatible language using Fluence JS. While Fluence JS-based services might be easier to develop than services based on Rust or C/C++ Wasm modules, they require you to run your own Fluence peer(s), which is native to browser-type use cases but an additional burden for backend-type services. The tool is https://github.com/fluencelabs/fluence-js.

The only way to interact with Services on the Fluence network is by using Aqua. Aqua is Fluence’s distributed language that executes on the AquaVM, which is bundled within every Fluence peer. Aqua expresses what service function to call on which peer, what to do and how to do it, e.g., as a sequence, parallel, fork or join operation, with some loop and control if and for statements thrown in for good measure.

The Aqua compiler is distributed via NPM and requires Javascript. For your convenience, Aqua libraries, as plain .aqua files, are also distributed as NPM packages.