Example queries

This page provides general instructions on how to query Blockchain Analytics.

See the BigQuery documentation for instructions on using BigQuery.

To build your own query:

  1. In the Google Cloud console, go to the BigQuery page.

    Go to BigQuery

  2. Click Compose a new query.
  3. Type a query in the Editor field.
  4. Click Run.

For example, to list the total number of transactions for each day for the last six months:

  1. In the Google Cloud console, go to the BigQuery page.

    Go to BigQuery

  2. Copy the following and paste it into the query box:

    SELECT
      TIMESTAMP_TRUNC(block_timestamp, DAY) AS timestamp1, COUNT(1) AS txn_count
    FROM
      bigquery-public-data.goog_blockchain_ethereum_mainnet_us.transactions
    WHERE
      block_timestamp >= CAST(DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH) AS TIMESTAMP)
    GROUP BY timestamp1
    ORDER BY timestamp1
    
  3. Click Run. The following shows an example result:

Example result
timestamp1 txn_count
2023-01-10 00:00:00.000000 UTC 1061055
2023-01-11 00:00:00.000000 UTC 1083178
2023-01-12 00:00:00.000000 UTC 1085563
2023-01-13 00:00:00.000000 UTC 1076328
2023-01-14 00:00:00.000000 UTC 1107804
2023-01-15 00:00:00.000000 UTC 1000777
2023-01-16 00:00:00.000000 UTC 1057284
2023-01-17 00:00:00.000000 UTC 1018353
2023-01-18 00:00:00.000000 UTC 1118225
2023-01-19 00:00:00.000000 UTC 1007125
2023-01-20 00:00:00.000000 UTC 1024504