bq_commands.sh 1.1 KB

12345678910111213
  1. #!/bin/bash
  2. # load contract table into bigquery (to be run once)
  3. bq load lexical-theory-329617:tornado_transactions.tornadocontracts ./data/static/tcash/tornadocontracts.csv ./data/static/tcash/tornadocontracts_schema.json
  4. # make (empty) traces and transactions table
  5. bq mk --schema ./data/static/tcash/traces_schema.json lexical-theory-329617:tornado_transactions.traces
  6. bq mk --schema ./data/static/tcash/transactions_schema.json lexical-theory-329617:tornado_transactions.transactions
  7. # make tornado traces table
  8. bq query --destination_table lexical-theory-329617:tornado_transactions.traces --use_legacy_sql=false 'select * from bigquery-public-data.crypto_ethereum.traces where (to_address in (select address from lexical-theory-329617.tornado_transactions.tornadocontracts)) and substr(input, 1, 10) in ("0xb214faa5", "0x21a0adb6")'
  9. # make tornado transactions table
  10. bq query --destination_table lexical-theory-329617:tornado_transactions.transactions --use_legacy_sql=false 'select * from bigquery-public-data.crypto_ethereum.transactions as b where b.hash in (select transaction_hash from lexical-theory-329617.tornado_transactions.traces)'