There is limited space for accepting new validators. New validators can only join the active set when an already active validator unbonds.
Prerequisites
- Three machines: One local machine on which you will run the Ansible playbook; two remote machines, one sentry and one validator.
- Ansible installed on the local machine.
- Python 3.x installed on the local machine.
- On the remote machines, make sure Go is not installed.
- Your local machine’s SSH public key added to the remote machines, allowing Ansible to connect to them.
Overview
To deploy a running validator node, follow these steps in the exact sequence:- Have the three machines prepared.
- Set up a sentry node through Ansible.
- Set up a validator node through Ansible.
- Configure the sentry node.
- Start the sentry node.
- Configure the validator node.
- Set the owner and signer keys.
- Start the validator node.
Set up the sentry node
On your local machine, clone the node-ansible repository:inventory.yml file.
Set up the validator node
At this point, you have the sentry node set up. Your local machine is also configured with an Ansible playbook to run the validator node setup. To check that the remote validator machine is reachable, runansible validator -m ping on your local machine.
You should see the following output:
If you run into an issue and would like to start over, run:
Configure the sentry node
Start by logging into the remote sentry machine.Configure Heimdall
Edit the configuration files under/var/lib/heimdall/configThe templates for each supported network are available here
Download the
genesis.json file and place it under /var/lib/heimdall/config/
Use the following commands based on your target network:
BUCKET_URL is
- https://storage.googleapis.com/amoy-heimdallv2-genesis/migrated_dump-genesis.json for amoy
- https://storage.googleapis.com/mainnet-heimdallv2-genesis/migrated_dump-genesis.json for mainnet
Configure the Bor service
Open the config file for editing by running:vi /var/lib/bor/config.toml.
In config.toml, ensure the boot node addresses consisting of a node ID, an IP address, and a port by adding them under bootnodes in [p2p.discovery] section. The bootnodes are provided in the next section.
In config.toml, ensure the static-nodes parameter has the following values:
"enode://validator_machine_enodeID@validator_machine_ip:30303": the node ID and IP address of Bor set up on the validator machine.
- Log into the validator machine.
- Run:
bor attach /var/lib/bor/bor.ipc - Run:
admin.nodeInfo.enode
Please note that the IPC console is only accessible when Bor is running. To get the enode of the validator node, setup the validator node and then run the above commands.
config.toml.
Seeds and Bootnodes
The latest bor and heimdall seeds can be found here. Adding them will ensure your node connects to the peers.Configure firewall
The sentry machine must have the following ports accessible from the public internet0.0.0.0/0:
-
Port
26656- Your Heimdall service will connect your node to other nodes’ Heimdall service. -
Port
30303- Your Bor service will connect your node to other nodes’ Bor service.
If the sentry node utilizes a VPN connection, it may restrict incoming SSH connections solely to the VPN IP address.
Start the sentry node
First, start the Heimdall service. Once the Heimdall service is fully synced, start the Bor service.The Heimdall service takes several days to fully sync from scratch. Alternatively, you can use a maintained snapshot, which will reduce the sync time to a few hours. For detailed instructions, see Snapshot Instructions for Heimdall and Bor.
Start the Heimdall service
Start the Heimdall service by running the following command:In the logs, you may see the following errors:
Stopping peer for errorMConnection flush faileduse of closed network connection
catching_up value signifies the following:
true: the Heimdall service is syncing.false: the Heimdall service is fully synced.
Start the Bor service
Once the Heimdall service is fully synced, start the Bor service using the following command.Configure the validator node
To complete this section, you must have your own RPC endpoint of your own fully synced Ethereum mainnet node ready.
Configure the Heimdall service
Log into the remote validator machine. Then, edit the configuration files under/var/lib/heimdall/configThe templates for each supported network are available here
Download the
genesis.json file and place it under /var/lib/heimdall/config/
Use the following commands based on your target network:
BUCKET_URL is
- https://storage.googleapis.com/amoy-heimdallv2-genesis/migrated_dump-genesis.json for amoy
- https://storage.googleapis.com/mainnet-heimdallv2-genesis/migrated_dump-genesis.json for mainnet
- Login to the sentry machine.
- Run
heimdalld comet show-node-id.
persistent_peers = "sentry_machineNodeID@sentry_instance_ip:26656"
prometheus: set the value totrueto enable the Prometheus metrics. Example:prometheus = true.
config.toml.
Now, open app.toml for editing by running: vi /var/lib/heimdall/config/app.toml.
In the app.toml file, update the following parameters:
eth_rpc_url: an RPC endpoint for a fully synced Ethereum mainnet node, e.g. Infura.eth_rpc_url =<insert Infura or any full node RPC URL to Ethereum>
eth_rpc_url = "https://nd-123-456-789.p2pify.com/60f2a23810ba11c827d3da642802412a"
- [Optional] Post Rio hardfork, which enables VeBlop architecture, validators are able to elect block producers through heimdall config flag
producer_votes, whose default validator"91,92,93". Change this value if needed, e.g.producer_votes="91,92,93".
app.toml.
Configure the Bor service
Open the config file for editing by running:vi /var/lib/bor/config.toml.
Update the value of static-nodes parameter as follows:
- Log into the sentry machine.
- Run
bor attach /var/lib/bor/bor.ipc - Run
admin.nodeInfo.enode
config.toml file.
Set the owner and signer key
On Polygon PoS, it is recommended that you keep the owner and signer keys different.- Signer: The address that signs the checkpoint transactions. It is advisable to keep at least 1 ETH on the signer address.
- Owner: The address that does the staking transactions. It is advisable to keep the POL tokens on the owner address.
Generate a Heimdall private key
To generate the private key, run:ETHEREUM_PRIVATE_KEY is your Ethereum wallet’s signer private key.
This will generate the priv_validator_key.json file. Move the newly generated JSON file to the Heimdall configuration directory using the following command:
Generate a Bor keystore file
To generate the private key, run:ETHEREUM_PRIVATE_KEY is your Ethereum wallet’s signer private key.
When prompted, set up a password to the keystore file.
This will generate a UTC-<time>-<address> keystore file.
Move the generated keystore file to the Bor configuration directory:
Add password.txt
Make sure to create a password.txt file, and then add the Bor keystore file password right in the /var/lib/bor/password.txt file.
Add your Ethereum address
Open the config file for editing by running:vi /var/lib/bor/config.toml.
/var/lib/bor/config.toml.
Start the validator node
Start the Heimdall service
First, start the Heimdall service on the validator machine. Once the Heimdall service is fully synced, you can run the Bor service. Start the Heimdall service using the following command:The rest service and the bridge both start along with Heimdall.
catching_up value signifies the following:
true: the Heimdall service is syncing.false: the Heimdall service is fully synced.