Aqua CLI
Aqua CLI allows you to manage all aspects of Aqua development and includes:
  • Compiler
  • Client Peer
  • Utilities
To install the Aqua CLI package:
npm install -g @fluencelabs/aqua

The compiler turns high-level Aqua code into either JS/TS handlers wrapping AIR, the default, or pure AIR.
The quickest way to compile Aqua code is to take all .aqua files from the specified input directory, e.g., src/aqua, and place the generated JavaScript code in some output directory of your choosing, e.g. src/generated. Please note that if the specified output directory does not exist, the CLI creates it for you:
aqua --input src/aqua --output src/generated
Of course, we can be more specific and name a filename:
aqua --input src/aqua/some_file.aqua --output src/generated
As mentioned in the intro, the Aqua compiler generates .js with .d.ts TypeScript files by default. Output files will contain functions exported from .aqua files and methods for registering defined services. You can read more about calling functions and service registration in the FluenceJS documentation.
Additional compiler options are:
  • --js flag, which generates only .js files
  • --air or -a flag, which generates pure AIR code
  • --scheduled, which generates AIR code suitable for script storage
Use aqua --help for a complete listing of available flags, subcommands and explanations.

The CLI provides additional features and utilities via subcommands.

The aqua run command creates a one-shot client peer over the compiled Aqua code specified allowing you to quickly and effectively test Aqua code against deployed services on the network.
aqua run --addr <relay multidaddress> --input <your aqua filepath> --func '<function name>(<args>)'
For the following Aqua script:
-- some-dir/hello.aqua
service Hello("service_id"):
hello(name:string) -> string
func hello(name: string, node:string, sid: string) -> string:
on node:
Hello sid
res <- Hello.hello(name)
<- res
We instantiate our aqua client peer:
aqua run --addr /dns4/.../wss/p2p/12D3 ...aoHI --input some-dir/hello.aqua --func 'hello("reader", "peer id", ["service id1", "service id2"])'
The aqua run command provides additional features such as:
  • --sk or -s allows you to provide your secret key (sk) in base64
  • --addr or -a allows you to specify a relay in multiaddr format, e.g., /dns4/ . The aqua config default_peers <krasnodar, testnet, stage> command enumerates you the respective network multiaddresses of available Fluence nodes.
--import or -m allows you to import functionality from one or more source folders by using the flag repeatedly
  • --data or -d allows you to specify data arguments as a json map:
    aqua run --addr /dns4/.../wss/p2p/12D3 ... oHI --input my_code.aqua --func 'my_aqua_func(a, b)' --data '{"a": "some_string", "b": 123}'
  • --data-path or p allows you to specify data arguments, see --data, as a file. Note that --data and --data-path are mutually exclusive.
  • --json-service or -j allows you to describe a service that will return a JSON. This service must be described in Aqua. There can be multiple functions strictly without any arguments. Also, you can use this flag multiple times targeting multiple services in different files. There is an example of a service description in Aqua and JSON:
-- aqua file
data SomeResult:
field1: string
num2: i32
service ServiceName("some id"):
funcName: -> SomeResult
"name": "ServiceName",
"serviceId": "some id",
"functions": [{
"name": "funcName",
"result": {
"field1": "result 1",
"num2": 5
Use aqua run --help for a complete listing of available flags and explanations.

The aqua key create utility allows you to create an ed25519-based keypair in base64:
aqua key create
And produces the following json document:
"peerId": "12D3KooWMC6picJQNruwFMFWqP62FWLtbM94TGYEzCsthsKa46CQ",
"secretKey": "QG3Ot2i1kD4Mpw0RpsKtUjbA/0XjZ0WP7dajDBwLQi0=",
"publicKey": "CAESIKkB+6eYhFDsEZhn0u+xwIKVhE+1xvgJoV5/csc+CS6R"

A critical step is to get our WASm modules and service configuration files to our target hosts. The Aqua cli provides the capability to upload and configure our assets into hosted services under the aqua remote namespace:
aqua remote --help
aqua remote deploy_service
aqua remote remove_service
Deploy service from WASM modules
Remove service
See the service management section for details and examples.

The aqua config default_peers utility shows a list of peers in multiaddr format for a specific Fluence network. Currently, there are three environments: krasnodar, the default network,stage and testnet.
aqua config default_peers testnet
shows a list of testnet peers:
Copy link
On this page