Skip to content

Modify an existing Horcrux architecture

Mon | Cumulo edited this page Jun 8, 2024 · 5 revisions

This section explains the modification of the structure of a signers and sentinel node architecture of an already running model. Taking into account that the nodes of the first model are already running, we will prepare an additional structure and replace it on top of the previous one, with the system running.

MODEL

Change from a 2 sentrys & 1 signers model -> a new 3 sentrys & 3 signers model.

1️⃣ Create a working directory for the new structure on your local machine

mkdir horcrux_model2  
cd horcrux_model2  

2️⃣ Initialise the shared configuration for cosigners in your new working directory using the --home flag:

Create the new config.yaml configuration file and save it in the temporary working folder:

horcrux config init --node "tcp://192.168.1.100:1234" --node "tcp://192.168.1.101:1234" --node "tcp://192.168.1.102:1234" --cosigner "tcp://192.168.1.103:2222" --cosigner "tcp://192.168.1.104:2222" --cosigner "tcp://192.168.1.105:2222" --threshold 2 --grpc-timeout 1000ms --raft-timeout 1000ms --home /home/<user>/horcrux_model2  

3️⃣ Re-initialise the shared configuration for co-signatories in your new working directory:

horcrux create-ecies-shards --shards 3 --home /home/<user>/horcrux_model2  

image

4️⃣ Re-generate the encryption keys for p2p co-signer-to-signer communications in your new working directory:

horcrux create-ed25519-shards --chain-id <chain> --key-file ./priv_validator_key.json --threshold 2 --shards 3 --home /home/<user>/horcrux_model2`  
![image](https://github.com/Cumulo-pro/Horcrux-Architecture/assets/2853158/c81f82d6-b358-4497-8f3e-7ecbd1b02a38)  

5️⃣ Prepare the new configuration folder for the signatories that will be replaced when migrating the architecture:

mkdir .horcrux2  
mkdir ~/.horcrux2/state  

Copy the configuration files to the .horcrux2 folder.

6️⃣ Now distribute the .horcrux2 folder to each of the signing nodes.

Each of the signatory nodes will have to have the following configuration files: ~/.horcrux2/
    config.yaml
    ecies_keys.json
    <CHAIN_ID>_shard.json
    /state
       <CHAIN_ID>_priv_validator_state.json

7️⃣ Share the state of consensus among the signatories

You need to share the content of the $NODE_HOME/data/priv_validator_state.json file.

✔️ Stop the validator node and ❗️ONLY after it stops open the priv_validator_state.json file and check the "height" number.

At the validator node:

sudo systemctl stop <noded>  
cat .<NODE_HOME>/data/priv_validator_state.json    

Example:
{
   "height": "361402",
   "round": 0,
  "step": 3,
  "signature": "IEOS7EJ8C6ZZxwwXiGeMhoO8mwtgTiq6VPR/F1cpLZuz0ZvUZdsgQjTt0GniAIgosfEjC5izKw4Nvvs3ZIceAw==",
   "signbytes": "6B080211BA8305000000000022480A205D4E1F722F53A3FD9E0D28639D7CE7B588338570EBA5C340687C30609C47BCA41224080112208283B6E16BEA46797F8AD4EE0ACE424AC7A4827202446B2D56E7F4438541B7BD2A0C08E4ACE28B0610CCD0AC830232066A756E6F2D31"
}

✔️You will need to replace the contents of _~/.horcrux2/state/<CHAIN_ID>priv_validator_state.json each signing node with a truncated and slightly modified version of the file. Note especially the "round" value:

{
   "height": "361402",
   "round": "0",
  "step": 3
}

8️⃣ Once these steps have been taken, we proceed to replace the folder of all the signing nodes:

sudo mv .horcrux .horcrux_bak  
sudo mv .horcrux2 .horcrux  

Repeat steps 5 and 6 of the Installation-and-Usage-Guide.

If all went ok, the system should now be running on the new architecture.