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

Advanced examples

Explore network

We can use the neighborhood function to explore peers in the network and gather their multi-addresses and Peer IDs.

(seq
    (seq
            ; gather neighborhood of hash(relay)
        (call relay ("dht" "neighborhood") [relay] neighs_top)
        (seq
                ; for each node in the neighborhood, gather neighborhood of hash(n)
            (fold neighs_top n
                (seq
                    (call n ("dht" "neighborhood") [n] neighs_inner[])
                    (next n)
                )
            )
                ; iterate through all gathered nodes (duplicates are possible)
            (fold neighs_inner ns
                (seq
                    (fold ns n
                        (seq
                                ; ask for identification info: multi-addresses, etc
                            (call n ("op" "identify") [] addresses[])
                            (next n)
                        )
                    )
                    (next ns)
                )
            )
        )
    )
    (seq
            ; send that collected data back 
        (call relay ("op" "identity") [])
        (call %init_peer_id% ("return" "") [addresses])
    )
)

Send script through several nodes and back

(seq
    (call relay ("op" "identity") [])
    (seq
        (call node_a ("op" "identity") [])
        (seq
            (call node_b ("op" "identity") [])
            (seq
                (call node_c ("op" "identity") [])
                (seq
                    (call relay ("op" "identity") [])
                    (call %init_peer_id% ("op" "identity") [])
                )
            )
        )
    )
)

Updated about a month ago

Advanced examples


Suggested Edits are limited on API Reference Pages

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