Last active
March 4, 2022 20:05
-
-
Save ihor/2f39d8bf934ddb6a8affb4b77faa003a to your computer and use it in GitHub Desktop.
Step by step guide describing how to set up of Casperlabs Rust Validator Node on AWS from scratch using Ubuntu Server 20.04 LTS AMI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sources used: | |
- https://github.com/CasperLabs/casper-node/blob/v1.5.0/resources/production/README.md | |
- https://docs.google.com/document/d/1YO_WnjPt2sGJgPB1jm_hVDHYULYsjPEAtkiAiY0e3-0/edit# | |
- https://docs.casperlabs.io/en/latest/node-operator/index.html | |
- Discord | |
[✓] 1. Create casperlabs-validator security group that exposes the following ports to public: | |
- 7777 - for http access to the status endpoint: http://<IP Address>:7777/status. | |
- 34553 - to gossip with other nodes | |
[✓] 2. Launch a m5.xlarge using Ubuntu Server 20.04 LTS AMI with 250 GB EBS volume, attach the casperlabs-validator security group to it | |
[✓] 3. Create an elastic IP and assign it to the instance | |
[✓] 4. Install Casperlabs node software | |
sudo apt install dnsutils | |
wget --content-disposition https://bintray.com/casperlabs/debian/download_file?file_path=casper-client_1.6.0-2465_amd64.deb | |
sudo apt install ./casper-client_1.6.0-2465_amd64.deb | |
wget --content-disposition https://bintray.com/casperlabs/debian/download_file?file_path=casper-node_1.6.0-2465_amd64.deb | |
sudo apt install ./casper-node_1.6.0-2465_amd64.deb | |
[✓] 5. Generate node keys | |
cd /etc/casper/validator_keys/ | |
sudo casper-client keygen . | |
[✓] 6. Share public_key_hex with the Casperlabs team to get some tokens onto your account | |
cat /etc/casper/validator_keys/public_key_hex | |
[✓] 7. Set up pre-requisites for building contracts (needed to build the bid contract to bond to the network) | |
sudo apt purge --auto-remove cmake | |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null | |
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' | |
sudo apt update | |
sudo apt install cmake | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
sudo apt install libssl-dev | |
sudo apt install pkg-config | |
sudo apt install build-essential | |
[✓] 8. Build contracts | |
git clone git://github.com/CasperLabs/casper-node.git | |
cd casper-node/ | |
make setup-rs | |
make build-client-contracts -j | |
[✓] 9. Bond to the network | |
# Get an already bonded validator address from | |
cat /etc/casper/config.toml | grep known_addresses | |
sudo apt install jq | |
# Check your balance | |
casper-client get-state-root-hash --node-address http://127.0.0.1:7777 | jq -r # get <STATE_ROOT_HASH> | |
casper-client query-state --node-address http://127.0.0.1:7777 --key <PUBLIC_KEY_HEX> --state-root-hash <STATE_ROOT_HASH> | jq -r. # get <PURSE_UREF> | |
casper-client get-balance --node-address http://127.0.0.1:7777 --purse-uref <PURSE_UREF> --state-root-hash <STATE_ROOT_HASH> | jq -r | |
# Make a bonding request | |
casper-client put-deploy \ | |
--chain-name "<NETWORK_NAME>" \ | |
--node-address "http://<BONDED_VALIDATOR_IP>:7777/" \ | |
--secret-key "/etc/casper/validator_keys/secret_key.pem" \ | |
--session-path "$HOME/casper-node/target/wasm32-unknown-unknown/release/add_bid.wasm" \ | |
--payment-amount 1000000000 \ | |
--session-arg=public_key:"public_key='<PUBLIC_KEY_HEX>'" \ | |
--session-arg=amount:"u512='<BID_AMOUNT>'" \ # put some unique number (to make it easier to identify your transaction later) | |
--session-arg=delegation_rate:"u64='10'" # change the delegation rate if you want to | |
# Check that you bonding request worked | |
casper-client get-deploy --node-address http://<BONDED_VALIDATOR_IP>:7777 <BONDING_DEPLOY_HASH> | jq .result.execution_results | |
# Query the auction info and look for your bid (unique bid amount) | |
casper-client get-auction-info --node-address http://<BONDED_VALIDATOR_IP>:7777 | |
[✓] 10. Run the node | |
# Get the trusted hash value from an already bonded validator and update it in /etc/casper/config.toml | |
curl -s http://<BONDED_VALIDATOR_IP>:7777/status | jq .last_added_block_info.hash | |
# Update trusted_hash property at the top of the config file | |
sudo nano /etc/casper/config.toml | |
# Start the node | |
sudo systemctl start casper-node | |
# Observe the log, look for log messages with 'linear block' | |
tail -n100 -f /var/log/casper/casper-node.log | |
# Check if an already bonded validator sees your node among peers | |
curl -s http:/<BONDED_VALIDATOR_IP>:7777/status | jq .peers | |
# Check the node status, which will be unavailable at the beginning but will come online later. Wait for the following line in the log {"message":"started HTTP server","address":"0.0.0.0:7777"} | |
curl -s http://127.0.0.1:7777/status | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, bintray servers looks like to do not share anymore Debian packages.