Setting Up Your Geode Validator Node

Welcome to the Geode Network! Here is everything you need to set up your validator node. Let’s Get Started…

STEP 1: Clone The “Geode” Code Folder To Your Hard Drive
Open a CLI Terminal window. It doesn’t matter which directory as long as you know the path to get to it. Git clone the Geode code folder to your VM using this command:

git clone https://github.com/geodechain/Geode.git	

STEP 2: Install Rust And Other Necessary Software 
Make sure your Linux is up to date and install Rust with the following commands (one line at a time, copy and paste them into your CLI Terminal and press Enter)…

sudo apt-get update
sudo apt upgrade
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup update	

⚠️ If your computer does not recognize the “rustup” command,  restart the terminal window/app. If the command is still not recognized, restart your computer.

Install the remaining items with the following commands, in order, one line at a time…

sudo apt install make clang pkg-config libssl-dev build-essential
sudo apt install gcc-multilib
sudo apt install llvm
sudo apt install protobuf-compiler
rustup install nightly-2023-01-20
rustup default nightly-2023-01-20
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
rustup target add wasm32-unknown-unknown --toolchain nightly-2023-01-20	

⚠️ If you get “Unmet dependencies” at any point, try the command 
apt --fix-broken install or apt install —fix-broken
STEP 3: Compile The Chain Runtime Code
In your CLI window, navigate to the Geode folder. Compile the Geode runtime by entering the following command

cargo build --release	

Go get a snack or take a mediation break. This build can take 20-40+ minutes.

STEP 4: Make Your Keys And Accounts Using SubKey
Now that you have compiled the code, you have an extra utility in the code folder called SubKey that lets you make validator keys and coin accounts in a secure environment (even offline!). Each of your nodes will need its own set of: BABE, GRANDPA, STASH and CONTROLLER keys.

In your CLI navigate to the Geode folder… 

Make your BABE key using this command:

./target/release/substrate key generate --scheme Sr25519 --password-interactive	

➡️	It will ask you to choose and type in a password. It will not show you the password so just paste it in and press Enter.
➡️	Copy ALL of the output to a text file for later. This is your BABE keyset. 
⚠️	The “suri” is the secret seed
⚠️	The “URI” is the secret 12 word phrase

Make your GRANDPA key using this command:

./target/release/substrate key inspect --password-interactive --scheme Ed25519	

➡️	It will ask you to for the URI - use the 12 word phrase from the BABE keys
➡️	Copy ALL of the output to your text file for later. This is your GRANDPA keyset.
⚠️	IMPORTANT: The BABE AND GRANDPA keysets should have the SAME URI and the SAME SURI, but DIFFERENT public keys. If they do not, go back and make BABE and GRANDPA keys again.
Make 2 Coin Accounts: A “STASH” and a “CONTROLLER”  using the same command as you did for the BABE key. Use this command to make one account and then use this command again to make another account (you can use this command to make as many accounts as you like!):

./target/release/substrate key generate --scheme Sr25519 --password-interactive	

➡️	It will ask you to choose and type in a password. 
➡️	Copy ALL of the output to your text file for later. These are your STASH and CONTROLLER accounts. 

STEP 5: Put Your BABE and GRANDPA Keys In The Keystore
➡️	Replace the NAME below in BOTH code blurbs with whatever you want to name your node. Replace the XXXXX below with the SECRET SEED (the SURI) that should be the same for both your BABE and GRANDPA keys. 
➡️	Copy the BABE Key Insert Code below, paste it into the CLI and press Enter.
➡️	It will ask you for the BABE password you chose in the previous step. 

./target/release/substrate key insert --base-path ./NAME \
  --chain GeodeSpec20230211RAW.json \
  --scheme Sr25519 \
  --suri XXXXX \
  --password-interactive \
  --key-type babe	

➡️	Copy the GRANDPA Key Insert Code below, paste it into the CLI and press Enter.
➡️	It will ask you for the GRANDPA password you chose in the previous step. 

./target/release/substrate key insert --base-path ./NAME \
  --chain GeodeSpec20230211RAW.json \
  --scheme Ed25519 \
  --suri XXXXX \
  --password-interactive \
  --key-type gran	

STEP 6: Start Your Validator Node 
➡️	Make sure your node NAME matches below and start up your node in VALIDATOR mode using this command:

./target/release/substrate \
  --base-path ./NAME \
  --chain ./GeodeSpec20230211RAW.json \
  --port 30333 \
  --ws-port 9955 \
  --rpc-port 9945 \
  --validator \
  --enable-offchain-indexing=true \
  --rpc-methods Unsafe \
  --name NAME \
  --bootnodes /ip4/207.244.232.237/tcp/30335/p2p/12D3KooWS6Zw8jy5yu5a2ShWBYk5E41GZ6wMVDyEBeCjBwGm2hUi \
  --password-interactive	

⚠️	IMPORTANT: if you are putting more than one node on the same machine, repeat steps 4 and 5 above for each node and CHANGE THE NAME AND THE PORTS (JUST INCREASE THE PORT NUMBERS BY 1) so that each node is operating on different ports.  

STEP 7: Connect Your Accounts, Bond And Activate Your Node
Bring up this site using CHROME or FIREFOX:

https://geodeapps.com/?rpc=ws://127.0.0.1:9955	

⚠️	If you have more than one node on this machine, or if your WS PORT in step 5 is something other than 9955, use whatever your WS PORT number is.

What you see here is the Geode custom UI pointed at YOUR NODE. You are getting YOUR NODE’s PERSPECTIVE on what is happening in the chain. 

⚠️⚠️⚠️	It is really important that you are pointed at your node like this before the next steps below…

➡️	ADD YOUR ACCOUNTS
Back at the Geode Portal…Go to Accounts and click + Account
	•	Choose Raw Seed and paste your STASH account SECRET SEED (SURI) here
	•	Make sure the account public key that is displayed at the top of this form matches your stash account
	•	Finish filling out the form
	•	Notice that an Account JSON file was downloaded for you - The title of the JSON file is the same as your public key for that account. Put that file somewhere convenient but safe. This is how you will retrieve your account if you loose the password. 
	•	Repeat this process to add your CONTROLLER account

⚠️⚠️⚠️	IMPORTANT: With great freedom, comes great responsibility. There is no centralized server keeping track of your accounts or keys. That is up to YOU. Keep it safe! If you lose it, you cannot get it back again and nobody can fix that for you. KEEP YOUR PASSWORDS, SECRET PHRASES, AND JSON FILES SOMEWHERE SAFE!! 

➡️	BOND AND ACTIVATE YOUR VALIDATOR NODE 
	1.	In the Geode Portal, click the checkbox to get the Advanced Menu then go to… Developer > RPC Calls and choose Author > RotateKeys
	2.	Click “Submit RPC Call”. It will produce a long hash.
	3.	Copy that ENTIRE hash. You will need it in the next step.
	4.	Now go to… Staking > Accounts and choose + Add Validator
	⁃	Set your STASH and CONTROLLER ACCOUNTS in the form
	⁃	Set your commission % (anything above 5% is considered a bit arrogant and may not get many nominators… 3% is reasonable… 1% will get you more nominators… but ultimately it is YOUR CHOICE.)
	⁃	Paste the hash from the last step when the form asks for it. 
	⁃	Sign and submit the transaction with your STASH password to bond and activate your validator node.

CONGRATULATIONS! YOU ARE NOW ONBOARD AS A GEODE VALIDATOR!

What Happens Next…

➡️	GETTING INTO THE VOTING SET
In 24 hours, your node has its first opportunity to enter the voting set. This is determined by the number of available validate nodes and by stake. The top staked nodes get into the set. If you do not get into the set, you need more total stake. You can get that by gathering nominations for your node. 

➡️	MAKING BLOCKS
Once you get into the voting set, make sure you see your node making blocks. Go to the Geode Portal and look at Staking > Overview. You should see your node with a green circle just to the left. The number in that green circle is how many blocks you have made. If there is no green circle with a number in it next to your node,  your node is not making blocks and will soon be kicked out of the voting set. See the Troubleshooting section for how to fix that.

➡️	GETTING DAILY PAYOUTS
If you make even one block in an era, you and your nominators will receive payouts at the end of that 24 hour era. To get your daily payouts go to Staking > Payouts and click Payout All. You can collect the payouts daily or weekly or up to every 84 days. When you collect your payouts your nominators will be paid automatically. Nominators tend to prefer Validators who payout Daily.

⚠️	Troubleshooting

➡️	If your node is: 
(1) not seeing any peers, 
(2) not connecting to the network, or 
(3) connected, and in the voting set, but not making blocks like other nodes
 
This is usually a key problem. We need to refresh your session keys…

	1.	Pull up a browser and go to: https://geodeapps.com/?rpc=ws://127.0.0.1:9955
	2.	If you cannot connect in, your node is probably down. See the instructions below for restarting your node.
	3.	In the Geode Portal, click to get the Advanced Menu and go to Developer > RPC Calls and choose Author > RotateKeys. 
	⁃	Copy the resulting hash and go to Staking > Accounts. 
	⁃	Look for the three dots all the way to the right of your validator account. Click the three dots and choose Change Session Keys. Paste in the hash. 
	4.	If that does not solve the problem, stop your node in the CLI on your machine, 
	⁃	make fresh BABE and GRANDPA keys, 
	⁃	put those keys into the keystore and 
	⁃	restart the node. 
	5.	Failing that, Chill your Validator on the Staking > Accounts page by clicking STOP next to your account 
	6.	and contact support on the Geode Discord.

➡️	If your node is down:
This happens from time to time due to temporary power outages, etc.

	•	Start your machine back up if it has powered down.
	•	In your terminal window, navigate to the Geode code folder. 
	•	Then use the up arrow to retrieve the code snippet that you originally used to start the node. Click enter. Alternately, you can copy the original node startup code from your files and paste it there and click enter. This will restart the node.
	•	Give the node minute to get back up and running 
	•	Check the Portal Staking > Overview page to see if you are making blocks. 
	•	If it has been too long and your node was kicked out of the voting set and therefore does not appear on the Staking > Overview page, then check the Staking > Accounts page to see if you need to click the Validate button to rejoin the set. Be sure to ROTATE KEYS after you have clicked VALIDATE.

➡️	Stubborn Key Issues
	•	In TERMINAL... 
	⁃	Navigate to this node’s specific folder. If your node is named “MyNode” then you are navigating to the folder Geode and digging down within the chain to find the MyNode folder.
	⁃	Inside the node folder you will see a folder called “keystore”. Delete this keystore folder using this command rm -r keystore
	•	Still in the TERMINAL app, go back to STEP 5 and put your original validator keys in the keystore. Then restart the node (STEP 6).
	•	End this TERMINAL app session and start a new one.
	•	In the GEODE PORTAL bring up the portal specifically for this node as seen in step 7: https://geodeapps.com/?rpc=ws://127.0.0.1:9955
	•	Go to... Developer > RPC Calls and choose Author > RotateKeys Click “Submit RPC Call”. It will produce a long hash.
	•	Copy that hash. You will need it in the next step.
	•	In the Staking > Accounts page, look for the VALIDATE button to the right of this node’s stash account. Click the VALIDATE button and follow the prompts.
	•	This node should now show up in Staking > Overview as WAITING. Give it 24 hours to get into the voting set.
	•	Then return to the Staking > Overview page to make sure it is making blocks. If you do not see a green circle with a number in it to the left of your node but all the other nodes do have a green circle with a number in it, your node is not making blocks. Rotate keys again while tunneled into your node.