Unlocking Lava’s Potential with The Docker Toolbox for Blockchain Node Management

Michael (Impulse Expert)
5 min readSep 21, 2023

--

Intro

Lava is decentralizing access to blockchain data. It is the first truly unstoppable protocol for blockchain API access.

Serving as a two-sided marketplace that incentivizes and coordinates blockchain nodes to provide dApps with blockchain data, Lava is setting the standard for fast, reliable, and secure API at scale.

Lava as a Validator
Lava blockchain uses Proof-of-stake (PoS) as the consensus mechanism, based on Tendermint. Validators participate in the network by verifying new blocks to earn rewards.

Lava as a Provider
Providers are the backbone of the Lava network, servicing relay requests by staking on the network and operating RPC nodes on Relay Chains queried by Consumers (e.g., Cosmos, Ethereum, Osmosis, Polygon, etc.). In return, they earn fees in the form of LAVA tokens from the Consumers for servicing these requests.

For those with a passion for process automation, here’s a crafted script that simplifies the intricate process of installing Docker and harnessing the power of docker-compose. This script serves as your step-by-step guide, empowering you to seamlessly integrate these essential tools into your workflow.

Repository close up

build.sh’ is a meticulously crafted script designed with a single purpose: to streamline and automate the intricate process of Docker image creation. Serving as the linchpin in your containerization workflow, it simplifies what can otherwise be a complex endeavor — constructing Docker images from source code and configurations becomes effortless.

For those immersed in the world of Lava blockchain, ‘run_node.sh’ is a versatile gem. Tailored specifically to ease the deployment and operation of validator and provider nodes, this script is your trusted ally. Whether you’re engaged in a proof-of-stake network as a validator or managing vital infrastructure as a node operator, ‘run_node.sh’ simplifies your tasks and enhances your efficiency.

At the heart of Docker’s image-building process lies the Dockerfile, a plain-text configuration file. It serves as your step-by-step guide for creating Docker images that encapsulate all the essentials for running software. From application code to runtime environment, dependencies, and configuration files, the Dockerfile is your blueprint for success.

Enter docker-compose.yml, a YAML-formatted configuration file that takes command in the realm of multi-container Docker environments. Consider it the mission control for orchestrating your application’s containers. With it, you define services, networking, volumes, and other critical elements, enabling you to master the intricacies of your containerized setup effortlessly.

Build steps

username:~/node-tools/lava$ ./build.sh
What node type is required for build?
1) provider
2) validator
Node type selected: 1
Enter image name: lava
Enter release tag: v0.23.5
Do you want to send the image to DockerHub?
1) yes
2) no
Send the image to DockerHub: 2

### The build information ###
Build date: 2023-09-21
Docker context: /home/michael/node-tools/lava
Dockerfile: /home/michael/node-tools/lava/Dockerfile
Docker Image: lava:v0.23.5-provider
Node type: provider
Version: v0.23.5

[+] Building 564.3s (10/14)
=> [internal] load .dockerignore
=> => transferring context: 2B
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 1.03kB
=> [internal] load metadata for docker.io/library/golang:1.20-bullseye
=> [internal] load metadata for docker.io/library/debian:bullseye-slim
...
=> => naming to docker.io/library/lava:v0.23.5-provider

The build is complete!

1. User Interaction: The script starts by prompting the user to select the type of node they want to build. In this case, the user is presented with two options: “provider” and “validator.” The user selects “1” to indicate that they want to build a provider node.

2. Image Configuration: Next, the user is asked to specify an image name (in this case, “lava”) and a release tag (here, “v0.23.5”).

3. DockerHub Image Upload: The script then gives the user the option to upload the created Docker image to DockerHub. In this instance, the user chooses not to upload it (option “2”).

4. Build Information: Following user input, the script provides important build information. This includes the build date, the directory where Docker is working (“Docker context”), the Dockerfile location, the resulting Docker image name (in this case, “lava:v0.23.5-provider”), the node type (“provider”), and the version (“v0.23.5”).

5. Building Process: The script proceeds to execute the Docker build process. It shows the steps it’s taking, such as loading .dockerignore files, loading build definitions from the Dockerfile, and loading metadata for various base images. The script provides progress updates and details on each step.

6. Build Completion: Once the Docker image building process is complete, the script indicates that the build has finished.

In summary, this script automates the creation of Docker images for specific blockchain node types (in this case, a provider node) and provides clear feedback to the user about the build’s progress and final outcome. It streamlines the process of creating and configuring Docker images for blockchain nodes, making it more efficient and user-friendly.

Install Docker Engine

Ubuntu Debian CentOS

Run docker container

Lava Validator

docker run --name lava-validator \
-e CHAINID=<chain id> \
-e CONFIG_PATH='/root/.lava' \
-e DIFF_HEIGHT=1000 \
-e KEY=<key name> \
-e KEYRING='test' \
-e KEYALGO=eth_secp256k1 \
-e LAVA_RPC=<url lava rpc> \
-e LOGLEVEL='info' \
-e MONIKER=<pool name> \
-e PEERS=<list peers> \
-e SEEDS=<list seeds> \
-e STATESYNC='true' \
-p 26656:26656 \
-v ~/.lava/:/root/.lava \
-d <image:tag>

To create and launch a docker container, you need to define environment variables: CHAINID, KEY, LAVA_RPC, MONIKER, PEERS, SEEDS and specify an lava validator image.

Docker container logs

docker container logs [OPTIONS] CONTAINER

Options:
— details (Show extra details provided to logs)
— follow or -f (Follow log output)
— tail or -n (Number of lines to show from the end of the logs)

ex.: docker container logs -f lava-provider

Run docker compose

docker compose up -d

Official Chain IDs

Every chain must have a unique identifier or chain-id. Tendermint requires each application to define its own chain-id in the genesis.json fields.

lava-testnet-2

Geo-location

The location of the provider’s nodes. (Note that 0 is only assigned via policy/gov proposal)

Manual configuration node

You can find any details about it by using our docs.lavanet.xyz

Conclusion

The blockchain landscape is evolving rapidly with the rise of projects like Lava, emphasizing the importance of efficiency and automation. This script helps to simplifyi Docker image creation for specific node types, making it accessible and user-friendly.

This tool empowers users to effortlessly configure and build Docker images while providing essential feedback. It streamlines the deployment and management of blockchain nodes, enabling users to focus on work rather than containerization intricacies.

Useful Links

--

--

Michael (Impulse Expert)

Crypto-enthusiast, Node operator, passionate contributing to the decentralized applications and exploring new use cases for blockchain, site: impulse.expert