BigQuery Integration for Lens Network Datasets

Overview

This documentation provides a comprehensive guide for integrating and accessing Lens Network datasets via Google BigQuery. It is designed to help users query and analyze data related to the Lens Network's testnet environment. The datasets currently available include:

  • lens_network_testnet_block_explorer: Contains detailed information about transactions, blocks, and other metadata within the Lens Network's testnet.

  • lens_network_testnet_external_node: Contains logs, events, and node interactions occurring in the testnet environment.

Datasets Overview

  1. lens_network_testnet_block_explorer: This dataset includes information from the Lens Network's block explorer. It provides detailed data on all the transactions, blocks, and associated metadata within the testnet environment.

  2. lens_network_testnet_external_node: This dataset consists of data from the external nodes of the Lens Network. It includes logs, events, and interactions that happen on nodes participating in the Lens Network's testnet.

Accessing the Datasets

To access the datasets via BigQuery:

  1. Setup Google Cloud Project:

  • Ensure you have a Google Cloud account with billing enabled.

  • Create a new project or use an existing one.

  1. Enable BigQuery API:

  • Go to the Google Cloud Console.

  • Navigate to "APIs & Services" > "Library."

  • Search for "BigQuery API" and enable it.

  1. Querying the Datasets:

  • Open the BigQuery console in Google Cloud.

  • Go to the SQL workspace in the BigQuery panel.

  • Run the following query to access the dataset:

SELECT *FROM `lens-public-data.lens_network_testnet_block_explorer.public_blocks`WHERE number = 1000;

Please note you MUST query this from the US region. If you try to use the EU region, it will not be able to find the dataset.

This query retrieves all the details of block number 1000 from the lens_network_testnet_block_explorer dataset.

Example Use Cases

  1. Analyzing Transactions:

  • Query the lens_network_testnet_block_explorer dataset to analyze transaction patterns, gas fees, and success rates.

  1. Node Performance Monitoring:

  • Use the lens_network_testnet_external_node dataset to monitor node performance, track uptime, and analyze event logs.

Integration with External Tools

You can integrate these datasets with external data analysis and visualization tools like Google Data Studio, Tableau, or custom Python scripts using the BigQuery API.

Example with Python:

from google.cloud import bigquery
# Initialize a BigQuery clientclient = bigquery.Client()
# Query the datasetquery = '''  SELECT *  FROM `lens-public-data.lens_network_testnet_block_explorer.public_blocks`  WHERE number = 1000;'''query_job = client.query(query)
# Process the resultsresults = query_job.result()for row in results:  print(row)

This documentation provides a starting point for accessing and utilizing Lens Network datasets via BigQuery. Users are encouraged to explore and experiment with the data to gain deeper insights into the Lens Network's operation. The mainnet data will be available soon, expanding the scope of accessible data.