How to host your own Powerloom Snapshotter node on Github Codespaces

How to host your own Powerloom Snapshotter node on Github Codespaces

Introduction

In the world of blockchain technology, data is king. Blockchain networks' decentralized and transparent nature has revolutionized various industries, from finance to supply chain management. However, understanding and harnessing the power of blockchain data can be daunting.

The Importance of Blockchain Data

Blockchain data serves as the lifeblood of any blockchain network. It contains a comprehensive record of all transactions and interactions within the network, making it a valuable source of information for analysis, auditing, and decision-making. By leveraging blockchain data, organizations can gain insights into user behavior, identify patterns, and enhance operational efficiency.

In this blog, we will explore the significance of blockchain data and delve into the process of hosting your own Powerloom Snapshotter node on Github Codespaces. By doing so, you can unlock the full potential of blockchain data and empower your engineering teams to build innovative solutions.

Stay tuned for our step-by-step guide on setting up your Powerloom Snapshotter node and harnessing the power of blockchain data!

Step 1:- Enroll in our testnet program.

The Powerloom Snapshotter program is exclusively available to users who have been accepted into the testnet program and have been whitelisted. Therefore, it is essential to confirm that you have been added to the whitelist before setting up your own Powerloom Snapshotter node.

Step 2: Follow the deployment repository.

We have created a dedicated repository that simplifies setting up the snapshotter node. This repository contains all the necessary code and instructions to clone, install, and configure the snapshotter node quickly.

To access the repository, please follow this link:

https://github.com/PowerLoom/deploy/tree/testnet_5_pairs

Step 3: Spinning the codespaces machine

GitHub has recently introduced a virtual machine called "Github Codespaces". It's a powerful tool that allows you to test your code and applications in a virtual environment. You can easily set up and run your code without complex local installations with GitHub Codespaces. It provides a seamless and convenient way to experiment, debug, and collaborate on your projects.

Next, locate the green "Code" button and click on it. In the subsection, you'll find an option called "Codespaces.” Click on that option.

Finally, you'll see a large button that says, "Create codespace on testnet_5_pairs.” Click on that button to create your codespace on the testnet_5_pairs branch.

Now, GitHub will set up a virtual machine for you. You will see a screen similar to VS Code, where you can write and edit code.

This virtual environment allows you to work on your projects without complex local installations. It provides a user-friendly interface for coding, debugging, and collaborating with others.

Step 4: Building the Powerloom Snapshot node.

Once you have completed the setup process, it's time to configure your environment variables. Follow these steps:

  1. Locate the file named env.example in the repository.
  2. Create a new file in the same directory and name it .env.
  3. Open the .env file and copy the contents from env.example.
  4. Make any necessary changes to the environment variables in the .env file.

By copying the env.example file and creating a .env file, you can easily set up and customize your environment variables for the Powerloom Snapshotter node.

  • Ensure the following required variables are filled:Now you're all set with your environment variables configuration!Your .env should look like this:
    • SOURCE_RPC_URL: The URL for the source RPC (Local node/Infura/Alchemy) service.
    • SIGNER_ACCOUNT_ADDRESS: The address of the signer account. This is your whitelisted address on testnet - please file a ticket if you need a new burner wallet registered.
    • SIGNER_ACCOUNT_PRIVATE_KEY: The private key corresponding to the signer account address.
    • IPFS URL: This is the web address hosted by the IPFS service. (INFURA)
    • IPFS_API_KEY: The security key that allows you to access and interact with the IPFS service.
    • IPFS_API_SECRET: This secret passphrase or code provides additional security for accessing the IPFS service.
      • For this example, we’ll be using INFURA for our IPFS Setup.
      • If you don’t use any provider for IPFS, our systems will create a local instance for IPFS to store data.
# Required
SOURCE_RPC_URL=https://rpc.ankr.com/eth
# We are using RPC from ankr. You can use any other provider(Alchemy,geth node/infura)

SIGNER_ACCOUNT_ADDRESS=
SIGNER_ACCOUNT_PRIVATE_KEY=
PROST_RPC_URL=https://rpc-prost1d.powerloom.io
PROTOCOL_STATE_CONTRACT=0xb24553C414e8FD41fB0F19F04B53bbb22ea5EDCf
RELAYER_HOST=https://relayer-prost1d.powerloom.io
POWERLOOM_REPORTING_URL=https://testnet-reporting.powerloom.io

# Optional
IPFS_URL=
IPFS_API_KEY=
IPFS_API_SECRET=
SLACK_REPORTING_URL=
WEB3_STORAGE_TOKEN=
# To be able to access Pooler frontend  (http://<serverIP>:3000) on a remote instance, add the server IP in format below like this: POOLER_API_PREFIX=http://<serverIP>:8002
POOLER_API_PREFIX=

The final step is to run the build command. Our build scripts are automated using bash, making the process straightforward.

Before running the script, ensure that your environment variables are correctly set.

Once everything is ready, you may use the command below to initiate the script:

./build.sh

Running the script will take some time as it retrieves all the necessary Docker images from the registry and runs them locally on the virtual machine (Codespaces).

Once the script has finished executing, your Powerloom Snapshotter node will be up and running, ready to capture and process blockchain data.

In Github spaces, the ports are by default private for the users to access. You need to change the visibility of the port to get access to your pooler dashboard.

In GitHub Spaces, the ports are private by default, preventing users from accessing them. To access your pooler dashboard, you need to change the visibility of the port.

Confirming the status of your node:

  1. We have created a basic consensus dashboard at testnet-consensus.powerloom.io. After 5-10 minutes, your snapshotter address will be visible on the dashboard. You can use the search box to filter the results.
  2. Once all the services are active, you can access the front end via Pooler Frontend. The dashboard will display a summary of data for UNISWAPV2, similar to PowerLoom UNISWAPV2 Prod.

Here is an example of what our dashboard looks like:

Debugging:

If you are getting an error that says:

Container "<container_id>" is unhealthy.
ERROR: Encountered errors while bringing up the project.

Check if all the necessary docker containers are up and running. You should see an output against docker ps with the following containers listed:

#docker ps

CONTAINER ID   IMAGE                                  COMMAND                  CREATED       STATUS                 PORTS                                                                                                                                                 NAMES
bfa1abe2b8aa   powerloom-pooler-frontend              "sh -c 'sh snapshott…"   2 hours ago   Up 2 hours (healthy)   0.0.0.0:3000->3000/tcp, :::3000->3000/tcp                                                                                                             deploy-pooler-frontend-1
852f3445f11c   powerloom-pooler                       "bash -c 'sh init_pr…"   2 hours ago   Up 2 hours (healthy)   0.0.0.0:8002->8002/tcp, :::8002->8002/tcp, 0.0.0.0:8555->8555/tcp, :::8555->8555/tcp                                                                  deploy-pooler-1
ee652fda8513   powerloom-audit-protocol               "bash -c 'sh init_pr…"   2 hours ago   Up 2 hours (healthy)   0.0.0.0:9000->9000/tcp, :::9000->9000/tcp, 0.0.0.0:9002->9002/tcp, :::9002->9002/tcp                                                                  deploy-audit-protocol-1
5547fb5c1ab4   ipfs/kubo:release                      "/sbin/tini -- /usr/…"   2 hours ago   Up 2 hours (healthy)   4001/tcp, 8080-8081/tcp, 4001/udp, 0.0.0.0:5001->5001/tcp, :::5001->5001/tcp                                                                          deploy-ipfs-1
999de5864a1b   rabbitmq:3-management                  "docker-entrypoint.s…"   2 hours ago   Up 2 hours (healthy)   4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp   deploy-rabbitmq-1
2c14926d7cfd   redis                                  "docker-entrypoint.s…"   2 hours ago   Up 2 hours (healthy)   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                                                                             deploy-redis-1

Accessing the logs:

You can access the logs folders if you need to debug or monitor the services running on your Powerloom Snapshotter node. Each service has its log folder located within the logs directory.

These logs can provide valuable information for debugging or troubleshooting purposes. You can use them to identify any service errors or issues and take appropriate actions to resolve them.

Feel free to explore the logs folders and review the logs of different services to gain insights into the functioning of your Powerloom Snapshotter node.

If everything is functioning properly and you can view the dashboard, it indicates that your node is working correctly.

Congratulations! You've completed the setup process and can now tap into the potential of blockchain data with your Powerloom Snapshotter node. Now, you can leverage the power of blockchain data and unleash its capabilities.

About Powerloom

PowerLoom Protocol is a decentralized data protocol primarily aimed at serving the ever-growing data needs of users of smart contract-based applications like DeFi, games, and more.

We incentivize participating peers to reach consensus on observations of state transitions and event emissions across a plethora of smart contracts. By utilizing data compositions on smaller, consensus-reached data units, Powerloom stands as a peer-validated and accurate information source, empowering rich data applications like dashboards, bots, aggregators, and insights trackers.

Join Us

Website |  Discord |  Twitter | Telegram | LinkedIn