SELECT encode(t.txid,'escape') tid -- no idea why textual TXID is saved in a bytea field ,t.*FROM txn_participation tp JOIN txn t using(round,intra)WHERE tp.addr = AddressTxt2Bin('ALGONODEIBJTET5OSEAXIHDSIEG7C2DOFB2WDYLRZTXN3NXVJ3NJD26L4E');ORDER BY round desc, intra descLIMIT 1000
SELECT * FROM txn WHERE txid = 'PHFCDXJOLNQX47Q3YFS6LBYMUMB2TG3QNHKFO3QXKG3P3BGE5U6Q'
SELECT AddressBin2Txt(addr) address, * FROM accountWHERE addr = AddressTxt2Bin('ALGONODEIBJTET5OSEAXIHDSIEG7C2DOFB2WDYLRZTXN3NXVJ3NJD26L4E');
SELECT topn(topn_add_agg(asset::text),10)FROM txnWHERE round > 18000000 and typeenum =6
SELECT COUNT(DISTINCT(txn -> 'txn' ->> 'snd')) senders ,COUNT(DISTINCT(txn -> 'txn' ->> 'arcv' )) receivers ,COUNT(*) txcntFROM txnWHERE txn.asset = 312769 and typeenum in (3,4,5) AND txn.round BETWEEN 18000000 and 18100000
SELECT hll_cardinality(hll_add_agg(hll_hash_text(txn -> 'txn' ->> 'snd'),12)) senders ,hll_cardinality(hll_add_agg(hll_hash_text(txn -> 'txn' ->> 'arcv'),12)) receivers ,COUNT(*) txcntFROM txnWHERE txn.asset = 312769 and typeenum in (3,4,5) AND txn.round BETWEEN 18000000 and 18100000
with tr as ( select min(realtime) rt0, max(realtime) rt1 from block_header bh where realtime between '2024-02-01' and '2024-03-01'), b0 as (select round r0, (header#>>'{ts}')::int4 t0 from block_header bh,tr where realtime = tr.rt0), b1 as (select round r1, (header#>>'{ts}')::int4 t1 from block_header bh,tr where realtime = tr.rt1)select 1.0 * (b1.t1-b0.t0) / (b1.r1-b0.r0) abt from b0,b1
with rt as ( select realtime, round from block_header bh order by round desc limit 100), btime as (select EXTRACT(EPOCH FROM ((max(realtime) - min(realtime))/100)) as btime, max(round) lr from rt), stake as (select sum(microalgos)/pow(10,6) as stake from account cross join btime where account_data->>'onl' = '1' and (account_data->>'voteLst')::bigint > btime.lr)select '1 hr' frequency, round(stake.stake/ (1*3600/btime.btime)) algo, round(10*(ln(1-1/(3600/btime.btime))/-2990)*stake.stake)/10 svalgo from btime cross join stakeunion allselect '1 day' frequency, round(stake.stake/ (24*3600/btime.btime)) algo, round(10*(ln(1-1/(24*3600/btime.btime))/-2990)*stake.stake)/10 svalgo from btime cross join stakeunion allselect '1 week' frequency, round(stake.stake/ (168*3600/btime.btime)) algo, round(10*(ln(1-1/(168*3600/btime.btime))/-2990)*stake.stake)/10 svalgo from btime cross join stakeunion allselect '30 days' frequency, round(stake.stake/ (30*24*3600/btime.btime)) algo, round(10*(ln(1-1/(30*24*3600/btime.btime))/-2990)*stake.stake)/10 svalgo from btime cross join stake
select addressbin2txt(addr) as haddr ,*from accountwhere account_data->>'onl' = '1' and (account_data->>'voteLst')::bigint > (select max(round) from block_header)order by microalgos desc