Skip to main content

Setup a swarm

An Actyx swarm is a mesh of nodes communicating in a local network. A swarm may have 1 to N nodes in it.

swarms

A swarm is defined by a single property, the so-called swarm key. In order to participate in a swarm, a node must have the secret swarm key.

Note that you can do all of the following steps either with the Actyx CLI, or the Actyx Node Manager.

Create a swarm key

Default configuration

By default, Actyx nodes are configured with a public swarm key. However, in this case your swarm is not secure inside your network. For production usage, we advise creating your own swarm key.

You can create a swarm key with the Actyx CLI:

ax swarms keygen
Generating swarm key, it might take some seconds...
L2tleS9zd2FybS9wc2svMS4wLjAvCi9iYXNlMTYvCjZiNjkzNTQzNGM0Yzc5NjY2OTM4NTkzMjM0Njg0MTY5MzA3NzQ1NmU0MjVhMzk2ZDU3NmE3OTRmNTIzMTc3NTk=

Join the swarm with a node

The swarm key is a node setting. You can use ax settings set to configure it:

ax settings set /swarm/swarmKey L2tleS9zd2FybS9wc2svMS4wLjAvCi9iYXNlMTYvCjZiNjkzNTQzNGM0Yzc5NjY2OTM4NTkzMjM0Njg0MTY5MzA3NzQ1NmU0MjVhMzk2ZDU3NmE3OTRmNTIzMTc3NTk= localhost

If you configure nodes in the same network with the same swarm key, they will automatically connect to each other via mDNS. If mDNS is disabled on your device or network, or you are running Actyx on Docker, you have to manually configure initial peers.

For more information on how nodes discover and connect to each other, please check out our conceptual guide on discovery.