BigQuery dataset
This dataset is subject to change without notice.
Please provide feedback on missing features to be included in the final ETL.
Public dataset
Nodely maintains a public BigQuery dataset with Algorand mainnet contents:
- snapshot only (daily updates once schema is finalized)
- schema inspired by Google public blockchain datasets (ETH, …)
- dataset is public but not free - Google charges for data read from this dataset
- contact [email protected] for datasets and/or SelfService BI with hourly or 5m incremental loads.
Quick start
Go to Algorand dataset @ BigQuery and start playing ;D
Reading list
- Algorand transaction reference
- Inner transactions
- Algorand Standard Assets (tokens/NFTs)
- Account rekey
Schema
Base tables
CREATE TABLE `nodely-data-pub.algorand_mainnet_daily.transactions`( block_number INT64 NOT NULL -- Number of the block in which this transaction was located. block_timestamp TIMESTAMP NOT NULL -- Unix timestamp when the block was assembled transaction_hash STRING NOT NULL -- Hash of the transaction transaction_group BYTES -- Parent atomic group id (binary) transaction_offset INT64 NOT NULL -- Transaction's index position in the block transaction_type STRING NOT NULL -- One of acc_close acc_payment acc_payment_create app_call app_clear app_close app_delete app_optin app_update asa_clawback asa_config asa_create asa_destroy asa_freeze asa_optin asa_optout asa_transfer asa_unfreeze key_reg key_unreg stpf from_addr_id INT64 -- Sender address id to_addr_id INT64 -- Recipient address id value_float FLOAT64 NOT NULL -- Decimal adjusted amount of Algo or token value_int NUMERIC(20) NOT NULL -- Integer amount of Algo or Token without decimal shift close_to_addr_id INT64 -- Address id of recipient of the closing balance close_value_float FLOAT64 NOT NULL -- Closing balance amount, decimal adjusted close_value_int NUMERIC(20) NOT NULL -- Closing balance amount without decimal shift gas INT64 NOT NULL -- Transaction free in microAlgos note STRING -- Optional note (up to 1KB) rekey_to_addr_id INT64 -- Account rekey to address id auth_by_addr_id INT64 -- Transaction authorized by this address id (if sender is rekeyed) has_inners BOOL NOT NULL -- Transaction has inner transactions is_inner BOOL NOT NULL -- Transaction is an inner transaction issued by smart contract clawback_from_addr_id INT64 -- Address id of the account the token is clawed back from token_cfg STRUCT<list ARRAY<STRUCT<element INT64>>> NOT NULL -- new address ids for reserve/clawback/freezer/manger in random order token_id INT64 -- Asset id (token/nft) token_total NUMERIC(20) -- Total number of assets minted token_unit_name STRING -- Asset unit name contract_id INT64 -- ID of the contract called input STRING -- Extra TX data / app call input root_offset INT64 -- transaction offset pointing to the root (outer) transation parent_offset INT64 -- transaction offset pointing to parent transaction depth INT64 -- the depth of the transaction in the tree inners_all INT64 -- number of all inners spawned by this transaction (recursive) inners_direct INT64 -- number of all direct (1st level) inners spawned by this transaction PRIMARY KEY (block_number, transaction_offset) NOT ENFORCED, FOREIGN KEY (from_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (to_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (close_to_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (rekey_to_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (from_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (to_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (close_to_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (rekey_to_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (auth_by_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (auth_by_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (clawback_from_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (token_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.tokens`(token_id) NOT ENFORCED)PARTITION BY TIMESTAMP_TRUNC(block_timestamp, MONTH)CLUSTER BY block_number, transaction_offsetOPTIONS( description="Algorand mainnet transactions. See: https://nodely.io/docs/public/bigquery", labels=[("status", "production")]);
CREATE TABLE `nodely-data-pub.algorand_mainnet_daily.accounts`( addr_id INT64 NOT NULL -- id of the address address STRING NOT NULL -- Algorand string representation of the account address balance_micro NUMERIC NOT NULL -- Account microAlgo balance type STRING -- Account type : sig|msig|contract. sig/msig detection needs at least one outflow is_deleted BOOL NOT NULL -- Is account closed is_online BOOL NOT NULL -- Is account registered to vote block_number INT64 NOT NULL -- Block of the first inflow that created the account block_timestamp TIMESTAMP NOT NULL -- Timestamp of the first inflow that created the account last_closed_at INT64 -- Block of the last account close operation last_closed_at_ts TIMESTAMP -- Timestamp of the last account close operation rekeyed_to_addr_id INT64 -- Address id of account that is solely authorized to sign for this account contract_id INT64 -- Id of smart contract that owns this account nft_count INT64 NOT NULL -- Number of different tokens with total numner == 1 this account holds token_count INT64 NOT NULL -- Number of different tokens (of any type) this account holds usd_stables_balance FLOAT64 NOT NULL -- USD value of all stable USD tokens this account holds voting_from_block INT64 -- First block this account can vote on voting_until_block INT64 -- Last block this account can vote on mbr_micro INT64 NOT NULL -- Microalgos locked in this account as 'minimum balance' boxes INT64 NOT NULL -- Number of K/V storage entries in this account rekeyed_to_contract_id INT64 -- Id of smart contract that can spend from this account row_ver INT64 NOT NULL -- Row version (updated at block number) PRIMARY KEY (addr_id) NOT ENFORCED)PARTITION BY TIMESTAMP_TRUNC(block_timestamp, MONTH)CLUSTER BY addr_idOPTIONS( description="Account state. See: https://nodely.io/docs/public/bigquery", labels=[("status", "production")]);
CREATE TABLE `nodely-data-pub.algorand_mainnet_daily.blocks`( block_timestamp TIMESTAMP NOT NULL -- block timestamp block_number INT64 NOT NULL -- block number proposer_addr_id INT64 NOT NULL -- address id of block proposer voter_addr_ids STRUCT<list ARRAY<STRUCT<element INT64>>> NOT NULL -- list of cert voters addr ids, up to 75% threshold, random node sample block_algo_sum FLOAT64 NOT NULL -- sum of Algo transacted in the block block_gas_sum_malgo INT64 NOT NULL -- total fees in microAlgos block_rewards_malgo INT64 NOT NULL -- rewards to proposer in microAlgos block_tx_cnt INT64 NOT NULL -- successful transactions in the block tokens_dc INT64 NOT NULL -- tokens distinct count in the block nft_dc INT64 NOT NULL -- NFTs distinct count in the block contract_dc INT64 NOT NULL -- Contracts distinct count in the block token_id_top INT64 NOT NULL -- Top transacted token id in the block constract_id_top INT64 NOT NULL -- Top called contract id in the block addresses_new_cnt INT64 NOT NULL -- New addresses seen in the block group_cnt INT64 NOT NULL -- Atomic group count in the block group_max INT64 NOT NULL -- TX count in the largest group addresses_dc INT64 NOT NULL -- Addresses distinct count in the block pay_cnt INT64 NOT NULL -- Count of Algo payment TX keyreg_cnt INT64 NOT NULL -- Count of key (un)registration TX acfg_cnt INT64 NOT NULL -- Count of token configuration TX axfer_cnt INT64 NOT NULL -- Count of token transfer TX afrz_cnt INT64 NOT NULL -- Count of token (un)freeze TX appl_cnt INT64 NOT NULL -- Count of contract call TX stpf_cnt INT64 NOT NULL -- Count of state proof TX PRIMARY KEY (block_number) NOT ENFORCED)PARTITION BY TIMESTAMP_TRUNC(block_timestamp, MONTH)CLUSTER BY block_numberOPTIONS( description="Blocks stats. See: https://nodely.io/docs/public/bigquery", labels=[("status", "production")]);
CREATE TABLE `nodely-data-pub.algorand_mainnet_daily.contracts`( contract_id INT64 NOT NULL -- Id of the contract (app) block_number INT64 NOT NULL -- Block the contract was created at block_timestamp TIMESTAMP NOT NULL -- Timestamp the contract was created at creator_addr_id INT64 NOT NULL -- Addr_id of the creating account is_deleted BOOL NOT NULL -- Is the contract deleted closed_at INT64 -- Block numnber the contract got deleted at closed_at_ts TIMESTAMP -- Timestamp the contract got deleted at code BYTES -- Contract byte code code_hash_sha256 BYTES -- SHA256 of the contract bytecode clear_code BYTES -- Contract clear bytecode clear_code_hash_sha256 BYTES -- SHA256 of the contract clear bytecodwe addr_id INT64 -- Id of account address of the contract boxes INT64 NOT NULL -- Number of boxes this contract holds users INT64 NOT NULL -- Number of addresses that ever opted into this contract users_current INT64 NOT NULL -- Number of addresses that are not opted into the contract row_ver INT64 NOT NULL -- Row version (block number), use the latest one PRIMARY KEY (contract_id) NOT ENFORCED, FOREIGN KEY (addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (creator_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED)PARTITION BY TIMESTAMP_TRUNC(block_timestamp, MONTH)CLUSTER BY contract_idOPTIONS( description="Algorand mainnet contracts. See: https://nodely.io/docs/public/bigquery", labels=[("status", "production")]);
CREATE TABLE `nodely-data-pub.algorand_mainnet_daily.tokens`( token_id INT64 NOT NULL -- ID of the native token (ASA) block_number INT64 NOT NULL -- Block number of token creation block_timestamp TIMESTAMP NOT NULL -- Timestamp of token creation creator_addr_id INT64 -- ID of the creator address freeze_addr_id INT64 -- ID of the freeze address manager_addr_id INT64 -- ID of the manager address reserve_addr_id INT64 -- ID of the reserve address clawback_addr_id INT64 -- ID of the clawback address unit_name STRING -- Token unit name (ticker) name STRING -- Token full name url STRING -- URL associated with the token is_nft BOOL NOT NULL -- Is this an NFT (total = 1) arcs STRUCT<list ARRAY<STRUCT<element INT64>>> NOT NULL -- List of standards this token follows ipfs_json STRING -- JSON object with metadata downloaded from IPFS default_frozen BOOL NOT NULL -- Is the token frozen by default token_total NUMERIC(20) NOT NULL -- Total number of tokens decimals INT64 NOT NULL -- Decimal shift is_deleted BOOL NOT NULL -- Is the token deleted closed_at INT64 -- Block number of the token deletion closed_at_timestamp TIMESTAMP -- Timestamp of the token deletion row_ver INT64 NOT NULL -- Row version PRIMARY KEY (token_id) NOT ENFORCED, FOREIGN KEY (creator_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (reserve_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (manager_addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED)PARTITION BY TIMESTAMP_TRUNC(block_timestamp, MONTH)CLUSTER BY token_idOPTIONS( description="Native tokens (Algorand Standard Assets). See: https://nodely.io/docs/public/bigquery", labels=[("status", "production")]);
-- `nodely-data-pub`.algorand_mainnet_daily.token_holdings definition
CREATE TABLE `nodely-data-pub.algorand_mainnet_daily.token_holdings`( token_id INT64 NOT NULL -- ID of the token / NFT addr_id INT64 NOT NULL -- Holder address id token_total NUMERIC(20) NOT NULL -- Total number of tokens minted balance_int NUMERIC(20) NOT NULL -- Balance without decimal shift balance_float FLOAT64 NOT NULL -- Balance , decimal shifter unit_name STRING NOT NULL -- Unit name (ticker) is_circulating BOOL NOT NULL -- Does this balance count towards circulating supply is_frozen BOOL NOT NULL -- Is the token frozen is_deleted BOOL NOT NULL -- Is the holding deleted block_number INT64 NOT NULL -- Block number when address opted-in to the token block_timestamp TIMESTAMP NOT NULL -- Opt-in timestamp closed_at INT64 -- Block number holding got deleted (opted-out) closed_at_ts TIMESTAMP -- Opt-out timestamp row_ver INT64 NOT NULL -- Row version PRIMARY KEY (token_id, addr_id) NOT ENFORCED, FOREIGN KEY (addr_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.accounts`(addr_id) NOT ENFORCED, FOREIGN KEY (token_id) REFERENCES `nodely-data-pub.algorand_mainnet_daily.tokens`(token_id) NOT ENFORCED)PARTITION BY TIMESTAMP_TRUNC(block_timestamp, MONTH)CLUSTER BY token_id, addr_idOPTIONS( description="Native tokens holdings. Use See: https://nodely.io/docs/public/bigquery", labels=[("status", "production")]);
- An account can have multiple labels
- Each label has a source (eg Algorand Foundation) and multiple arbitrary tags
-- `nodely-data-pub`.algorand_mainnet_daily.account_labels definition
CREATE TABLE `nodely-data-pub.algorand_mainnet_daily.account_labels`( addr STRING NOT NULL -- Human readable Algorand address addr_id INT64 NOT NULL -- Internal address id last_updated_at TIMESTAMP NOT NULL -- Timestamp of the last update of any of the labels label_cound INTEGER NOT NULL -- Number of nested labels labels []RECORD label STRING -- Address label src STRING -- Source of the label (eg Algorand Foundation) tags []STRING -- Arbitrary tags (eg CEX) updated_at TIMESTAMP -- Last timestamp of the label update);
Base views
-- Simple non zero Algo / NFT / Token flows-- Each transaction creates 2 or more flows , +close_to, +clawback
-- Caveats:-- * Clawback not rendered yet-- * An NFT is a token with a total number or units == 1--create view `algorand_mainnet_daily.v_flows_simple` aswith flows as (-- no clawback select block_timestamp , from_addr_id addr_id , to_addr_id other_addr_id , 'outflow' as dir , value_float as flow_value , gas / pow(10,6) gas_algo , case when t.transaction_type like 'acc%' then 'algo' when token_total = 1 then 'nft' else 'token' end xfer , token_id , t.is_inner , t.transaction_type from `algorand_mainnet_daily.transactions` t where (t.transaction_type like 'acc%' or t.transaction_type like 'asa%')UNION ALL select block_timestamp , from_addr_id addr_id , close_to_addr_id other_addr_id , 'outflow' as dir , close_value_float as flow_value , 0 gas_algo , case when t.transaction_type like 'acc%' then 'algo' when token_total = 1 then 'nft' else 'token' end xfer , token_id , t.is_inner , t.transaction_type from `algorand_mainnet_daily.transactions` t where (t.transaction_type like 'acc%' or t.transaction_type like 'asa%') and close_to_addr_id IS NOT NULLUNION ALL select block_timestamp , to_addr_id addr_id , from_addr_id other_addr_id , 'inflow' as dir , value_float as flow_value , 0 gas_algo , case when t.transaction_type like 'acc%' then 'algo' when token_total = 1 then 'nft' else 'token' end xfer , token_id , t.is_inner , t.transaction_type from `algorand_mainnet_daily.transactions` t where (t.transaction_type like 'acc%' or t.transaction_type like 'asa%')UNION ALL select block_timestamp , close_to_addr_id addr_id , from_addr_id other_addr_id , 'inflow' as dir , close_value_float as flow_value , 0 gas_algo , case when t.transaction_type like 'acc%' then 'algo' when token_total = 1 then 'nft' else 'token' end xfer , token_id , t.is_inner , t.transaction_type from `algorand_mainnet_daily.transactions` t where (t.transaction_type like 'acc%' or t.transaction_type like 'asa%') and close_to_addr_id IS NOT NULL) select * from flows where flow_value > 0;
Aux tables
CREATE TABLE `nodely-data-pub.algorand_mainnet_daily`.token_prices( token_id INT64 NOT NULL -- id of the token token_name STRING NOT NULL -- token name token_ticker STRING NOT NULL -- token ticker algo_value FLOAT64 NOT NULL -- token current value in Algo market_cap FLOAT64 NOT NULL -- token current MC in Algo first_block_number INT64 NOT NULL -- first block with price data"))CLUSTER BY token_idOPTIONS( description="Token prices, updated daily. See: https://nodely.io/docs/public/bigquery", labels=[("status", "development")]);
Example queries
Accounts
Addresses created monthly
-- <1 GB processedSELECT TIMESTAMP_TRUNC(bs.block_timestamp, MONTH) ts , sum(`addresses_new_cnt) addresses_createdFROM `algorand_mainnet_daily.blocks` bsGROUP BY tsORDER BY ts
-- 40GB processesSELECT TIMESTAMP_TRUNC(txn.block_timestamp, MONTH) ts , count(*) addresses_createdFROM `algorand_mainnet_daily.transactions` txnWHERE txn.transaction_type = 'acc_payment_create'GROUP BY tsORDER BY ts
Daily discinct addresses stats
-- no clawback select TIMESTAMP_TRUNC(flows.block_timestamp, DAY) ts ,count(distinct(flows.addr_id)) uniq_addresses ,countIf(dir = 'outflow' and transaction_type = 'acc_payment_create') new_addresses ,count(distinct(case when dir = 'outflow' then flows.addr_id else NULL end)) uniq_senders ,count(distinct(case when dir = 'outflow' and xfer='algo' and flow_value > 100 then flows.addr_id else NULL end)) uniq_algo_senders_over_100A ,count(distinct(case when dir = 'inflow' then flows.addr_id else NULL end)) uniq_reveicers ,count(distinct(case when dir = 'inflow' and xfer='algo' and flow_value > 100 then flows.addr_id else NULL end)) uniq_algo_receivers_over_100A ,count(distinct(case when dir = 'inflow' then flows.addr_id || ':' || other_addr_id else NULL end)) uniq_pairs from `algorand_mainnet_daily.v_flows_simple` flows where flows.block_timestamp between '2024-04-01' and '2024-04-30' group by ts order by ts
-- no clawback select TIMESTAMP_TRUNC(flows.block_timestamp, DAY) ts ,count(distinct(flows.addr_id)) uniq_addresses ,count(distinct(case when coalesce(ame.type,'') != 'contract' then flows.addr_id else NULL end)) uniq_users ,countIf(dir = 'outflow' and transaction_type = 'acc_payment_create') new_addresses ,count(distinct(case when dir = 'outflow' then flows.addr_id else NULL end)) uniq_senders ,count(distinct(case when dir = 'outflow' and xfer='algo' and flow_value > 100 then flows.addr_id else NULL end)) uniq_algo_senders_over_100A ,count(distinct(case when dir = 'inflow' then flows.addr_id else NULL end)) uniq_reveicers ,count(distinct(case when dir = 'inflow' and xfer='algo' and flow_value > 100 then flows.addr_id else NULL end)) uniq_algo_receivers_over_100A ,count(distinct(case when dir = 'inflow' then flows.addr_id || ':' || other_addr_id else NULL end)) uniq_pairs ,count(distinct(case when dir = 'inflow' and coalesce(ame.type,'') != 'contract' and coalesce(aoth.type,'') != 'contract' then flows.addr_id || ':' || other_addr_id else NULL end)) uniq_p2p_pairs from `algorand_mainnet_daily.v_flows_simple` flows join `algorand_mainnet_daily.accounts` ame on (flows.addr_id = ame.addr_id) join `algorand_mainnet_daily.accounts` aoth on (flows.other_addr_id = aoth.addr_id) where flows.block_timestamp between '2024-04-01' and '2024-04-30' group by ts order by ts
ts | u_addr | u_users | n_addr | u_snd | u_snd_100 | u_rcv | u_rcv_100 | u_pairs | u_p2p_pairs |
---|---|---|---|---|---|---|---|---|---|
2024-04-01 | 60379 | 58682 | 8039 | 35924 | 6789 | 56326 | 7868 | 125254 | 100499 |
2024-04-02 | 57538 | 56058 | 8472 | 34813 | 6901 | 54054 | 7542 | 116025 | 94185 |
2024-04-03 | 68982 | 67593 | 11078 | 35524 | 7105 | 65422 | 7688 | 125994 | 106034 |
2024-04-04 | 91427 | 78440 | 7981 | 38997 | 7076 | 88015 | 12873 | 157863 | 118940 |
2024-04-05 | 79063 | 66208 | 8843 | 40902 | 7572 | 75180 | 8086 | 153148 | 113668 |
2024-04-06 | 194888 | 191872 | 8005 | 20760 | 6017 | 190567 | 6271 | 416394 | 395175 |
Top 10
-- White Stars (spawning new accounts)-- ~5GBWITH whiteStars AS ( SELECT from_addr_id addr_id, count(distinct(to_addr_id)) spread FROM `algorand_mainnet_daily.transactions` WHERE block_timestamp > CURRENT_TIMESTAMP() - INTERVAL 7 DAY AND transaction_type = 'acc_payment_create' AND value_int > 0 GROUP BY from_addr_id ORDER BY spread DESC LIMIT 10) SELECT address , spread as new_accounts FROM whiteStars JOIN `algorand_mainnet_daily.accounts` acc USING (addr_id) ORDER BY new_accounts DESC
-- Spammers (dusting existing accounts)-- ~2GBWITH spammers AS ( SELECT from_addr_id addr_id, count(distinct(to_addr_id)) spread FROM `algorand_mainnet_daily.transactions` WHERE block_timestamp > CURRENT_TIMESTAMP() - INTERVAL 7 DAY AND transaction_type = 'acc_payment' AND value_int > 0 GROUP BY from_addr_id ORDER BY spread DESC LIMIT 10) SELECT addr_id , spread as victims FROM spammers ORDER BY victims DESC
-- Blackholes (eating from most distinct account )-- ~2GBWITH bhole AS ( SELECT to_addr_id addr_id, count(distinct(from_addr_id)) spread FROM `algorand_mainnet_daily.transactions` WHERE block_timestamp > CURRENT_TIMESTAMP() - INTERVAL 7 DAY AND transaction_type = 'acc_payment' AND value_int > 0 AND NOT is_inner GROUP BY addr_id ORDER BY spread DESC LIMIT 10) SELECT addr_id , spread as victims FROM bhole ORDER BY victims DESC
Token value
-- Circulating (non clawback, non reserve, not burned) tokens value in USDDECLARE algousdc FLOAT64 DEFAULT 0;
SET (algousdc) = ( SELECT AS STRUCT algo_value FROM `algorand_mainnet_daily.token_prices` WHERE token_id = 31566704 /* USDC */);
SELECT sum(th.balance_float * algo_value) / algousdc MC_USDFROM `algorand_mainnet_daily.token_holdings` th JOIN `algorand_mainnet_daily.token_prices` tp using (token_id)WHERE is_circulating and th.addr_id not in (2853884730,1970085357,2451993965,1970086565,2451993800,2451993961,3579003880) /* skip known reserve */
-- TOP 25 token holders (except Algo) by USD valueDECLARE algousdc FLOAT64 DEFAULT 0;
SET (algousdc) = ( SELECT AS STRUCT algo_value FROM `algorand_mainnet_daily.token_prices` WHERE token_id = 31566704 /* USDC */);
WITH tthaid AS (SELECT th.addr_id, sum(th.balance_float * algo_value) / algousdc hold_usd_valFROM `algorand_mainnet_daily.token_holdings` th JOIN `algorand_mainnet_daily.token_prices` tp using (token_id)WHERE is_circulating and th.addr_id not in (2853884730,1970085357,2451993965,1970086565,2451993800,2451993961,3579003880) /* skip known reserve */GROUP BY th.addr_idORDER BY hold_usd_val DESCLIMIT 25) SELECT hold_usd_val, address FROM tthaid JOIN `algorand_mainnet_daily.accounts` using (addr_id)
Demo
SELECT TIMESTAMP_TRUNC(block_timestamp, MONTH) yearMonth , count(*) newContractDeploymentsFROM nodely-data-pub.algorand_mainnet_daily.contractsWHERE block_timestamp < TIMESTAMP_TRUNC(current_timestamp(), MONTH)GROUP BY yearMonth;
with dd as (SELECT monthYear , sum(cast(date(TIMESTAMP_TRUNC(block_timestamp,MONTH)) = monthYear as int64)) deployed , sum(cast(date(TIMESTAMP_TRUNC(closed_at_ts,MONTH)) = monthYear as int64)) destroyedFROM UNNEST(GENERATE_DATE_ARRAY('2020-12-01', '2024-06-01', INTERVAL 1 MONTH)) monthYear, nodely-data-pub.algorand_mainnet_daily.contractsgroup by monthYearorder by monthYear) select monthYear ,deployed newDeployments ,deployed - destroyed as deploymentDelta ,SUM(deployed - destroyed) OVER(ORDER BY monthYear ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) activeDeployments ,(select count(distinct(code_hash_sha256)) from `nodely-data-pub.algorand_mainnet_daily`.contracts c where DATE(c.block_timestamp) <= monthYear and (DATE(c.closed_at_ts) is NULL or DATE(c.closed_at_ts) > monthYear )) uniqueSmartContracts from dd order by monthYear
with whiteHoles as (select from_addr_id addr_id ,count(*) cnt ,row_number() over(order by count(*) desc) rnfrom `nodely-data-pub.algorand_mainnet_daily`.transactionswhere transaction_type = 'acc_payment_create' -- this way first payment to this address and value_int > 0 -- only interested in non-zero payments (that result in fully funded address) and TIMESTAMP_TRUNC(block_timestamp, MONTH) = '2024-05-01'group by from_addr_idorder by cnt desc), top10 as (select case when rn < 10 then addr_id else NULL end addr_id , sum(cnt) cnt from whiteHoles group by 1 order by 2 desc) select COALESCE (`nodely-data-pub.algorand_mainnet_daily`.utilShortAddr(a.address), 'other') creatorAddress , cnt fundedAccounts from top10 LEFT JOIN `nodely-data-pub.algorand_mainnet_daily`.accounts a on top10.addr_id = a.addr_id order by cnt desc
Video tutorials
Upcoming
- Base tables
- contracts_accountstate
- Aux tables
- Account labels
- NFD labels
- Virtual transaction tables
- Genesis
- Legacy rewards
- 2024+ block rewards