mirror of
https://github.com/fluencelabs/aquavm
synced 2025-03-15 04:30:48 +00:00
* Use CJS instead of ESM * fix the issue with branch packages being pushed to npm as latest
Aquamarine
- composability medium
- allows developers to express network choreography in a script
- moves script & data from peer to peer in a single-use logical network with checking merkle proofs and signatures.
Fluence stack
Fluence nodes use aquamarine to coordinate requests between different services run by FCE:
Aquamarine Intermediate Representation
AIR: What is it?
- S-expression-based low-level language
- Controls Fluence network and its peers
- Inspired by WAT (WebAssembly Text Format)
- Meant to be a compile target
- Development meant to happen in a higher-level language
- Syntax is in flux, will change
Scripts written in AIR look like this:

- Gather chat members by calling chat.members
- Iterate through elements in members array, m = element
- Each m is an object, represented as array; [0] is the first field
(next m)
triggers next iteration
AIR: Instructions
call: execution

call
commands the execution- moves execution to a peer, specified by
location
- peer is expected to have specified WASM
service
- the
service
must have specifiedfunction
available to be called argument list
is given to thefunction
- result of the
function
is saved and available underoutput name
- example call could be thought of as
data.result = dht.put(key, value)
seq: sequential

seq
takes two instructions- executes them sequentially
par: parallel

par
takes two instructions- executes them in parallel
fold: iteration

fold
takes an array, a variable and an instruction- iterates through the array, assigning each element to the variable
- on each iteration instruction is executed
- instruction can read the variable
next
triggers next iteration
xor: branching & error handling

xor
takes two instructions- iff first instruction fails, second one is executed
null

null
takes no arguments- does nothing, useful for code generation
Languages
Rust
98.1%
Python
1.1%
TypeScript
0.6%
Shell
0.2%