Providers

!!!IMPORTANT!!!

In testnet2, you now need to configure TLS certificates for the provider - more details here - https://docs.lavanet.xyz/provider-tls/?utm_source=lava-discord&utm_medium=discord&utm_campaign=testnet-fork

Please note that this program is not incentive. The team encourages all potential providers to apply and participate in this program to help build a reliable and secure Lava network. To become a provider, please complete this form - https://form.typeform.com/to/zB7JLVRs

A provider can get a jail status if during the last 3 epochs (1.5 hours) consumers complain about it and they have more than 95% errors in the first 10 messages or if the connection is lost In the current testnet, the slashing mechanism is disabled - therefore, providers should receive their test coins back in 25 hours. The team does not plan to introduce stricter restrictions - therefore, after the temporary jail stage, it will be possible to return to the work of the provider In the future, it is possible to enable slashing for getting into the jail, but this is not yet in the nearest plans

When placing bets as a provider in transactions, four main parameters are used:

Stake: the amount of LAVA that will be sent to the stake. For a test network, this value should be at least 50000 LAVA per network. The value can be greater, but not less

Geolocation: Specifies the geolocation of your server. US corresponds to 1 and EU corresponds to 2

ChainID: Identifier of the target blockchain network such as Cosmos Mainnet, Ethereum Ropsten, etc.

Endpoints: A list of endpoints, each specifying an address, geolocation, and an API like REST, JSON-RPC, etc. It is important to note that all provider requests are made using gRPC

There are several ways to find out the ChainID - by going to the dashboard or using information from RPC or using the following command

lavad q spec list-spec --node https://public-rpc.lavanet.xyz:443/rpc/ | grep index```

Providers are the backbone of the Lava network, serving relay requests by staking on the network and managing RPC nodes on relay chains (eg Cosmos, Ethereum, Osmosis, Polygon, etc.). In return, providers are paid in the form of LAVA tokens for serving these requests

Configuring the LAV1 provider

LAV1 is a chain identifier that allows you to become a provider using the LAVA testnet. This network is ideal for starting a provider. After you can easily add other networks In this guide, we will be using a staking validator wallet and a synchronized lava node, so it is assumed that we already have an up-to-date version of lava and other networks installed on our server. Our server is located in Europe, so we will use --geolocation 2

0 - Download the lavap binary file

From 10/02/2023, a separate lavap binary file must be used for the provider. You can also configure lavavisor (analogous to cosmovisor). More details here

git clone https://github.com/lavanet/lava && cd lava
export LAVA_BINARY=lavap
make install
lavap version
#v1.0.4

1 - Create or restore a wallet and replenish it with at least 50000LAVA

For a testnet, you must use --keyring-backend test as it is necessary to sign transactions. It will be fixed in mainnet

# create wallet
lavad keys add <name_wallet> --keyring-backend test

# restore wallet (after insert seed command)
lavad keys add <name_wallet> --recover --keyring-backend test

# check balance
lavad q bank balances <address>

2 - Registering a stake for the network we need. In this case LAV1 (lava-testnet-1)

In the example below, we have specified port 12345. This port number is intended to inform others that your ISP's services will work at this address with this particular port number. Please don't confuse provider_port with RPC, API or gRPC port numbers! You can change this port to the value you need, but don't forget to make this port open to the outside world. Also change <name_wallet> <server_ip> <moniker> to your own values

IMPORTANT - before you begin, you must configure a TLS certificate

lavap tx pairing stake-provider "LAV1" \
    "50000000000ulava" \
    "<lava.your-site:443>,2,tendermintrpc,rest,grpc" 2 \
    --from "<name_wallet>" \
    --provider-moniker "<moniker>" \
    --keyring-backend "test" \
    --gas="auto" \
    --gas-adjustment "1.5" \
    --fees 5000ulava

Congratulations - you have officially declared yourself as a service provider in LAVA! To register other networks, send another transaction replacing LAV1 with the desired value of another network! For example, the transaction for osmosis testnet would look like this:

lavap tx pairing stake-provider "COS4" "50000000000ulava" "osmosis.your-site:443,2,tendermintrpc,rest,grpc" 2 --from "<name_wallet>" --provider-moniker "" --keyring-backend "test" --gas="auto" --gas-adjustment "1.5" --fees 5000ulava

It's time to check the status of your provider

# check registered provider
lavad query pairing account-info <lava@1sdx...>

# check all providers in LAV1 network
lavad query pairing providers LAV1

Setting rpcprovider.yml

Create a config with the following content

nano $HOME/.lava/config/rpcprovider.yml

Use exactly 0.0.0.0:12345 to successfully catch incoming traffic. Also in the config, if necessary, change ports 26657, 9090 and 1317 to your RPC, gRPC and API values, respectively If you run several networks at the same time, for example LAV1 and COS4, then just add additional lines to the config below with COS4

endpoints:
  - api-interface: tendermintrpc
    chain-id: LAV1
    network-address:
      address: 0.0.0.0:12345
      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: LAV1
    network-address:
      address: 0.0.0.0:12345
      disable-tls: true
    node-urls: 
      - url: 127.0.0.1:9090
  - api-interface: rest
    chain-id: LAV1
    network-address:
      address: 0.0.0.0:12345
      disable-tls: true
    node-urls: 
      - url: http://127.0.0.1:1317

Starting from v1.0.2 lavap you can and should use cache

Lava's caching service is used to reduce costs and improve overall network performance. Both providers and consumers benefit from a caching service. Providers that have caching enabled may return responses faster than providers that do not have caching enabled

Create a cashe service file

tee /etc/systemd/system/lava-cache.service > /dev/null << EOF
[Unit]
Description=Lava cache service
After=network-online.target
[Service]
User=$USER
ExecStart=$(which lavap) cache 127.0.0.1:7777 --metrics_address 127.0.0.1:5747 --log_level debug
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable lava-cache.service
systemctl start lava-cache.service
journalctl -u lava-cache.service -f -o cat

Create a service file. Replace <name_wallet> with your value

tee /etc/systemd/system/provider-lava.service > /dev/null <<EOF
[Unit]
Description=Provider Lava
After=network-online.target

[Service]
User=$USER
WorkingDirectory=/root/.lava/config
ExecStart=/root/go/bin/lavap rpcprovider lava-provider.yml --geolocation 2 --from <name_wallet> --chain-id lava-testnet-2 --keyring-backend test --cache-be 127.0.0.1:7777
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable lava-provider
systemctl restart lava-provider && journalctl -u lava-provider -f -o cat

You can also use the configuration check command

lavad test rpcprovider --from <name_wallet> --keyring-backend test

Useful Commands

# check logs for successful transactions
journalctl -fn 100 -u lava-provider | grep succeeded

# check registered provider
lavad query pairing account-info <lava@1sdx...>

# unstake
lavad tx pairing unstake-provider "LAV1" \
    --from "<name_wallet>" \
    --keyring-backend "test" \
    --gas="auto" \
    --gas-adjustment "1.5" \
    --fees 5000ulava

# remove provider
systemctl stop lava-provider
systemctl disable lava-providerd
rm /etc/systemd/system/lava-provider.service
systemctl daemon-reload
cd $HOME/.lava/config/
rm rpcprovider.yml

Last updated