Files
atomic-swap/docs/bootnode.md
2023-04-23 15:46:57 -05:00

1.5 KiB

Bootnode

The swap daemon uses a p2p network to discover offer-makers to do a swap with, and also the run the actual swap protocol. A node must know addresses of nodes already in the network to join the network. These nodes are often publicly posted and referred to as bootnodes. Bootnodes act as an entry-point into the p2p network.

This repo comes with a bootnode program that runs only the p2p components of a swap node, and thus can be used as a lightweight bootnode.

Requirements

Build and run

To build and run the bootnode binary:

make build-all
./bin/bootnode --env ENVIRONMENT

ENVIRONMENT is one of mainnet, stagenet, or dev.

To get the p2p addresses of the bootnode:

./bin/swapcli addresses

You can then distribute these addresses for other swap nodes to connect to.

Docker

  1. Ensure docker is installed on your machine.

  2. Build the docker image:

make docker-images
  1. For an example of how to run bootnode with docker on stagenet:
./scripts/docker-bootnode/run-docker-image.sh

This runs swapd on stagenet. The container name is bootnode-stagenet.

You can interact with it by running swapcli inside the container:

docker exec CONTAINER_NAME_OR_ID swapcli SUBCOMMAND ...

You can also set command line arguments with environment variables, eg. to run on mainnet:

SWAPD_ENV=mainnet ./scripts/docker-swapd/run-docker-image.sh