Announcement: Easy-to-use Local Dev Testnet Docker Image

I made a little Docker Image to make it easier to run a local testnet. The image is minimal, self-contained & comes with some quality-of-life features.

check it out here:

The container runs best with host networking:

docker run \
  --rm \
  --network host \
  -e HOST_IP_ADDRESS="YOUR_HOST_IP_ADDRESS" \
  ghcr.io/rrauch/autonomi_testnet:latest

Just replace YOUR_HOST_IP_ADDRESS with the IP address of the host and you’re good to go.

Internally, it first starts an evm-testnet, followed by 25 antnodes. It also monitors the state of the nodes and will shutdown automatically if nodes fail.

Once started, the container will output all relevant details required to connect to stdout:

------------------------------------------------------
evm testnet details

> RPC_URL: http://YOUR_HOST_IP_ADDRESS:14143/
> PAYMENT_TOKEN_ADDRESS: 0x...
> DATA_PAYMENTS_ADDRESS: 0x...
> SECRET_KEY: 0x...

------------------------------------------------------
node details

53851   12D3KooW...
53852   12D3KooW...
...
53875   12D3KooW...

------------------------------------------------------

Bootstrap URL: http://YOUR_HOST_IP_ADDRESS:38112/bootstrap.txt

------------------------------------------------------

autonomi:config:local?rpc_url=http%3A%2F%2FYOUR_HOST_IP_ADDRESS%3A14143%2F&payment_token_addr=0x...&data_payments_addr=0x...&bootstrap_url=http%3A%2F%2F2FYOUR_HOST_IP_ADDRESS%3A38112%2Fbootstrap.txt

------------------------------------------------------

The testnet is ephemeral - all state is lost after container shutdown. This also means that peer_ids change after a restart. Because of this, the container also exports a bootstrap file at http://<HOST_IP_ADDRESS>:38112/bootstrap.txt to make it easier for the client to find the nodes.

I’ve tried to document the settings to get the client to connect to the local testnet in the README.

Hope it can save someone a little time and nerves.

12 Likes

Quick update: I’ve released a new version with some improvements, features, better error handling and hopefully a better description how to use it.

The main change is extra validation of the provided configuration against the actual network settings inside the container. This should lead to clearer errors when the details don’t align correctly.

The improved docs should make things clearer, here is an excerpt:

Running the Testnet

Getting this testnet container running smoothly, especially connecting your clients to it, means thinking a bit about networking. The services inside the container (the Autonomi nodes, the EVM, the bootstrap server) need to be directly reachable by your client applications running outside the container, usually on the same local network.

There’s a check built into the container startup: the EXTERNAL_IP_ADDRESS you set must be an IP address that the container itself actually has access to on one of its network interfaces. This is a bit unusual for a container! It means typical setups where Docker gives the container a private, internal-only IP won’t work properly and the container won’t start. You need a network setup where the container gets an IP reachable from your clients. The easiest way to handle this is using --network host, which makes the container share your hosts’s network address directly.

The new feature is ANTNODE_SOURCE:

Controls which antnode binary is used. Set to LATEST to download the most recent version on startup, or any other value to use the version bundled within the Docker image.

3 Likes