This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// Advanced relational diagram for bigquery-public-data:crypto_bitcoin | |
//// Update on 2021-02-12 | |
//// diagram by @rifkiamil | |
//// For the https://github.com/blockchain-etl/bitcoin-etl project | |
Project "bigquery-public-data:Crypto_Bitcoin" { | |
database_type: 'BigQuery' | |
Note: 'Advanced Bitcoin diagram layout (not using RECORD field type)' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT block_timestamp, | |
block_timestamp_month, | |
output_value | |
FROM `bigquery-public-data.crypto_bitcoin.transactions` | |
WHERE block_timestamp_month = '2013-12-01' | |
and output_value > 10000000 | |
and `hash` = 'e7f8fe18fdc039535fef6d3e82fc086cca2e50d2e1f7f68ab1e97ee8dcafdfd7' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT block_timestamp, block_timestamp_month, output_value | |
FROM `bigquery-public-data.crypto_bitcoin.transactions` | |
WHERE block_timestamp_month = '2013-12-01' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT block_timestamp, block_timestamp_month, output_value | |
FROM `bigquery-public-data.crypto_bitcoin.transactions` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
transactions.hash as transaction_hash, | |
transactions.block_hash, | |
transactions.block_number, | |
transactions.block_timestamp, | |
outputs.index, | |
outputs.script_asm, | |
outputs.script_hex, | |
outputs.required_signatures, | |
outputs.type, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
transactions.hash as transaction_hash, | |
transactions.block_hash, | |
transactions.block_number, | |
transactions.block_timestamp, | |
outputs.index, | |
outputs.script_asm, | |
outputs.script_hex, | |
outputs.required_signatures, | |
outputs.type, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
transactions.hash as transaction_hash, | |
transactions.block_hash, | |
transactions.block_number, | |
transactions.block_timestamp, | |
inputs.index, | |
inputs.spent_transaction_hash, | |
inputs.spent_output_index, | |
inputs.script_asm, | |
inputs.script_hex, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CURRENT_DATETIME() as now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find Bitcoin transaction | |
SELECT | |
bt.hash, | |
bt.block_timestamp, | |
CAST(bi.value AS NUMERIC)/100000000 as InputValueBTC, | |
CAST(bo.value AS NUMERIC)/100000000 as OutputValueBTC | |
FROM | |
`bigquery-public-data.crypto_bitcoin.transactions` AS bt | |
left outer join (Select transaction_hash, Sum(value) as value From `bigquery-public-data.crypto_bitcoin.inputs` GROUP BY transaction_hash) AS bi ON bt.HASH = bi.transaction_hash | |
left outer join (Select transaction_hash, Sum(value) as value From `bigquery-public-data.crypto_bitcoin.outputs` GROUP BY transaction_hash) AS bo ON bt.HASH = bo.transaction_hash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT di.transaction_hash, | |
di.block_number, | |
di.block_timestamp, | |
di.addresses, | |
di.value | |
FROM `bigquery-public-data.crypto_dogecoin.inputs` as di | |
WHERE di.transaction_hash = 'c2941b764e5436aa4bb39eaa1360cf7156f80d831141c0d352e950d7f2427325' | |
LIMIT 1000 |