đŸ”„ Analyze Real-time Polygon Blockchain Data with Google BigQuery

Polygon
Google Cloud - Community
3 min readMay 28, 2021

Hosted by Google Cloud as a financial services public dataset, the Polygon blockchain dataset has been listed in the Google Cloud Marketplace, and can be found here.

Polygon aims to serve as an internet-of-blockchains for Ethereum, bringing massive scale to Ethereum via the Polygon SDK, supporting both standalone blockchains and secured blockchains.

This dataset is part of a larger effort to make cryptocurrency data available in Google BigQuery through the Google Cloud Public Datasets program. The program is hosting a number of real-time cryptocurrency datasets, with plans to expand offerings to include additional distributed ledgers. You can find these datasets by searching for “crypto” in the GCP Marketplace. For analytics interoperability, Google has designed a unified schema that allows all Bitcoin-like datasets to share queries.

This public dataset is hosted in Google BigQuery and is included in BigQuery’s 1TB/mo of free tier processing. This means that each user receives 1TB of free BigQuery processing every month, which can be used to run queries on this public dataset. Watch this short video to learn how to get started quickly using BigQuery to access public datasets.

What is BigQuery?

Google BigQuery makes it simple to query on-chain data in a simple, organized manner on the cloud using standard SQL syntax. You can think of it like a massive indexer that allows you to perform powerful data analysis. You are also able to perform the same or similar queries on multiple blockchains at once and compare them, or track cross-chain activity on interoperable tokens.

Some possibilities unlocked using Google BigQuery on the Polygon Dataset include the ability to:

  • Monitor gas costs over time
  • Monitor a smart contract’s calls and activity
  • Multi-Chain Analysis for SDKs like the Polygon SDK
  • Integrate with traditional financial record processing systems
  • Determine the most active/popular tokens, contracts, or applications on Polygon
  • Audit groups of transactions

Sample Queries to get started with Polygon Data on BigQuery:

  1. You can find out the number of active addresses on Polygon by running this simple query.
# Calculate Active Monthly EOA's from Polygon Transactions#standardSQLSELECTDATE(TIMESTAMP_TRUNC(block_timestamp, MONTH, "UTC")) AS month,COUNT(DISTINCT from_address) AS active_addressesFROM `public-data-finance.crypto_polygon.transactions`GROUP BY monthORDER BY month DESC

After running the query, you will get the results which can then be exported as CSV/to Google Sheets for further analysis. You can also proceed to use Google Data Studio to generate interactive visualizations based on this data, by clicking on the ‘Explore Data’ button.

Using Google Data Studio to Visualize Query Results

Blockchain analytics platform Nansen already built a Polygon dashboard that you can check out here.

Example of using BigQuery for Polygon Datasets

Interested in learning more about how the data from these blockchains were brought into BigQuery? Looking for more ways to analyze the data? Check out the Google Cloud Big Data blog post and try the sample queries to get started.

Who made this happen?

It has been a pleasure to work with Helix Technologies, Nansen, and the Google Cloud Developer Relations team on this project.

We look forward to seeing how the vibrant developer community at Polygon uses this powerful platform to bring further utility to their Dapps!

Other relevant links:

About Polygon

Polygon is the first well-structured, easy-to-use platform for Ethereum scaling and infrastructure development. Its core component is Polygon SDK, a modular, flexible framework that supports building and connecting Secured Chains like Plasma, Optimistic Rollups, zkRollups, Validium etc and Standalone Chains like Polygon POS, designed for flexibility and independence. Polygon’s scaling solutions have seen widespread adoption with 350+ Dapps, ~121M txns and ~1M+ unique users.

If you’re an Ethereum Developer, you’re already a Polygon developer! Leverage Polygon’s fast and secure txns for your Dapp, get started here.

More about Polygon: Website | Twitter | Reddit | Telegram | Discord

--

--

Polygon
Google Cloud - Community

Polygon is the first well-structured, easy-to-use platform for Ethereum scaling & infrastructure development. Follow us on Twitter — twitter.com/0xPolygonTech