Skip to content

Instantly share code, notes, and snippets.

View medvedev1088's full-sized avatar

Evgeny Medvedev medvedev1088

View GitHub Profile
from_address to_address trace_address error status
0xc5b373618d4d01a38f822f56ca6d2ff5080cc4f2 0xc5f60fa4613493931b605b6da1e9febbdeb61e16 1
0xc5f60fa4613493931b605b6da1e9febbdeb61e16 0x06012c8cf97bead5deae237070f9587f8e7a266d 0 Reverted 0
from_address to_address value trace_address error status
0xf1bc217a1e50a697d37caf568d5260033d53e1e9 0x18a672e11d637fffadccc99b152f4895da069601 1 12 Bad jump destination 0
0x0e95adb39a2dfe1c8f3969de4480a5d3ddfadebd 0xf1bc217a1e50a697d37caf568d5260033d53e1e9 5 Out of gas 0
0xf1bc217a1e50a697d37caf568d5260033d53e1e9 0x05f65ab88dc474a83a98994291c7a0abd13c9ae1 1 4 0
0xf1bc217a1e50a697d37caf568d5260033d53e1e9 0x4a574510c7014e4ae985403536074abe582adfc8 1 3 0
0xf1bc217a1e50a697d37caf568d5260033d53e1e9 0xa2d4035389aae620e36bd828144b2015564c2702 1 10 0
0xf1bc217a1e50a697d37caf568d5260033d53e1e9 0xcab97565438f594964c95eb0a1c6c4c7a3ca989c 1 11 0
0xf1bc217a1e50a697d37caf568d5260033d53e1e9 0xf8f31fc73f2a16002cc9c96af465e50efd74469e 1 5 0
0xf1bc217a1e50a697d37caf568d5260033d53e1e9 0x7803a643be2f08f7b4843fa241de822e239d3511 1 7 0
0xf1bc217a1e50a697d37caf568d5260033d53e1e9 0xbb9bc244d798123fde783fcc1c72d3bb8c189413 1 0 0
with ether_emitted_by_date as (
select date(block_timestamp) as date, sum(value) as value
from `bigquery-public-data.crypto_ethereum.traces`
where trace_type in ('genesis', 'reward')
group by date(block_timestamp)
)
select date, sum(value) OVER (ORDER BY date) / power(10, 18) AS supply
from ether_emitted_by_date
#standardSQL
-- MIT License
-- Copyright (c) 2018 Evgeny Medvedev, [email protected]
with double_entry_book as (
-- debits
select to_address as address, value as value, block_timestamp
from `bigquery-public-data.crypto_ethereum.traces`
where to_address is not null
and status = 1
and (call_type not in ('delegatecall', 'callcode', 'staticcall') or call_type is null)
#standardSQL
-- MIT License
-- Copyright (c) 2018 Evgeny Medvedev, [email protected]
with double_entry_book as (
-- debits
select to_address as address, value as value, block_timestamp, block_number
from `bigquery-public-data.ethereum_blockchain.traces`
where to_address is not null
and status = 1
and (call_type not in ('delegatecall', 'callcode', 'staticcall') or call_type is null)
#standardSQL
-- MIT License
-- Copyright (c) 2018 Evgeny Medvedev, [email protected]
with double_entry_book as (
-- debits
select array_to_string(array(select * from unnest(outputs.addresses) order by 1), ',') as address,
outputs.value as value
from bitcoin_blockchain.transactions as transactions,
unnest(transactions.outputs) as outputs
union all
with balances as (
select '2018-01-01' as date, balance
from unnest([1,2,3,4,5]) as balance -- Gini coef: 0.2666666666666667
union all
select '2018-01-02' as date, balance
from unnest([3,3,3,3]) as balance -- Gini coef: 0.0
union all
select '2018-01-03' as date, balance
from unnest([4,5,1,8,6,45,67,1,4,11]) as balance -- Gini coef: 0.625
),
with
double_entry_book as (
select
array_to_string(outputs.addresses,',') as address,
value, block_timestamp
from `crypto-etl-bitcoin-prod.bitcoin_blockchain.transactions` join unnest(outputs) as outputs
union all
select
array_to_string(inputs.addresses,',') as address,
-value as value, block_timestamp
with
double_entry_book as (
select
array_to_string(outputs.addresses,',') as address,
value, block_timestamp
from `crypto-etl-bitcoin-prod.bitcoin_blockchain.transactions` join unnest(outputs) as outputs
union all
select
array_to_string(inputs.addresses,',') as address,
-value as value, block_timestamp
with
d0 as (
select
array_to_string(x.addresses,',') as address,
date(block_timestamp) as date,
value
from `bigquery-public-data.crypto_dogecoin.transactions` join unnest(outputs) as x
)
,daily_incomes as (
select