问题
I'm trying to do some analysis on the richest Bitcoin wallets, and discovered that the BigQuery dataset is missing a ton of data.
For example, take a look at the #1 richest account currently.
The wallet address is: "3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r"
If I look this wallet up in blockexplorer, or any online blockchain data source, I see that the wallet has received ~3.29 million and sent ~3.16 million for a net balance of 138,660 BTC.
Yet when I look any transcations where
inputpubkeybase58 == '3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r'
, I get zero results back.
Here is the query I wrote as a test.
SELECT i.input_pubkey_base58
from `bigquery-public-data.bitcoin_blockchain.transactions`
JOIN UNNEST(inputs) as i
where i.input_pubkey_base58 = '3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r'
LIMIT 100
Why are none of the 3.16 million BTC sent being referenced in the above query?
Please correct me if I'm saying or doing something stupid. Thanks!
Edit: I can find the transactions where o.output_pubkey_base58 == '3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r'
no problem. But I am not looking for the total BTC received, I am looking for the transactions where BTC was sent from the wallet, as per the above query.
Update: To shed more light on this discrepancy, I tried to examine transactions where BTC was sent from the aforementioned address on blockchain.com. Most of the recent transactions where BTC was sent from the wallet could not be found in BigQuery. For example, I couldn't find an Oct. 22, 2018 transaction where 2,000 BTC was sent to 1Kr6QSydW9bFQG1mXiPNNu6WpJGmUa9i1g.
SELECT o.output_pubkey_base58, i.input_pubkey_base58, o.output_satoshis
FROM `bigquery-public-data.bitcoin_blockchain.transactions`
JOIN UNNEST(inputs) as i
JOIN UNNEST(outputs) as o
WHERE
transaction_id ='6d0da34d69693ae81169a0cc3cd65847929939617d3a8cf41ef3d02971857a3e'
I was able to find some of the older transactions dated in 2017 like
SELECT o.output_pubkey_base58, i.input_pubkey_base58, o.output_satoshis
FROM `bigquery-public-data.bitcoin_blockchain.transactions`
JOIN UNNEST(inputs) as i
JOIN UNNEST(outputs) as o
WHERE
transaction_id ='29dd29b8d1647c766f3fad233fe7a0c026fbb9f42544d96c917f6b028667907a'
But the results show null for i.input_pubkey_base58
回答1:
Try below
SELECT COUNT(1)
FROM `bigquery-public-data.bitcoin_blockchain.transactions`,
UNNEST(outputs) AS o
WHERE o.output_pubkey_base58 = '3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r'
this will give you 5417 transactions
来源:https://stackoverflow.com/questions/53293896/bigquery-blockchain-dataset-is-missing-data