Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more detailed guide #1

Merged
merged 52 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ff46190
more detailed guide
0xSpuddy Jul 16, 2024
d86320e
formatting
0xSpuddy Jul 16, 2024
9c0a9ea
.
0xSpuddy Jul 16, 2024
c6610cc
.
0xSpuddy Jul 16, 2024
7c4c0c9
add unjail command
0xSpuddy Jul 16, 2024
4f040b8
.
0xSpuddy Jul 16, 2024
47f95ac
.
0xSpuddy Jul 16, 2024
bd8800f
.
0xSpuddy Jul 16, 2024
3bcedc5
test
0xSpuddy Jul 16, 2024
6c16cdf
.
0xSpuddy Jul 16, 2024
c9bb9c3
.
0xSpuddy Jul 16, 2024
3fb1f50
hint
0xSpuddy Jul 16, 2024
ae92691
done for now
0xSpuddy Jul 16, 2024
5dff747
.
0xSpuddy Jul 16, 2024
bc3271d
.
0xSpuddy Jul 16, 2024
ecfcffa
asdf
0xSpuddy Jul 16, 2024
13e8cbd
.
0xSpuddy Jul 16, 2024
6205b09
.
0xSpuddy Jul 16, 2024
29523e6
asdf
0xSpuddy Jul 16, 2024
f0b9416
tellorvaloper
0xSpuddy Jul 16, 2024
c88a3cf
asdf
0xSpuddy Jul 16, 2024
6a212f9
.
0xSpuddy Jul 16, 2024
e0f4d99
still working
0xSpuddy Jul 17, 2024
e887806
no scripts necessary setup guide
0xSpuddy Jul 17, 2024
b198c84
delete copy
0xSpuddy Jul 17, 2024
7f7b8dc
tested validator and reporter steps
0xSpuddy Jul 17, 2024
3168948
asdf
0xSpuddy Jul 18, 2024
f8fe10c
added setup script for mac
0xSpuddy Jul 18, 2024
2263aec
added mac script commands
0xSpuddy Jul 18, 2024
3851ea0
added links
0xSpuddy Jul 18, 2024
57f34e6
wget prereq
0xSpuddy Jul 18, 2024
dd65a88
walkthrough script creation
0xSpuddy Jul 18, 2024
ac98b75
steps for scripts
0xSpuddy Jul 18, 2024
b4a387c
no wget
0xSpuddy Jul 18, 2024
eb6c3aa
asdf
0xSpuddy Jul 18, 2024
3b367e3
.
0xSpuddy Jul 18, 2024
921e1d7
check if synced step
0xSpuddy Jul 18, 2024
f76d5d0
fixed commands
0xSpuddy Jul 18, 2024
669c84d
Update configure_layer_nix.sh
0xSpuddy Sep 5, 2024
387d404
Update configure_layer_mac.sh
0xSpuddy Sep 5, 2024
7bcceeb
Update configure_layer_mac.sh
0xSpuddy Sep 6, 2024
6f84cf0
Update configure_layer_nix.sh
0xSpuddy Oct 29, 2024
b6b7d64
Update configure_layer_mac.sh
0xSpuddy Oct 29, 2024
c85a50e
Update configure_layer_nix.sh
0xSpuddy Nov 8, 2024
3b714ea
Update configure_layer_mac.sh
0xSpuddy Nov 8, 2024
ca67274
Update configure_layer_mac.sh
0xSpuddy Nov 8, 2024
24b25ae
Update configure_layer_mac.sh
0xSpuddy Nov 8, 2024
9cae31c
Update configure_layer_nix.sh
0xSpuddy Nov 8, 2024
94cae64
Update configure_layer_mac.sh
0xSpuddy Nov 25, 2024
31f5639
Update configure_layer_nix.sh
0xSpuddy Nov 25, 2024
b80416e
Update configure_layer_nix.sh
0xSpuddy Dec 9, 2024
8eef8ab
Update configure_layer_mac.sh
0xSpuddy Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions public-testnet/1_install_layer_and_run_node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# Public Testnet Guide

### *Note: This is a guide for setting up a Tellor Layer public testnet validator / reporter. Care is taken to provide info on the tools being used, but testers should be comfortable with running experimental code via command line interface. A beginner’s understanding of the cosmos SDK is highly recommended!*

This guide has three sections:
1. Build and Configure layerd
2. Run a Tellor Layer node.
3. Stake and become a Validator
4. Create a reporter (and unjail if needed)

### Pre-requisites

* A local or cloud system running linux (or mac os with the mac scripts)
* Golang v1.22 (install instrauctions [here](https://go.dev/doc/install))
* jq
* yq
* sed

## Part 1: Build and Configure layerd
There are 7 steps in this part.

1. Clone the Layer repo and change directory to `layer`:

```sh
git clone https://github.com/tellor-io/layer -b public-testnet && cd layer
```

2. Build layerd with the command:

```sh
go build ./cmd/layerd
```

3. **An ethereum RPC is used for reporting tellor bridge transactions.**
Using your favorite text editor, create a file called `secrets.json`:

```sh
nano secrets.json
```

Add this code to the file, replacing `your_api_key` with your Alchemy api key:

```json
{
"eth_api_key": "your_api_key"
}
```

Exit nano with `ctrl^x` then enter `y` to save the changes.

4. **Add variables to .bashrc (or .zshrc)**
*Setting variables in .bashrc is not required, but it helps to avoid many common errors.*
Here is a list of variables we will use in this guide and a short description of their purpose:
* `LAYER_NODE_URL`: Set to the unquoted URL (or public IPv4 address) of a seed node, like tellornode.com.
* `KEYRING_BACKEND`: Set to `test` by default but can be configured here. (test works fine)
* `NODE_MONIKER`: Set to whatever you'd like to use for your validator's public readable name (e.g "bob").
* `ACCOUNT_NAME`: Set to your name or whatever name you choose (like “bill” or "ruth").
* `TELLORNODE_ID`: Set to the unquoted node ID of the seed node.
* `LAYERD_NODE_HOME`: Should be set to "$HOME/.layer/$ACCOUNT_NAME"
* `TELLOR_ADDRESS`: the tellor prefix address for your account
* `TELLORVALOPER_ADDRESS`: the tellorvaloper prefix address for your account

Open your `.bashrc` or `zshrc` file:

```sh
nano ~/.bashrc # if linux
nano ~/.zshrc # if mac
```

Add these lines at the end, editing `NODE_MONIKER` be to whatever you'd like to name your node. Edit the ACCOUNT_NAME to whatever you'd like to call your wallet account:

```sh
# layer
export LAYER_NODE_URL=54.166.101.67
export TELLORNODE_ID=72a0284c589e1e11823c27580bfbcbaa32a769e7
export KEYRING_BACKEND="test"
export NODE_MONIKER="bobmoniker"
export ACCOUNT_NAME="bob"
export LAYERD_NODE_HOME="$HOME/.layer/$ACCOUNT_NAME"
export TELLOR_ADDRESS= # your tellor prefix address (we will add it later)
export TELLORVALOPER_ADDRESS= #your tellorvaloper address (we will add it later)
```

Exit nano with `ctrl^x` then enter `y` to save the changes.

Restart your terminal, or use `source ~/.bashrc` before you continue. (if Linux)
Restart your terminal, or use `source ~/.zshrc` before you continue. (if mac)

*Note: We may need to reset the chain a few more times while we cook. This causes the `TELLORNODE_ID` to change. You can check the current correct id with:*

```sh
curl tellornode.com:26657/status
```

4. **Initialize config folders**

```sh
./layerd init layer --chain-id layer
```

5. **Initialize a named config folder**

```sh
./layerd init $ACCOUNT_NAME --chain-id layer --home ~/.layer/$ACCOUNT_NAME
```

5. **Create an account on Layer**
You will need a "wallet" account on layer to hold your TRB tokens that you will stake to become a validator reporter.

<mark style="color:blue;">**Security Tips:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">1. The test backend is not recommended for production use with real funds because the keys are stored as plain text. Always use a secure keyring-backend option for real funds! 2. Handle mnemonics/keys with extreme care, even if it’s just a testnet address! 3. Never use an address that holds real mainnet funds for testing!</mark>

You can check accounts any time with:

```sh
./layerd keys list --keyring-backend $KEYRING_BACKEND --home $LAYERD_NODE_HOME
```

**If you do not yet have an account / mnemonic**
Generate a new key pair with the command:

```sh
./layerd keys add $ACCOUNT_NAME --keyring-backend $KEYRING_BACKEND --home $LAYERD_NODE_HOME
```
**Be sure to copy the entire output with the mnemonic and keep it in a very safe place!**

**If you already have an account / pnemonic**
Import your account with the command:
(You will be prompted to input your mnemonic)

```sh
./layerd keys add $ACCOUNT_NAME --recover=true --keyring-backend $KEYRING_BACKEND --home $LAYERD_NODE_HOME
```

6. **Add your address to your ~/.bashrc or .zshrc file**
Open it with:

```sh
nano ~/.bashrc # if linux
nano ~/.zshrc # if mac
```

set TELLOR_ADDRESS to your tellor prefix address like:

```sh
export TELLOR_ADDRESS=tellor1asdfc5cqnt68k376g7fvasdfh6w4qy9et6asdf
```

Exit nano with `ctrl^x` then enter `y` to save the changes.

7. **Create and Run the configure_layer script**
We need to change the config files a bit using one of the provided `configure_layer_nix.sh` or `configure_layer_mac.sh` scripts from the layerdocs repo.

**If on linux:**
- Navigate [here](https://raw.githubusercontent.com/tellor-io/layerdocs/update-guide-working/public-testnet/configure_layer_nix.sh), select all and copy the code to your clipboard.

- create the script file locally:

```sh
nano configure_layer_nix.sh # or configure_layer_mac.sh if mac
```

Paste the code, then exit nano with `ctrl^x` then enter `y` to save the changes.

**If on Mac:**
- Navigate [here](https://raw.githubusercontent.com/tellor-io/layerdocs/update-guide-working/public-testnet/configure_layer_mac.sh), select all and copy the code to your clipboard.

- create the script file locally:

```sh
nano configure_layer_mac.sh # or configure_layer_mac.sh if mac
```

Paste the code, then exit nano with `ctrl^x` then enter `y` to save the changes.

Give your new script permission to execute and run it to replace the default configs with proper layer chain configs:

```sh
chmod +x configure_layer_nix.sh && ./configure_layer_nix.sh #if linux
chmod +x configure_layer_mac.sh && ./configure_layer_mac.sh #if mac
```

## Start your Layer Node!

***Before starting your node, it's a good idea to think about how you want to run it so that the process does not get killed accidentally. [GNU screen](https://tellor.io/blog/how-to-manage-cli-applications-on-hosted-vms-with-screen/) is a great option for beginners. More advanced setups can be achieved using systemd.***

Run the command:

```sh
./layerd start --api.swagger --price-daemon-enabled=false --home $LAYERD_NODE_HOME
```

If your node is configured correctly, you should see the node connecting to endopoints before rapidly downloading blocks. congrats!

161 changes: 161 additions & 0 deletions public-testnet/2_become_a_validator_reporter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Part 2: Become a Validator

*Once you've got your node running and synced, you're ready to become a validator!*

You will need to have some layer testnet TRB. Feel free to send us your tellor prefixed address / request in the public [discord](https://discord.gg/tellor) #testing-layer channel, or [try the token bridge from the Sepolia testnet playground.](guide.md#getting-testnet-trb)

***Setup Note: Open up another screen or terminal window on your layer machine for doing the validator steps. If you followed the install guide and added the variables to your .bashrc file, you should be able to copy / paste the commands in this documentation to stake your validator.***

***It helps to have quick access to the node window and the commands window as you go though the steps (to avoid jailing).***

1. **Check if your node is synced:**
Run the command

```sh
./layerd status
```

If `"catching_up": true`, your node is not synced.
If `"catching_up": false`, your node is synced!

2. **Check if your address has funds**

```sh
./layerd query bank balance $TELLOR_ADDRESS loya --chain-id layer
```

3. While we're at it, let's grab your "tellorvaloper" prefix address also:

```sh
./layerd keys show $ACCOUNT_NAME --bech val --home $LAYERD_NODE_HOME
```

*This will output the "tellorvaloper" prefix address for your account. It is used for validator commands and is different from the "tellor" prefix address that is used for sending and recieving TRB. Copy this "tellorvaloper" prefix address and keep it in the same place where you can copy it later.*

4. **Add your tellorvaloper address to your ~/.bashrc or .zshrc file**
Open it with:

```sh
nano ~/.bashrc # if linux
nano ~/.zshrc # if mac
```

set TELLORVALOPER_ADDRESS to your tellor prefix address like:

```sh
export TELLORVALOPER_ADDRESS=tellorvaloper1asdfc5cqnasdf376g7fv9whph6w4qy9e74asdf
```

Exit nano with `ctrl^x` then enter `y` to save the changes.

5. **Retrieve Your Validator Public Key:**
With your `layer` folder as the active directory, use the command:

```sh
./layerd comet show-validator --home $LAYERD_NODE_HOME
```

This returns your validator pubkey. (e.g., `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"FX9cKNl+QmxtLcL926P5yJqZw7YyuSX3HQAZboz3TjM="}`).
Copy it and keep it in a safe place. You will need it in the next step.

6. **Edit the Validator Configuration File:**
Open `~/layer/validator.json`:

```json
{
"pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"c+EuycPpudgiyVl6guYG9oyPSImHHJz1z0Pg4ODKveo="},
"amount": "100000000000loya",
"moniker": "billmoniker",
"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"
}
```
- Edit `"pubkey"` to match yours from step 4.
- Edit `"amount"` to be the amount of testnet TRB that you would like to stake with 6 decimals and the "loya" denom.
(For example: if you want to stake 99 TRB use `"amount": "99000000loya"`)
- Edit `"moniker"` to match your node moniker variable.

<mark style="color:blue;">**Note:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">TRB tokens are used for gas on the layer network. As a validator you will need to make transactions to send tokens, become a reporter, unjail, etc. When choosing the amount to stake, it is important to reserve some TRB for gas. </mark>

7. **Create Your Validator:**
A few things need to happen (in order) to successfully start a layer validator. You should have two terminal windows open: a command window and a node window.

You will need to do a, b, and c carefully:
a. Do the create-validator tx in command window
b. Count to 10
c. Restart your node in the node window

Let's go!
a. Run the following command to create-validator:

```sh
./layerd tx reporter create-reporter "100000000000000000" "1000000" --from $ACCOUNT_NAME --keyring-backend $KEYRING_BACKEND --chain-id layer --home $LAYERD_NODE_HOME --keyring-dir $LAYERD_NODE_HOME
```

b. count to 10 and open the node window
c. In your node window, use `ctrl^c` to stop the node. Enter this command to start it back up:

```sh
./layerd start --home $LAYERD_NODE_HOME --api.enable --api.swagger --price-daemon-enabled=false --panic-on-daemon-failure-enabled=false
```

8. **Verify Your Validator Creation:**
Ensure your validator was created successfully using the command:

```sh
./layerd query staking validator $(./layerd keys show $ACCOUNT_NAME --bech val --address --keyring-backend $KEYRING_BACKEND --home $LAYERD_NODE_HOME)
```


If status is `3`, you are a validator and you're not jailed. Awesome!
If status is `2`, you created your validator, but it was jailed (it's ok, you can probably unjail later).

## Part 2: Becoming a Reporter (and maybe unjail a little bit...)

Once you’re successfully running a validator, you’re almost a reporter already! Just aone more command:

```sh
./layerd tx reporter create-reporter "100000000000000000" "1000000" --from $ACCOUNT_NAME --keyring-backend $KEYRING_BACKEND --chain-id layer --home $LAYERD_NODE_HOME
```

Restart your node again, but this time we will change the command a bit to turn on the price daemon:

```sh
./layerd start --home $LAYERD_NODE_HOME --api.enable --api.swagger --price-daemon-enabled=true --panic-on-daemon-failure-enabled=false
```

## Steps to unjail:
Layer testnet is still experimental, and jailing can happen for various reasons while we work out the kinks. Make sure your terminal window (shell) has all the variables loaded before trying to build txs. Read all steps first because you have about 4 minutes to do everything or you will be jailed again for inactivity:

1. stop your node / validator / reporter with and start it back up as a node / validator (turning off the reporter):

```sh
./layerd start --home $LAYERD_NODE_HOME --api.enable --api.swagger --price-daemon-enabled=false --panic-on-daemon-failure-enabled=false
```

2. enter the unjail the command:

```sh
./layerd tx slashing unjail --from $TELLOR_ADDRESS --chain-id layer --home $LAYERD_NODE_HOME --keyring-backend test --keyring-dir $LAYERD_NODE_HOME
```

3. Restart the node with reporter daemon turned on:

```sh
./layerd start --home $LAYERD_NODE_HOME --api.enable --api.swagger --price-daemon-enabled=true --panic-on-daemon-failure-enabled=false
```

### Getting Testnet TRB

You can mint Layer Testnet TRB using the Sepolia Tellor Playground contract’s “faucet” command:\
[https://sepolia.etherscan.io/address/0x3251838bd813fdf6a97D32781e011cce8D225d59#writeContract\
\
](https://sepolia.etherscan.io/address/0x3251838bd813fdf6a97D32781e011cce8D225d59#writeContract)Once you have TRBP in your wallet, head over to the Layer Testnet bridge:\
[https://sepolia.etherscan.io/address/0x7a261EAa9E8033B1337554df59bD462ca4A251FA#writeContract\
](https://sepolia.etherscan.io/address/0x7a261EAa9E8033B1337554df59bD462ca4A251FA#writeContract)
Loading