Setting up custom networks
Custom Autonity networks
To connect your node to a custom Autonity network, you will need the network’s:
- bootnodes, specify statically in a
static-nodes.jsonfile or dynamically using the--bootnodescommand-line option. - genesis configuration file,
genesis.json.
See Local Autonity Network configuration in the Genesis reference for how to create these files.
A new node must connect to at least one known peer to discover additional peers and begin syncing.
To configure bootnodes for a custom network:
Obtain candidate enode addresses from one or more of the following sources:
- public RPC providers, using
admin_nodeInfowhere enabled, - validator dashboards,
- chain state queries,
- trusted node operators.
- public RPC providers, using
Verify TCP reachability:
nc -vz <ip> 30303Optionally, verify UDP reachability:
nc -vzu <ip> 30303Nodes with UDP port
30303open support more complete peer discovery.Configure one or more reachable peers using either of the following methods:
- add the enode addresses to a
static-nodes.jsonfile and place it in the chaindata directory, as described in Setting up custom networks, - pass a comma-separated list of enode addresses using the
--bootnodesoption when starting the client.
- add the enode addresses to a
Start the node. The node connects to the specified peer and expands its peer table. For best results, use a peer with both TCP and UDP port
30303open.
Example
nc -vzu 125.181.215.22 30303
Connection to 125.181.215.22 port 30303 [udp/*] succeeded!
nc -vz 125.181.215.22 30303
Connection to 125.181.215.22 port 30303 [tcp/*] succeeded!Note that the client provides a command-line option for connecting to the Autonity Bakerloo Testnet --bakerloo. The node will not run if you specify both genesis and bootnodes for a custom network and a testnet flag. The client will create a genesis block for the custom network’s genesis configuration and the node’s local store will then have an incompatible genesis with the testnet.
Install Autonity in a working directory and create an
autonity-chaindatasub-directory as described in Running a node, Install Autonity.Create and copy the bootnode file into the
autonity-chaindatasub directory:
cp ./<PATH>/static-nodes.json ./autonity-chaindata/- Create and copy the genesis file into the working directory:
cp ./<PATH>/genesis.json ./- Run the node as described in Running a node, Run Autonity, specifying your custom network by the options:
--genesis: to provide the genesis file.--networkid: to provide the network identifier. This is typically the same value as thechainIdfile in the genesis configuration file, but may be different.
autonity \
--datadir ./autonity-chaindata \
--genesis ./genesis.json \
--networkid 65110000 \
--http \
--http.addr 0.0.0.0 \
--http.api aut,eth,net,txpool,web3,admin \
--http.vhosts * \
--ws \
--ws.addr 0.0.0.0 \
--ws.api aut,eth,net,txpool,web3,admin \
--nat extip:<IP_ADDRESS>
;