# Lava Provider Node

By [GLCstaked](https://paragraph.com/@glcstaked) · 2023-08-11

---

**DRAFT: Deploy a Lava Provider node and connect to RPC nodes.** _NOTE: this is for current lava-testnet-2._

_Document Last Update: 05/09/23_

**Lava Protocol**: a crypto-market which powers a decentralized RPC layer for Web3.

[

Lava Network
------------

2.5m+ users, 30+ chains supported, 70b+ RPC calls - you are using Lava without knowing. Lava is the infrastructure that powers access to all blockchains, enabling essential onchain actions such as minting, swapping and transacting.

https://www.lavanet.xyz

![](https://storage.googleapis.com/papyrus_images/45b0bf144f30a9a0154de3a3057bdbd50576e6379eea1ff8dc302c14ce19e73a.webp)

](https://lavanet.xyz/)

**Lava Chain:** is a cosmos PoS layer 1 with $LAVA for settlement, validator nodes secure the chain.

**Providers:** Provider nodes, are nodes running atop Lavanet connecting to Lava chain for rewards (do not participate in consensus), these nodes provide RPC endpoints of other chains to any consumer.

**Consumers:** consumers of chain data, paying for access to RPC endpoints to providers.

* * *

0\. Before Provider Setup
-------------------------

**Hardware requirements:**

For Full node (current Testnet): 8GB RAM /100GB SSD Storage/ CPU 4v x64 2.0 GHz. _These are minimum specs, and I would recommend more._

**This guide will be setup to host the lightweight provider process alongside the node (to provide rpc access to), this means installing lavad binary for running the lightweight provider process, access to a Lava full node must also be provided and should be hosted separately.**

**Lava docs:**

[https://docs.lavanet.xyz/provider-setup/](https://docs.lavanet.xyz/provider-setup/)

_“create one rpcprovider.yml provider config per chain you plan to support on that device. Each one of these .yml files will function as the configuration for a distinct provider process.”_

**TLS Certificates/Sub-domains:** _“All providers on lava-testnet-2 must use a domain name and TLS.”_ Setting up TLS and sub-domains is done later in this guide.

![Rough flow of how the node setup will look and how requestswill be routed between services, in this example the node of choice is ‘juno’](https://storage.googleapis.com/papyrus_images/6bfc64d8f590667fc57cf74af85af5bbe5b6dd64e0c77f1b66ffaf09a3e10cad.png)

Rough flow of how the node setup will look and how requestswill be routed between services, in this example the node of choice is ‘juno’

**Ports:** the only port that needs to be open externally is Nginx https port, by default this is 443, but if you have need to change this then adjust accordingly.

    443 # https port for nginx
    

**Lava Full Node:**

Lava provider requires connection to a full node to make transactions on the Lava Network. You will need to have access to one, this can be hosted on an external device.

[https://mirror.xyz/0xf3bF9DDbA413825E5DdF92D15b09C2AbD8d190dd/UhS3BfMA1DUwTZsjDxUMBVuP-nywmxyTZ5KSKmRZJb4](https://mirror.xyz/0xf3bF9DDbA413825E5DdF92D15b09C2AbD8d190dd/UhS3BfMA1DUwTZsjDxUMBVuP-nywmxyTZ5KSKmRZJb4)

**Full Node for Provider:**

A Node to provide API Access through lavas lightweight provider process, this will be installed on the same device as the provider and should be setup first.

Library of full node setup guides and scripts: These are my own, deployment guides to get a ‘full node’ setup to a working state:

[

GitHub - GLCNI/RPC-node-deployments: deployment scripts for full nodes for RPC endpoint provision
-------------------------------------------------------------------------------------------------

deployment scripts for full nodes for RPC endpoint provision - GLCNI/RPC-node-deployments

https://github.com

![](https://storage.googleapis.com/papyrus_images/d9982a8aec717df43765e740036e853ad9b7f1699e4a46815f77c25a79fea76e.png)

](https://github.com/GLCNI/RPC-node-deployments)

1\. Initial Setup
-----------------

**Update and install dependencies**

    sudo apt update && sudo apt upgrade -y
    sudo apt install git curl wget tar unzip jq build-essential pkg-config clang bsdmainutils make ncdu -y
    

**Install Go**

Use version 1.20.5 for current binary

    wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.20.5
    

Run `source $HOME/.bashrc` to take effect

Confirm install is successful

    go version
    

_This script is made by osmosis-labs and installs_ `PATH` _variables to_ `.bashrc` _and sets up in a way compatible with the rest of the build. Go binary installs to_ `$HOME/.go` and `$HOME/go/bin`

    #to remove installation 
    wget -q -O - https://git.io/vQhTU | bash -s -- --remove
    

2\. Install Lava binary
-----------------------

create working directory, this will be for provider configurations later.

    mkdir lava-provider
    

Check for latest version [here](https://github.com/lavanet/lava/releases): replace version accordingly, always use the version tagged latest

    cd $HOME
    git clone https://github.com/lavanet/lava.git
    cd lava
    git checkout v0.21.1.2
    make install
    

Confirm Installed

    which lavad
    lavad --help
    

When running the binary 1st time it creates the working folder `.lava` with the following files: `app.toml, client.toml, config.toml`

3\. Lava CLI & Wallet
---------------------

The lava provider process needs to connect to a Lava node to interact with the lava network.

**Add Lava Node**

Add lava rpc endpoint to `client.toml` in `.lava/configs`

    lavad config node http://<local-node-IP>:26657/rpc/
    

**Test connection to full node:**

    curl http://<device-IP>:26657/status | jq .result.sync_info.catching_up
    

This just ensures an external node is reachable by direct query, ensure ports are open on lava node: `26657, 1317, 26656`

**Set Keyring backend and chain-id**

    lavad config chain-id lava-testnet-2
    lavad config keyring-backend test
    

### **Add Wallet**

“provider-wallet” can be anything. Add `--recover` flag to import an existing seed.

    PROVIDER_ACCOUNT="provider-wallet"
    lavad keys add $PROVIDER_ACCOUNT --keyring-backend test
    

![Should see something like this (this is a test example)](https://storage.googleapis.com/papyrus_images/38abbc8d290ffb0c57c06a9a30d1ef25843239808e7d31269c98a3e99a77b948.png)

Should see something like this (this is a test example)

**MAKE SURE TO SAVE THE SEED PHRASE**

Other commands

    # view keys
    lavad keys list
    # delete keys
    lavad keys delete 
    # view address
    lavad keys show $PROVIDER_ACCOUNT --address
    

**Test connection via CLI**: it should be set in config `client.toml` to connect to your own lava node, if it returns the balance of your wallet then lava client is configured correctly.

    lavad query bank balances <lava address here>
    

4\. Prepare Nodes for Provider
------------------------------

Ensure your Relay Chain nodes are operational and meet the required specifications. Lava connects blockchain nodes from various networks to consumers, providers can run one or more nodes enabled by lava.

Nodes can be deployed as a ‘full node’ which normally means synced to the network and stores the chain data, non-validating and RPC and/or gRPC/REST API open.

**Test Connection to full node:**

Check operational, synced, and configured correctly with required API interfaces/ports open. This node should be hosted on the same device so available over `http://localhost:<port>`

example for ‘Juno’:

    curl http://127.0.0.1:26657/status | jq .result.sync_info.catching_up
    

**Generate TLS certificate and Setup Sub-domains (Nginx)**

Lava provider requires nodes be registered via a sub-domain/TLS certificates, a detailed guide on how to do this is covered here: [sub-domains with NGINX](https://github.com/GLCNI/RPC-node-deployments/blob/main/additional/sub_domains_nginx.md)

**Getting API and chain specs**

Get easy relevant information [here](https://public-rpc.lavanet.xyz/rest/lavanet/lava/spec/show_all_chains): to do this from your node

    lavad q spec list-spec
    

**check providers on a specific chain**

    lavad query pairing providers "<NETWORK_NAME>"
    

5\. Stake Provider Nodes
------------------------

Stake a provider to signal on-chain the $LAVA stake on the Lava network.

**Check Balance:**

    lavad query bank balances <lava address here>
    

**Stake Provider Command Format:**

    lavad tx pairing stake-provider [chain-id] [amount] [endpoint endpoint ...] [geolocation] [flags]
    

**Parameters:**

*   `chain-id` - The ID of the serviced chain (e.g., `COS4` or `EHT1`) find in list-spec
    
*   `ammount` - Stake amount in `ulava`
    
*   `geolocation` - what geolocation the provider/nodes will be hosted, all locations here:.
    

![](https://storage.googleapis.com/papyrus_images/c223e5078a0773bd393769f626c8c232910d0b50283063cb280410db3b8b3355.png)

**Endpoint Format:**

    <sub-domain for node>:<nginx-port>,geolocation
    

**Flags:**

*   `--from` - The wallet to be used for the provider (`$PROVIDER_ACCOUNT`).
    
*   `--provider-moniker` - Provider’s public name
    
*   `--keyring-backend` - A keyring-backend of your choosing (e.g., `test`).
    
*   `--chain-id` - The chain\_id of the network (e.g., `lava-testnet-2`).
    
*   `--gas` - The gas limit for the transaction (e.g., `"auto"`).
    
*   `--gas-adjustment` - The gas adjustment factor (e.g., `"1.5"`).
    
*   `--node` - can be omitted if set in `client.toml`
    

### Examples:

**Example with Ethereum**:

    ETH_STAKE_AMMOUNT=<ammount to stake, eg. "50000000000ulava">
    ETH_NODE_MONIKER=<whatever moniker for this node> 
    ETH_SUBDOMAIN=<Subdomain for this node eg. provider-host.com>
    ETH_NGINX_PORT=<port used for NGINX>
    

    lavad tx pairing stake-provider "ETH1" $ETH_STAKE_AMMOUNT "$ETH_SUBDOMAIN:$ETH_NGINX_PORT,jsonrpc,2" 2 --from $PROVIDER_ACCOUNT --provider-moniker $ETH_NODE_MONIKER --keyring-backend "test" --chain-id "lava-testnet-2" --gas="auto" --gas-adjustment "1.5"
    

EVMs usually have only `jsonrpc` interface: (`ws` can usually be enabled)

**Example with Cosmos:**

    COS_STAKE_AMMOUNT=<ammount to stake, eg. "50000000000ulava">
    COS_NODE_MONIKER=<whatever moniker for this node> 
    COS_SUBDOMAIN=<Subdomain for this node eg. provider-host.com>
    COS_NGINX_PORT=<port used for NGINX>
    

    lavad tx pairing stake-provider "COS5T" $COS_STAKE_AMMOUNT "$COS_SUBDOMAIN:$COS_NGINX_PORT,2" 2 --from $PROVIDER_ACCOUNT --provider-moniker $COS_NODE_MONIKER --keyring-backend "test" --chain-id "lava-testnet-2" --gas="auto" --gas-adjustment "1.5"
    

Cosmos chains usually have `rest`, `tendermintrpc` & `grpc` interface, all mandatory:

**Example with Avalanche:**

    AVAX_STAKE_AMMOUNT=<ammount to stake, eg. "50000000000ulava">
    AVAX_NODE_MONIKER=<whatever moniker for this node> 
    AVAX_SUBDOMAIN=<Subdomain for this node eg. provider-host.com>
    AVAX_NGINX_PORT=<port used for NGINX>
    

    lavad tx pairing stake-provider "AVAX" $AVAX_STAKE_AMMOUNT "$AVAX_SUBDOMAIN:$AVAX_NGINX_PORT,2" 2 --from $PROVIDER_ACCOUNT --provider-moniker $AVAX_NODE_MONIKER --keyring-backend "test" --chain-id "lava-testnet-2" --gas="auto" --gas-adjustment "1.5"
    

[Default http rpc port](https://docs.avax.network/reference/standards/guides/issuing-api-calls) for avalanche is: `9650`

**Example with Juno:**

    JUNO_STAKE_AMMOUNT=<ammount to stake, eg. "50000000000ulava">
    JUNO_NODE_MONIKER=<whatever moniker for this node> 
    JUNO_SUBDOMAIN=<Subdomain for this node eg. provider-host.com>
    JUNO_NGINX_PORT=<port used for NGINX>
    

    lavad tx pairing stake-provider "JUN1" $JUNO_STAKE_AMMOUNT "$JUNO_SUBDOMAIN:$JUNO_NGINX_PORT,2" 2 --from $PROVIDER_ACCOUNT --provider-moniker $JUNO_NODE_MONIKER --keyring-backend "test" --chain-id "lava-testnet-2" --gas="auto" --gas-adjustment "1.5"
    

[Default Ports](https://docs.cosmos.network/main/core/grpc_rest#an-overview-of-all-endpoints) for Cosmos based nodes:-the gRPC server (default port: `9090`)-the REST server (default port: `1317`)-the CometBFT RPC endpoint (default port: `26657`)

**Verify Stake**

    # from wallet
    lavad query pairing account-info --from $PROVIDER_ACCOUNT
    # from address
    lavad query pairing account-info <address>
    

6\. Create Configuration file
-----------------------------

**Create a single configuration file to manage each endpoint/rpc node, each node will have its own dedicated provider process and configuration file.**

_All configuration files should be located in the default node home directory (e.g., app.DefaultNodeHome/config) or the local running directory._

    mkdir lava-provider/config
    nano lava-provider/config/rpcprovider.yml
    

`node-urls`: The endpoint URL/Sub-domain for nodes to provide on :< NGINX port> `network-address`: The URL for Lava full node, as it will be local use `127.0.0.1:2221`, `2221` will be the default provider port to connect to Nginx service (from Step 4) More examples can be found [here](https://github.com/lavanet/lava/tree/main/config/provider_examples): **Example for Juno:** # Configuration for JUNO Chain endpoints: - api-interface: tendermintrpc chain-id: JUN1 network-address: address: 127.0.0.1:2221 disable-tls: true node-urls: - url: ws://127.0.0.1:26657/websocket - url: http://127.0.0.1:26657 - api-interface: grpc chain-id: JUN1 network-address: address: 127.0.0.1:2221 disable-tls: true node-urls: url: 127.0.0.1:9090 - api-interface: rest chain-id: JUN1 network-address: address: 127.0.0.1:2221 disable-tls: true node-urls: url: http://127.0.0.1:1317 **Example for Avax:** # Configuration for AVAX Chain endpoints: - api-interface: jsonrpc chain-id: AVAX network-address: address: 127.0.0.1:2221 disable-tls: true node-urls: - url: ws://127.0.0.1:3333/C/rpc/ws internal-path: "/C/rpc" # c chain like specified in the spec - url: https://127.0.0.1:3334/C/avax internal-path: "/C/avax" # c/avax like specified in the spec - url: https://127.0.0.1:3335/X internal-path: "/X" # x chain like specified in the spec - url: https://127.0.0.1:3336/P internal-path: "/P" # p chain like specified in the spec 6. Set up Provider Service `rpcprovider` _is a command line tool for setting up an RPC server that listens for requests from Lava protocol RPC consumers, forwards them to a configured node, and responds with the reply. The configuration can be provided via a YAML configuration file or as command line arguments._ **Command format** lavad rpcprovider /path/to/config/rpcprovider.yml <flags> `rpcprovider` accepts the following flags: `--geolocation` (required): Geolocation to run from (`1` for US, `2` for EU) `--from` (required): Account name to use (e.g., `alice`) For More try : `lavad rpcprovider --help` **Create System Service for Provider process** sudo tee /etc/systemd/system/lavad-provider.service > /dev/null <<EOF \[Unit\] Description=Lava Provider After=network-online.target \[Service\] User=$USER ExecStart=$(which lavad) rpcprovider $HOME/lava-provider/config/rpcprovider.yml --geolocation 2 --from $PROVIDER\_ACCOUNT --chain-id lava-testnet-2 --node tcp://<SERVER-IP>:26657 Restart=always RestartSec=3 LimitNOFILE=infinity LimitNPROC=infinity \[Install\] WantedBy=multi-user.target EOF **Enable and Start service** sudo systemctl daemon-reload sudo systemctl enable lavad-provider sudo systemctl start lavad-provider **Check status and logs** sudo systemctl status lavad-provider sudo journalctl -u lavad-provider -f 7. Test Provider **From wallet** lavad test rpcprovider --from $PROVIDER\_ACCOUNT Note: if you need to troubleshoot issues by looking for more expressive logs, try adding to the provider start command. --trace --log\_level debug Additional Commands **Unstake/Unfreeze Provider Command:** lavad tx pairing unfreeze <> lavad tx pairing unstake-provider <the same flags used to stake provider> for more information see `lavad tx pairing --help`

---

*Originally published on [GLCstaked](https://paragraph.com/@glcstaked/lava-provider-node)*
