π Horcrux
Horcrux is a distributed signing tool that splits the validator's private key into multiple parts, ensuring its security. This approach prevents key compromise even if one part is accessed.
Preparing the Infrastructure
Horcrux requires at least two servers (three or more are recommended) to split the key. Setup involves:
Horcrux servers for distributed signing.
Validator node to interact with the blockchain network.
Ensure the following:
SSH access and server setup.
Install Horcrux on each server.
Configure firewalls to allow communication between servers on the Horcrux ports.
Time synchronization: Make sure all servers use NTP for synchronized time.
Server Requirements for Horcrux-Based Validator Setup
Signer Nodes (Horcrux Co-signers)
Type: VPS (Virtual Private Server) Recommended Specifications:
CPU: 4 vCPU
RAM: 4 GB
Storage: 80 GB NVMe SSD
Network: 1 Gbps bandwidth
Required Open Ports:
2222 β for communication between Horcrux co-signers
SSH (22) β for remote administration
Prometheus port (optional, if using monitoring)
Sentry Nodes (Validator Nodes or Observers)
Type: Bare-metal or VPS Recommended Specifications:
CPU: 4 vCPU
RAM: 16 GB
Storage: 250 GB SSD
Network: Stable and fast connection
Required Open Ports:
1234 β private port for connection from Horcrux signers
26656 β P2P port for communication with the blockchain network
Update system and install build tools
Install GO
Installing Horcrux
Run the following commands on each co-signer node:
After installation, verify it with:
Initialize Horcrux Configuration
Run the following command on one of the co-signer nodes to generate the shared configuration:
π§ Note:
Replace
<VALIDATOR_IP_X>
with the actual IP addresses of your validator (or sentry) nodes that expose thepriv_validator_laddr
port (1234
).Replace
<COSIGNER_X_IP>
with the IPs of each co-signer node using port2222
.The order of the
--cosigner
flags determines which shard (cosigner_1
,cosigner_2
,cosigner_3
) goes to which server. Be consistent when distributing keys and configuration files.
Generate ECIES Keys (for Secure Communication Between Co-Signers)
Run this once to generate the ECIES encryption keys:
This will create the following directory structure:
Fragment the Validator Private Key
β οΈ Copy the
priv_validator_key.json
file from your validator node into your working directory before running this command.
Then run:
This will update the structure:
β
At this point, you should move priv_validator_key.json
to a secure storage location β it is no longer needed in the signer environment.
Distribute Config Files to Co-Signer Nodes
Each co-signer node must have the following files placed in their respective ~/.horcrux/
directory:
β Important: Ensure that each cosigner receives only their own files according to the order in which you ran
horcrux config init
and generated shards (i.e., cosigner_1, cosigner_2, cosigner_3).
Setting Up the Horcrux Service
Create a service file: On each server, create a file at /etc/systemd/system/horcrux.service
:
Start and check the service:
Share Consensus State Between Signers
Each signer node must start from the same consensus state to avoid double-signing.
π On the validator node:
Open the validator's consensus state file:
Example output:
Create a stripped-down version of this file to be placed in each co-signerβs state directory:
Copy this file to all co-signer nodes as:
Configuring the Validator Node
Update the validator's configuration file: In the
config.toml
file of your validator node, specify the remote Horcrux address for signing:
Restart the validator:
Check Horcrux logs:
Monitoring and Testing
Check connectivity: Ensure the validator node successfully connects to the Horcrux servers.
Test signing: Verify transactions are signed correctly by creating a test transaction on the network.
Setup monitoring: Use tools like Prometheus and Grafana to monitor the validator and Horcrux servers.
Security Recommendations
Isolate Horcrux servers: Restrict access to only the validator node.
Keep software updated: Regularly update Horcrux and the operating systems.
Backup configuration: Store copies of the configuration and key shares in a secure location.
Last updated