By choosing to participate in the Casper Test Net, you acknowledge that you have reviewed and will abide by the Test Net Code of Conduct and Incentive Requirements. Failure to do so may reduce or fully disqualify any Test Net incentive participation.
Before you set up your node, make sure it conforms to the minimum Recommended Hardware Specifications
Create casperlabs-validator
security group that exposes the following ports to public:
7777
- rpc port8888
- status port9999
- event stream port35000
- gossip port
Launch an appropriately powered instance using Ubuntu Server 20.04 LTS AMI and at least a 2TB EBS volume, and attach the casperlabs-validator
security group to it
Create elastic IP and assign it to the instance
By choosing to participate in the Casper Test Net, you acknowledge that you have reviewed and will abide by the Test Net Code of Conduct and Incentive Requirements. Failure to do so may reduce or fully disqualify any Test Net incentive participation.
Before you set up your node, make sure it conforms to the minimum Recommended Hardware Specifications
Do not execute all the commands below as root.
sudo
is included where it is required.Expect that setting up a node and bonding it to the network will take about 30 minutes
In your firewall set-up, make sure you expose the following ports to public and that they're routed to your node:
7777
- rpc port8888
- status port9999
- event stream port35000
- gossip port
Set a variable defining the version of the node package you're setting up. For 1.0.0
, use 1_0_0
CASPER_VERSION=1_0_0
Set a variable defining the network name you're trying to set up. For example, for Main Net, use casper
, while for Test Net use casper-test
CASPER_NETWORK=casper-test
sudo apt-get update
sudo apt install dnsutils -y
The node uses dig
to get external IP for autoconfig during the installation process
sudo apt install jq -y
We will use jq
to process JSON responses from API later in the process
If you were running previous versions of the casper-node on this machine, first stop and remove the old versions:
sudo systemctl stop casper-node-launcher.service
sudo apt remove -y casper-client
sudo apt remove -y casper-node-launcher
sudo rm /etc/casper/casper-node-launcher-state.toml
sudo rm -rf /etc/casper/1_0_*
sudo rm -rf /var/lib/casper/*
Execute the following in order to add the Casper repository to apt
in Ubuntu.
echo "deb https://repo.casperlabs.io/releases" bionic main | sudo tee -a /etc/apt/sources.list.d/casper.list
curl -O https://repo.casperlabs.io/casper-repo-pubkey.asc
sudo apt-key add casper-repo-pubkey.asc
sudo apt update
sudo apt install casper-node-launcher -y
sudo apt install casper-client -y
cd ~
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 -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
sudo apt install libssl-dev -y
sudo apt install pkg-config -y
sudo apt install build-essential -y
BRANCH="1.0.20" \
&& git clone --branch ${BRANCH} https://github.com/WebAssembly/wabt.git "wabt-${BRANCH}" \
&& cd "wabt-${BRANCH}" \
&& git submodule update --init \
&& cd - \
&& cmake -S "wabt-${BRANCH}" -B "wabt-${BRANCH}/build" \
&& cmake --build "wabt-${BRANCH}/build" --parallel 8 \
&& sudo cmake --install "wabt-${BRANCH}/build" --prefix /usr --strip -v \
&& rm -rf "wabt-${BRANCH}"
Go to your home directory and clone the node repository. Later we will use this path to the smart contracts in our bonding request.
cd ~
git clone git://github.com/CasperLabs/casper-node.git
cd casper-node/
Note
Verify that the version of your contracts matches the version of the casper-node software you have installed.
git checkout release-1.2
make setup-rs
make build-client-contracts -j
Navigate to the default key directory:
cd /etc/casper/validator_keys
And execute the following command to generate the keys:
sudo -u casper casper-client keygen .
It will create three files in the /etc/casper/validator_keys
directory:
secret_key.pem
- your private key; never share it with anyonepublic_key.pem
- your public keypublic_key_hex
- hex representation of your public key; copy it to your machine to create an account
Save your keys to a safe place.
Install the Signer app, and import your secret_key.pem
file following the steps described under the New User (Has Secret Keys)
section of the Signer Guide.
Go to Testnet CSPR.Live, and connect with the account you want to fund. Click Tools
from the top navigation menu, then click Faucet
. Wait for the faucet page to load, and click the Request tokens
button. Wait until the request transaction succeeds.
sudo -u casper /etc/casper/pull_casper_node_version.sh $CASPER_NETWORK.conf $CASPER_VERSION
sudo -u casper /etc/casper/config_from_example.sh $CASPER_VERSION
Let's get a known validator IP first. We'll use it multiple times later in the process.
KNOWN_ADDRESSES=$(sudo -u casper cat /etc/casper/$CASPER_VERSION/config.toml | grep known_addresses)
KNOWN_VALIDATOR_IPS=$(grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' <<< "$KNOWN_ADDRESSES")
IFS=' ' read -r KNOWN_VALIDATOR_IP _REST <<< "$KNOWN_VALIDATOR_IPS"
echo $KNOWN_VALIDATOR_IP
After running the commands above the $KNOWN_VALIDATOR_IP
variable will contain IP address of a known validator.
Setting the
trusted_hash
is only required if you join the network after Genesis has taken place. If you are joining prior to Genesis, you may skip this step and continue at "Start the node".
Get the trusted hash from the network:
# Get trusted_hash into config.toml
TRUSTED_HASH=$(casper-client get-block --node-address http://$KNOWN_VALIDATOR_IP:7777 -b 20 | jq -r .result.block.hash | tr -d '\n')
if [ "$TRUSTED_HASH" != "null" ]; then sudo -u casper sed -i "/trusted_hash =/c\trusted_hash = '$TRUSTED_HASH'" /etc/casper/$CASPER_VERSION/config.toml; fi
"Staging an upgrade" is a process in which you tell your node to download the upgrade files and prepare them, so that they can automatically be applied at the pre-defined activation point. Stage all of the following upgrades from the oldest to the newest (from the top to the bottom).
For this upgrade, to casper-node v1.1.0
, the activation point is Era 166
. In order to not have points deducted for your Testnet reward score, you have to make sure you have properly staged the upgrade well ahead of the activation point, so that your node will be upgraded on time.
Execute the following two commands, one by one:
sudo -u casper /etc/casper/pull_casper_node_version.sh casper-test.conf 1_1_0
sudo -u casper /etc/casper/config_from_example.sh 1_1_0
For this upgrade, to casper-node v1.1.2
, the activation point is Era 388
. In order to not have points deducted for your Testnet reward score, you have to make sure you have properly staged the upgrade well ahead of the activation point, so that your node will be upgraded on time.
Execute the following two commands, one by one:
sudo -u casper /etc/casper/pull_casper_node_version.sh casper-test.conf 1_1_2
sudo -u casper /etc/casper/config_from_example.sh 1_1_2
For this upgrade, to casper-node v1.2.0
, the activation point is Era 490
. In order to not have points deducted for your Testnet reward score, you have to make sure you have properly staged the upgrade well ahead of the activation point, so that your node will be upgraded on time.
Execute the following two commands, one by one:
sudo -u casper /etc/casper/pull_casper_node_version.sh casper-test.conf 1_2_0
sudo -u casper /etc/casper/config_from_example.sh 1_2_0
For this upgrade, to casper-node v1.2.1
, the activation point is Era 1143
. In order to not have points deducted for your Testnet reward score, you have to make sure you have properly staged the upgrade well ahead of the activation point, so that your node will be upgraded on time.
Execute the following two commands, one by one:
sudo -u casper /etc/casper/pull_casper_node_version.sh casper-test.conf 1_2_1
sudo -u casper /etc/casper/config_from_example.sh 1_2_1
For this upgrade, to casper-node v1.3.1
, the activation point is Era 1346
. In order to not have points deducted for your Testnet reward score, you have to make sure you have properly staged the upgrade well ahead of the activation point, so that your node will be upgraded on time.
Execute the following two commands, one by one:
sudo -u casper /etc/casper/pull_casper_node_version.sh casper-test.conf 1_3_1
sudo -u casper /etc/casper/config_from_example.sh 1_3_1
sudo logrotate -f /etc/logrotate.d/casper-node
sudo systemctl start casper-node-launcher; sleep 2
systemctl status casper-node-launcher
sudo tail -fn100 /var/log/casper/casper-node.log /var/log/casper/casper-node.stderr.log
curl -s http://$KNOWN_VALIDATOR_IP:8888/status | jq .peers
You should see your IP address on the list
curl -s http://127.0.0.1:8888/status
Before you do anything, such as trying to bond as a validator or perform any RPC calls, make sure your node has fully caught up with the network. You can recognize this by log entries that tell you that joining has finished, and that the RPC and REST servers have started:
{"timestamp":"Feb 09 02:28:35.577","level":"INFO","fields":{"message":"finished joining"},"target":"casper_node::cli"}
{"timestamp":"Feb 09 02:28:35.578","level":"INFO","fields":{"message":"started JSON-RPC server","address":"0.0.0.0:7777"},"target":"casper_node::components::rpc_server::http_server"}
{"timestamp":"Feb 09 02:28:35.578","level":"INFO","fields":{"message":"started REST server","address":"0.0.0.0:8888"},"target":"casper_node::components::rest_server::http_server"}
Once you ensure that your node is running correctly and is visible by other proceed to bonding.
Check your balance to ensure you have funds to bond:
If you followed the installation steps from this document you can run the following script to check the balance:
PUBLIC_KEY_HEX=$(sudo -u casper cat /etc/casper/validator_keys/public_key_hex)
STATE_ROOT_HASH=$(casper-client get-state-root-hash --node-address http://127.0.0.1:7777 | jq -r '.result | .state_root_hash')
PURSE_UREF=$(sudo -u casper casper-client query-state --node-address http://127.0.0.1:7777 --key "$PUBLIC_KEY_HEX" --state-root-hash "$STATE_ROOT_HASH" | jq -r '.result | .stored_value | .Account | .main_purse')
casper-client get-balance --node-address http://127.0.0.1:7777 --purse-uref "$PURSE_UREF" --state-root-hash "$STATE_ROOT_HASH" | jq -r '.result | .balance_value'
If you followed the installation steps from this document you can run the following script to bond. It substitutes the public key hex value for you and sends recommended argument values:
PUBLIC_KEY_HEX=$(sudo -u casper cat /etc/casper/validator_keys/public_key_hex)
CHAIN_NAME=$(curl -s http://127.0.0.1:8888/status | jq -r '.chainspec_name')
sudo -u casper casper-client put-deploy \
--chain-name "$CHAIN_NAME" \
--node-address "http://127.0.0.1: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 3000000000 \
--gas-price=1 \
--session-arg=public_key:"public_key='$PUBLIC_KEY_HEX'" \
--session-arg=amount:"u512='900000000000'" \
--session-arg=delegation_rate:"u8='10'"
amount
- This is the amount that is being bid. If the bid wins, this will be the validator’s initial bond amount. Recommended bid in amount is 90% of your faucet balance. This is900 CSPR
or900000000000 motes
as an argument to theadd_bid
contract deploy.delegation_rate
- The percentage of rewards that the validator retains from delegators that delegate their tokens to the node.
Remember the deploy_hash
returned in the response to query its status later.
Sending a transaction to the network does not mean that the transaction processed successfully. It’s important to check to see that the contract executed properly:
casper-client get-deploy --node-address http://127.0.0.1:7777 <DEPLOY_HASH> | jq .result.execution_results
Replace <DEPLOY_HASH>
with the deploy hash of the transaction you want to check.
To determine if the bid was accepted, execute the following command:
casper-client get-auction-info --node-address http://127.0.0.1:7777
The bid should appear among the returned bids
. If the public key associated with a bid appears in the validator_weights
structure for an era, then the account is bonded in that era.
Please note that the DEVxDAO's Casper Testnet program is implemented by the DEVxDAO by providing rewards through the Emerging Technology Association (ETA), a Swiss nonprofit association which supports open source and transparent scientific research of emerging technologies for community building. Any rewards will be granted and calculated by the ETA. MAKE Technology LLC is not affiliated with the DEVxDAO, the ETA nor the Casper Foundation, and has no control over the program sponsorship or the incentivized reward program, and is hosting these guides and documents as a service to the DEVxDAO and the Casper community only.