Run a Layer Node

Pre-requisites

  • A local or cloud system running linux, or macOS. If on windows, use WSL. Minimum system specs (at time of writing): - quad-core cpu - 8gb ram - 128gb-2tb nvme storage depending on how you will run your node

  • Golang v1.22 (install instrauctions here)

  • jq (sudo apt install jq on linux, or brew install jq on mac)

  • sed (sudo apt install sed on linux, or brew install sed on mac)

Here is a list of variables we will set starting in step 4 (refer to these descriptions as needed):

  • LAYER_NODE_URL: Set to the unquoted URL (or public IPv4 address) of a seed node, like tellorlayer.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

Initial Setup

Build and Configure layerd

There are 9 steps in this part.

  1. Clone the Layer repo, change directory to layer.:

git clone https://github.com/tellor-io/layer -b v0.6.1 && cd layer
  1. Build layerd with the command:

go build ./cmd/layerd
  1. An ethereum RPC is used for reporting tellor bridge transactions Using your favorite text editor, create a file called secrets.yaml:

nano secrets.yaml

Add this code to the file, replacing `your_sepolia_testnet_rpc_url` with the url of a reliable sepolia rpc:

eth_rpc_url: "wss://your_sepolia_testnet_rpc_url"

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

  1. Add variables to .bashrc (or .zshrc) Setting variables in .bashrc or .zshrc is not required, but it helps to avoid many common errors.

Open your .bashrc or .zshrc file:

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:

# layer
export LAYER_NODE_URL=tellorlayer.com
export TELLORNODE_ID=18f58b3bc1756ad3872b00b349429fd4f56d2b34
export KEYRING_BACKEND="test"
export NODE_MONIKER="bobmoniker"
export ACCOUNT_NAME="bob"
export LAYERD_NODE_HOME="$HOME/.layer/$ACCOUNT_NAME"

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 again as we are still cooking. This causes the TELLORNODE_ID to change. You can check the current correct id with:

curl tellorlayer.com:26657/status
  1. Initialize .layer folder in your home directory

./layerd init layer --chain-id layertest-1
  1. 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:

    • create the script file locally:

    nano configure_layer_nix.sh # or configure_layer_mac.sh if mac
    • Navigate here, select all and copy the code to your clipboard.

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

    If on Mac:

    • create the script file locally:

    nano configure_layer_mac.sh # or configure_layer_mac.sh if mac
    • Navigate here, select all and copy the code to your clipboard.

    • 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:

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

    You're now ready to start your node with default sync settings. If you want to do a state sync, do the additional config steps here before you continue.

  2. 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.

Security Tips: 1. This guide uses the "test" backend because this is a testnet guide. Always use a secure keyring-backend option like os, file, or pass if you're handling real money! 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!

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

./layerd keys add $ACCOUNT_NAME

Be sure to copy the entire output with the mnemonic and keep it in a very safe place!

If you already have an account with it's mnemonic phrase Import your account with the command: (You will be prompted to input your mnemonic)

./layerd keys add $ACCOUNT_NAME --recover=true

You can check accounts any time with: ./layerd keys list

  1. Export your addresses. Your wallet account has two important addresses. First, get the "tellor" prefix address, which is used to send and receive tokens. Copy it and keep it in a safe place:

./layerd keys show $ACCOUNT_NAME

Next, add the --bech val flag to get the "tellorvaloper" prefix address, which is used for validator commands. Copy it and keep it in a safe place:

./layerd keys show $ACCOUNT_NAME --bech val

Add these addresses to your .bashrc or .zshrc file. Be sure to replace your_tellor_prefix_address and your_tellorvaloper_prefix_address in your command:

echo 'export TELLOR_ADDRESS=your_tellor_prefix_address' >> ~/.bashrc #.zshrc if mac
echo 'export TELLORVALOPER_ADDRESS=your_tellorvaloper_prefix_address' >> ~/.bashrc #.zshrc if mac

Restart your terminal, or use source ~/.bashrc before you continue. (if Linux) Restart your terminal, or use source ~/.zshrc before you continue. (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 is a great option for beginners. More advanced setups can be achieved using systemd.

Run the command:

./layerd start --api.swagger --price-daemon-enabled=false --key-name $ACCOUNT_NAME

If your node is configured correctly, you should see the node connecting to end points before rapidly downloading blocks. Please allow time for the node to sync before moving onto setting up a validator.

Last updated