-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from tellor-io/connect-to-layer
Connect to layer scripts
- Loading branch information
Showing
8 changed files
with
28,533 additions
and
2,176 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
Requirements: | ||
- must have sed, jq, and go(v1.22) installed properly on your computer | ||
|
||
Creating a new node: | ||
|
||
If you are running everything in one terminal instance I recommend using screen sessions so that you can still query the chain and run other things after your node has started | ||
|
||
Once the chain is running please select an rpc url of a current node to use in your set up of your node and set the LAYER_NODE_URL variable to that url (ex: tellor-example-node.com) WITH NO QUOTES | ||
|
||
After finding a node url to use call "curl tellor-example-node.com:26657/status" this should return something like this: | ||
|
||
{ | ||
"jsonrpc":"2.0", | ||
"id":-1, | ||
"result":{ | ||
"node_info":{ | ||
"protocol_version":{ | ||
"p2p":"8", | ||
"block":"11", | ||
"app":"0" | ||
}, | ||
"id":"f5f6ce5d15ea80683b9133b19e245f9b27daab67", | ||
"listen_addr":"tcp://0.0.0.0:26656", | ||
"network":"layer", | ||
"version":"0.38.7", | ||
"channels":"40202122233038606100", | ||
"moniker":"alicemoniker", | ||
"other":{ | ||
"tx_index":"on", | ||
"rpc_address":"tcp://0.0.0.0:26657" | ||
} | ||
}, | ||
"sync_info":{ | ||
"latest_block_hash":"5CD20D6553DDBE078EB43AC970F6D391F8FDFB2D2BD968F7B1A7454AA05154C5", | ||
"latest_app_hash":"847D19668188D482BFAA8808FB6207315F0766098A9202103F33DF51070027A5", | ||
"latest_block_height":"73830", | ||
"latest_block_time":"2024-06-04T15:38:53.899045777Z","earliest_block_hash":"EACF6AFE38ABB21E97078359EFAAD7E61D0417BBBA2C7724BB042D38F73693E1","earliest_app_hash":"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", | ||
"earliest_block_height":"1", | ||
"earliest_block_time":"2024-06-03T17:59:53.991818534Z", | ||
"catching_up":false | ||
}, | ||
"validator_info":{ | ||
"address":"BEBEAE312EEE6AAD0E315FC6A36C9C44BDCEA1D3", | ||
"pub_key":{"type":"tendermint/PubKeyEd25519","value":"0/8w6RR2ZiQLwdbn1QvwrxYSfGUtW7jXTyPOL9a9NiY="},"voting_power":"100000" | ||
} | ||
} | ||
} | ||
|
||
Use the node_info.id value to set TELLORNODE_ID variable with NO QUOTES | ||
|
||
Set the node name and moniker used for your node. Can be whatever name you want it to be | ||
- will be used to name the folder that your node config is in. Should be in the default location of already set in the LAYERD_NODE_HOME variable as "$HOME/.layer/$NODE_NAME" | ||
|
||
run "sh ./layer_scripts/{selected version of script}.sh" inside of the layer base folder and it should set things up and start the chain thus making your node start syncing with your seed/peer | ||
|
||
|
||
Creating a validator: | ||
|
||
Assumes that you have a running and synced up node already | ||
|
||
1. Set variable values | ||
- Use the same values you used for creating your node. Then select the amount of trb you would like to receive to from the faucet and stake for the new validator (1 TRB == 1e1*6 loya) | ||
|
||
2. Run script from layer base folder with command: sh ./layer_scripts/create_new_validator_{OS}.sh | ||
|
||
3. After you have created your keys and made the transaction to create a new validator watch the output to ensure the returned validator info shows "status": 3 | ||
- if status != 3 then cancel the script with CTRL-C | ||
|
||
4. Whenever the script tells you to go to the terminal or screen session that your current node is running and stop the chain using CTRL-C. This will allow for the create validator script to restart the chain/node but this time it will run as a validator | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
|
||
# clear the terminal | ||
clear | ||
|
||
# Stop execution if any command fails | ||
set -e | ||
|
||
### YOU MUST HAVE THE FAUCET RUNNING LOCALLY FOR THIS SCRIPT TO WORK | ||
|
||
## YOU WILL NEED TO SET THIS TO WHATEVER NODE YOU WOULD LIKE TO USE | ||
export LAYER_NODE_URL=tellornode.com | ||
export TELLORNODE_ID= | ||
export KEYRING_BACKEND="test" | ||
export NODE_MONIKER="billmoniker" | ||
export NODE_NAME="bill" | ||
export AMOUNT_IN_TRB=1000 | ||
export AMOUNT_IN_LOYA="1000000000loya" | ||
export LAYERD_NODE_HOME="$HOME/.layer/$NODE_NAME" | ||
|
||
# Create a validator account for node | ||
echo "Creating account keys for node to be able to send and receive loya and stake..." | ||
./layerd keys add $NODE_NAME --keyring-backend $KEYRING_BACKEND --home $LAYERD_NODE_HOME | ||
|
||
# Import validator account from seed phrase | ||
# echo "Importing validator account from seed phrase..." | ||
# ./layerd keys add $NODE_NAME --recover=true --keyring-backend $KEYRING_BACKEND | ||
|
||
# Get address/account for node to use in gentx tx | ||
echo "Getting the address of your node to use for faucet request" | ||
NODE_ADDRESS=$(./layerd keys show $NODE_NAME -a --keyring-backend $KEYRING_BACKEND --home $LAYERD_NODE_HOME) | ||
echo "NODE address: $NODE_ADDRESS" | ||
|
||
echo "Calling faucet to fund account..." | ||
curl -X POST localhost:3000/faucetRequest/user/$NODE_ADDRESS/amount/$AMOUNT_IN_TRB | ||
|
||
VAL_PUB_KEY=$(./layerd comet show-validator --home $LAYERD_NODE_HOME) | ||
echo "Validator's pubkey: $VAL_PUB_KEY" | ||
|
||
VALIDATOR_JSON=$(cat <<EOF | ||
{ | ||
"pubkey": $VAL_PUB_KEY, | ||
"amount": $AMOUNT_IN_LOYA, | ||
"moniker": $NODE_MONIKER, | ||
"identity": "optional identity signature (ex. UPort or Keybase)", | ||
"website": "validator's (optional) website", | ||
"security": "validator's (optional) security contact email", | ||
"details": "validator's (optional) details", | ||
"commission-rate": "0.1", | ||
"commission-max-rate": "0.2", | ||
"commission-max-change-rate": "0.01", | ||
"min-self-delegation": "1" | ||
} | ||
EOF | ||
) | ||
|
||
# Save the validator.json content to a file | ||
echo "Creating bill's validator.json..." | ||
echo "$VALIDATOR_JSON" > ./validator.json | ||
|
||
echo "Creating and broadcasting transaction to create validator on chain...." | ||
./layerd tx staking create-validator ./validator.json --from $NODE_ADDRESS --home $LAYERD_NODE_HOME --chain-id layer --node="http://$LAYER_NODE_URL:26657" | ||
|
||
echo "Wait for 10 seconds to allow for validator to be bonded before we query the validator info" | ||
sleep 10 | ||
|
||
echo "Querying new validator info... Looking for the status field to have a value of 3 which shows that the new validator is bonded" | ||
./layerd query staking validator $(./layerd keys show $NODE_NAME --bech val --address --keyring-backend $KEYRING_BACKEND --home $LAYERD_NODE_HOME) --output json | jq | ||
|
||
|
||
echo "If status is 3 now is the time to go back to the screen session or terminal your node is running on and use CTL-C to stop the node" | ||
echo "We will wait in this script for 30 seconds before we call the command to restart the chain using the same set up that was done before" | ||
sleep 30 | ||
|
||
./layerd start --home $LAYERD_NODE_HOME --api.enable --api.swagger --panic-on-daemon-failure-enabled=false --p2p.seeds "$TELLORNODE_ID@$LAYER_NODE_URL:26656" |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Requirements: | ||
- [email protected] | ||
- sed | ||
- jq | ||
|
||
If you are planning on not using the default port numbers (26656, 26657, 9090, 1317, etc) then make sure you update the script to point to the desired port numbers | ||
|
||
start_one_node.sh (has been run solely on macs) | ||
- this script starts the chain with one node and validator | ||
- Unless you want to change the name of the folder used all you have to do to run this script is "sh ./start_scripts/start_one_node.sh and it will spin it up with the config being set up at ~/.layer/alice and the name of your keys/node is alice | ||
|
||
|
||
start_one_node_aws.sh (has been run solely on ubuntu ec2 instances) | ||
- this script starts the chain with one node and validator and allows you to import a faucet account with a seed phrase. | ||
- Unless you want to change the name of the folder used all you have to do to run this script is "sh ./start_scripts/start_one_node_aws.sh and it will spin it up with the config being set up at ~/.layer/alice and the name of your keys/node is alice | ||
|
||
|
This file was deleted.
Oops, something went wrong.
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