Fluence Network

The Fluence Labs Developer Hub

Welcome to the Fluence Labs developer hub. You'll find comprehensive guides and documentation to help you start working with Fluence Labs as quickly as possible, as well as support if you get stuck. Let's jump right in!

Should you have any questions, feel free to join our Discord or Telegram!

Get Started

Instructions

Below is the description of the instructions used in AIR scripts.

call: execution

This instruction is intended to launch the execution of a function. It works as follows:

  • The function is executed on the peer specified by the location parameter.
  • The peer is expected to have the WASM service specified by the service parameter.
  • The service must have a callable function specified be the function parameter.
  • The arguments specified by the argument list parameter are passed to the function.
  • The result of the function is saved and available under the name output name.
    The above example of the call instruction can be thought of as data.result = dht.put(key, value)

seq: sequential

The seq instruction takes two instructions as its arguments and executes them sequentially, one after the other.

par: parallel

The par instruction takes two instructions two instructions as its arguments and executes them in parallel.

fold: iteration

This instruction is intended for iterating over the elements of an array. It works as follows:

  • The fold instruction takes three arguments: an array, a variable, and an instruction.
  • At each iteration, the variable is assigned an element of the array and the argument-instruction is executed.
  • The argument-instruction can access the variable and uses the next statement to trigger the next iteration.

xor: branching & error handling

This instruction is intended for organizing branches in the flow of execution as well as for handling errors. It works as follows:

  • The xor instruction takes two instructions as its arguments.
  • The first instruction is executed.
    - If the execution is successful, then the second instruction is ignored.
    - If the first instruction fails, then the second one is executed.

null

This is an empty instruction: it takes no arguments and does nothing. The null instruction is useful for generating code.

Updated a day ago

Instructions


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.