diff --git a/notebooks/adhoc/refined_traces_models_dev.ipynb b/notebooks/adhoc/refined_traces_models_dev.ipynb new file mode 100644 index 00000000000..5571e2c63c8 --- /dev/null +++ b/notebooks/adhoc/refined_traces_models_dev.ipynb @@ -0,0 +1,1187 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Prepare data reader and model execution context" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-28 11:49:19\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:19\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 18 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:20\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:20\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 22 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbyblock.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m85\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:20\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1minitialized duckdb at /var/folders/tz/g2vwn0qx5ll32j7jfsshhps40000gn/T/t8aylo_p/op-analytics.duck.db\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m61\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:20\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mreading dataset='ingestion/blocks_v1' using 1/1 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:20\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mreading dataset='ingestion/traces_v1' using 1/1 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:20\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mreading dataset='ingestion/transactions_v1' using 1/1 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\n", + "INPUT: ingestion/blocks_v1\n", + "INPUT: ingestion/traces_v1\n", + "INPUT: ingestion/transactions_v1\n", + "\n", + "AUX VIEW: refined_transactions_fees\n", + "AUX VIEW: refined_traces/txs_projection\n", + "AUX VIEW: refined_traces/traces_projection\n", + "AUX VIEW: refined_traces/traces_amortized\n", + "AUX VIEW: refined_traces/traces_amortized_2\n", + "AUX VIEW: refined_traces/traces_amortized_3\n", + "AUX VIEW: refined_traces/traces_txs_join\n" + ] + } + ], + "source": [ + "\n", + "from op_analytics.coreutils.partitioned.location import DataLocation\n", + "from op_analytics.coreutils.partitioned.reader import DataReader\n", + "from op_analytics.datapipeline.etl.blockbatch.construct import construct_data_readers\n", + "from op_analytics.datapipeline.models.compute.testutils import setup_execution_context\n", + "\n", + "model_name = \"refined_traces\"\n", + "\n", + "# Define the input data range.\n", + "readers: list[DataReader] = construct_data_readers(\n", + " chains=[\"op\"],\n", + " models=[model_name],\n", + " range_spec=\"@20241118:+1\",\n", + " read_from=DataLocation.GCS,\n", + ")\n", + "\n", + "\n", + "# Set up execution context and get handles to model input args.\n", + "# In subsequent cells you can use the model input args however you want.\n", + "ctx, input_datasets, aux_views = setup_execution_context(\n", + " model_name=model_name,\n", + " data_reader=readers[0] # use the first reader\n", + ")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Execute the model\n", + "\n", + "It's up to you how the model manipulates the data. \n", + "\n", + "Develop the various steps in notebook cells and then copy the final code over to the model function." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-28 11:49:23\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:31\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 8.4MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:31\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_traces/traces_projection\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 59.0MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_traces/traces_amortized\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 97.5MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_traces/traces_txs_join\u001b[0m\n", + "\u001b[2m2024-12-28 11:49:41\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 175.1MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m83116\u001b[0m\n" + ] + } + ], + "source": [ + "refined_txs_table = aux_views[\"refined_transactions_fees\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"raw_blocks\": input_datasets[\"ingestion/blocks_v1\"].as_subquery(),\n", + " \"raw_transactions\": input_datasets[\"ingestion/transactions_v1\"].as_subquery(),\n", + " }\n", + ")\n", + "\n", + "refined_traces_projection = aux_views[\"refined_traces/traces_projection\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"raw_traces\": input_datasets[\"ingestion/traces_v1\"].as_subquery(),\n", + " },\n", + ")\n", + "\n", + "traces_amortized = aux_views[\"refined_traces/traces_amortized\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"refined_traces_projection\": refined_traces_projection,\n", + " },\n", + ")\n", + "\n", + "traces_txs_join = aux_views[\"refined_traces/traces_txs_join\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"traces_amortized\": traces_amortized,\n", + " \"refined_transactions_fees\": refined_txs_table,\n", + " },\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────┬────────────────┬───────────────┬────────────┬──────────────┬─────────┬─────────────────┬───────────────┬─────────────┬──────────────────────┬───────────────────┬────────────────────────┬──────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────┐\n", + "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ trace_from_address │ trace_to_address │ trace_gas_limit │ trace_gas_used │ trace_address │ trace_type │ call_type │ error │ trace_method_id │ trace_success │ trace_depth │ parent_trace_address │ num_traces_in_txn │ sum_subtraces_gas_used │ gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_l2_gas_used_amortized_by_call │ tx_l1_gas_used_unified_amortized_by_call │ tx_l1_base_scaled_size_amortized_by_call │ tx_l1_blob_scaled_size_amortized_by_call │ tx_estimated_size_amortized_by_call │ tx_fee_native_amortized_by_call │ tx_l2_fee_native_amortized_by_call │ tx_l1_fee_native_amortized_by_call │ tx_l2_base_fee_native_amortized_by_call │ tx_l2_priority_fee_native_amortized_by_call │\n", + "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ varchar │ varchar │ varchar │ boolean │ int64 │ varchar │ int64 │ int128 │ int128 │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n", + "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────┼────────────────┼───────────────┼────────────┼──────────────┼─────────┼─────────────────┼───────────────┼─────────────┼──────────────────────┼───────────────────┼────────────────────────┼──────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────────┤\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x74e27bd4fdb82f36d843d049dee5fd2d5f03335f │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 15000000 │ 515374 │ │ call │ call │ │ 0x24f88863 │ true │ 0 │ none │ 44 │ 30205 │ 485169 │ 0.00000066170259234000 │ 0.00000000033234076500 │ 0.00000066137025157500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 14664287 │ 2696 │ 0 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 14652124 │ 5345 │ 1 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14420596 │ 2649 │ 1,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 1 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x85149247691df622eaf1a8bd0cafd40bc45154a9 │ 14551651 │ 2696 │ 10 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 10 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xb533c12fb4e7b53b5524eab9b47d93ff6c7a456f │ 14539554 │ 2696 │ 11 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 11 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x2ab22ac86b25bd448a4d9dc041bd2384655299c4 │ 14528633 │ 2696 │ 12 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 12 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xadab76dd2dca7ae080a796f0ce86170e482afb4a │ 14519558 │ 2696 │ 13 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 13 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xa0a215de234276cac1b844fd58901351a50fec8a │ 14509169 │ 5029 │ 14 │ call │ staticcall │ │ 0x443cb4bc │ true │ 1 │ 14 │ 44 │ 2363 │ 2666 │ 0.00000000363605076000 │ 0.00000000000182621000 │ 0.00000000363422455000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xa0a215de234276cac1b844fd58901351a50fec8a │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14279875 │ 2363 │ 14,0 │ call │ delegatecall │ │ 0x443cb4bc │ true │ 2 │ 14 │ 44 │ 0 │ 2363 │ 0.00000000322280118000 │ 0.00000000000161865500 │ 0.00000000322118252500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xa0a215de234276cac1b844fd58901351a50fec8a │ 14503695 │ 2528 │ 15 │ call │ staticcall │ │ 0x5a76f25e │ true │ 1 │ 15 │ 44 │ 2362 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xa0a215de234276cac1b844fd58901351a50fec8a │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14276947 │ 2362 │ 15,0 │ call │ delegatecall │ │ 0x5a76f25e │ true │ 2 │ 15 │ 44 │ 0 │ 2362 │ 0.00000000322143732000 │ 0.00000000000161797000 │ 0.00000000321981935000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xe9581d0f1a628b038fc8b2a7f5a7d904f0e2f937 │ 14497231 │ 2529 │ 16 │ call │ staticcall │ │ 0x443cb4bc │ true │ 1 │ 16 │ 44 │ 2363 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xe9581d0f1a628b038fc8b2a7f5a7d904f0e2f937 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14270584 │ 2363 │ 16,0 │ call │ delegatecall │ │ 0x443cb4bc │ true │ 2 │ 16 │ 44 │ 0 │ 2363 │ 0.00000000322280118000 │ 0.00000000000161865500 │ 0.00000000322118252500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xe9581d0f1a628b038fc8b2a7f5a7d904f0e2f937 │ 14494218 │ 2528 │ 17 │ call │ staticcall │ │ 0x5a76f25e │ true │ 1 │ 17 │ 44 │ 2362 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xe9581d0f1a628b038fc8b2a7f5a7d904f0e2f937 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14267618 │ 2362 │ 17,0 │ call │ delegatecall │ │ 0x5a76f25e │ true │ 2 │ 17 │ 44 │ 0 │ 2362 │ 0.00000000322143732000 │ 0.00000000000161797000 │ 0.00000000321981935000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x8134a2fdc127549480865fb8e5a9e8a8a95a54c5 │ 14487731 │ 2529 │ 18 │ call │ staticcall │ │ 0x443cb4bc │ true │ 1 │ 18 │ 44 │ 2363 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x8134a2fdc127549480865fb8e5a9e8a8a95a54c5 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14261233 │ 2363 │ 18,0 │ call │ delegatecall │ │ 0x443cb4bc │ true │ 2 │ 18 │ 44 │ 0 │ 2363 │ 0.00000000322280118000 │ 0.00000000000161865500 │ 0.00000000322118252500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x8134a2fdc127549480865fb8e5a9e8a8a95a54c5 │ 14484717 │ 2528 │ 19 │ call │ staticcall │ │ 0x5a76f25e │ true │ 1 │ 19 │ 44 │ 2362 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x8134a2fdc127549480865fb8e5a9e8a8a95a54c5 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14258266 │ 2362 │ 19,0 │ call │ delegatecall │ │ 0x5a76f25e │ true │ 2 │ 19 │ 44 │ 0 │ 2362 │ 0.00000000322143732000 │ 0.00000000000161797000 │ 0.00000000321981935000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 14637426 │ 2696 │ 2 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x84ce89b4f6f67e523a81a82f9f2f14d84b726f6b │ 14478206 │ 2845 │ 20 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 20 │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x84ce89b4f6f67e523a81a82f9f2f14d84b726f6b │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14251857 │ 2649 │ 20,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 20 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xa73c628eaf6e283e26a7b1f8001cf186aa4c0e8e │ 14468961 │ 2696 │ 21 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 21 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xc858a329bf053be78d6239c4a4343b8fbd21472b │ 14459852 │ 2696 │ 22 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 22 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xe9e3893921de87b1194a8108f9d70c24bde71c27 │ 14448023 │ 2696 │ 23 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 23 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x8f47041adbef5bf321c9f63a0660326614ab6b60 │ 14435609 │ 2529 │ 24 │ call │ staticcall │ │ 0x443cb4bc │ true │ 1 │ 24 │ 44 │ 2363 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x8f47041adbef5bf321c9f63a0660326614ab6b60 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14209925 │ 2363 │ 24,0 │ call │ delegatecall │ │ 0x443cb4bc │ true │ 2 │ 24 │ 44 │ 0 │ 2363 │ 0.00000000322280118000 │ 0.00000000000161865500 │ 0.00000000322118252500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x8f47041adbef5bf321c9f63a0660326614ab6b60 │ 14432596 │ 2528 │ 25 │ call │ staticcall │ │ 0x5a76f25e │ true │ 1 │ 25 │ 44 │ 2362 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x8f47041adbef5bf321c9f63a0660326614ab6b60 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14206959 │ 2362 │ 25,0 │ call │ delegatecall │ │ 0x5a76f25e │ true │ 2 │ 25 │ 44 │ 0 │ 2362 │ 0.00000000322143732000 │ 0.00000000000161797000 │ 0.00000000321981935000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x522dc96e6fd6f78a4e7433d0ee05b7087e515236 │ 14426129 │ 2845 │ 26 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 26 │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x522dc96e6fd6f78a4e7433d0ee05b7087e515236 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14200593 │ 2649 │ 26,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 26 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x36e42931a765022790b797963e42c5522d6b585a │ 14416041 │ 2696 │ 27 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 27 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 14626736 │ 2845 │ 3 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14398066 │ 2649 │ 3,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 3 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x85c31ffa3706d1cce9d525a00f1c7d4a2911754c │ 14615868 │ 2696 │ 4 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 14605439 │ 2845 │ 5 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14377102 │ 2649 │ 5,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 5 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x2fa71491f8070fa644d97b4782db5734854c0f6f │ 14594652 │ 2845 │ 6 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x2fa71491f8070fa644d97b4782db5734854c0f6f │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14366483 │ 2649 │ 6,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 6 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x39ed27d101aa4b7ce1cb4293b877954b8b5e14e5 │ 14585517 │ 2845 │ 7 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x39ed27d101aa4b7ce1cb4293b877954b8b5e14e5 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14357491 │ 2649 │ 7,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 7 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x68f5c0a2de713a54991e01858fd27a3832401849 │ 14573710 │ 2696 │ 8 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x73b14a78a0d396c521f954532d43fd5ffe385216 │ 14562497 │ 2696 │ 9 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────┴────────────────┴───────────────┴────────────┴──────────────┴─────────┴─────────────────┴───────────────┴─────────────┴──────────────────────┴───────────────────┴────────────────────────┴──────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────┤\n", + "│ 44 rows 37 columns │\n", + "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n", + "\n" + ] + } + ], + "source": [ + "ctx.client.sql(\"\"\"\n", + "SELECT * FROM refined_traces__traces_txs_join\n", + "WHERE transaction_hash = '0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b'\n", + "ORDER BY trace_address\n", + "\"\"\").show(max_rows=100)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-28 06:31:20\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n", + "\u001b[2m2024-12-28 06:31:20\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n", + "\u001b[2m2024-12-28 06:31:27\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 8.4MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m\n", + "\u001b[2m2024-12-28 06:31:27\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_traces/txs_projection\u001b[0m\n", + "\u001b[2m2024-12-28 06:31:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 8.4MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m\n", + "\u001b[2m2024-12-28 06:31:33\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_traces/traces_projection\u001b[0m\n", + "\u001b[2m2024-12-28 06:31:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 63.2MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m\n", + "\u001b[2m2024-12-28 06:31:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_traces/traces_amortized\u001b[0m\n", + "\u001b[2m2024-12-28 06:31:42\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 101.5MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m\n" + ] + } + ], + "source": [ + "refined_txs = aux_views[\"refined_transactions_fees\"].render(\n", + " context={\n", + " \"raw_blocks\": input_datasets[\"ingestion/blocks_v1\"].as_subquery(),\n", + " \"raw_transactions\": input_datasets[\"ingestion/transactions_v1\"].as_subquery(),\n", + " }\n", + ")\n", + "\n", + "refined_txs_table = aux_views[\"refined_transactions_fees\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"raw_blocks\": input_datasets[\"ingestion/blocks_v1\"].as_subquery(),\n", + " \"raw_transactions\": input_datasets[\"ingestion/transactions_v1\"].as_subquery(),\n", + " }\n", + ")\n", + "\n", + "refined_txs_projection = aux_views[\"refined_traces/txs_projection\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"refined_transactions_fees\": f\"({refined_txs})\",\n", + " },\n", + ")\n", + "\n", + "\n", + "refined_traces_projection = aux_views[\"refined_traces/traces_projection\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"raw_traces\": input_datasets[\"ingestion/traces_v1\"].as_subquery(),\n", + " },\n", + ")\n", + "\n", + "traces_amortized = aux_views[\"refined_traces/traces_amortized\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"refined_traces_projection\": refined_traces_projection,\n", + " },\n", + ")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-28 06:35:17\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_traces/traces_txs_join\u001b[0m\n", + "\u001b[2m2024-12-28 06:35:17\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 178.5MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m50338\u001b[0m\n" + ] + }, + { + "data": { + "text/plain": [ + "'refined_traces__traces_txs_join'" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "aux_views[\"refined_traces/traces_txs_join\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"traces_amortized\": traces_amortized,\n", + " \"refined_transactions_fees\": refined_txs_table,\n", + " },\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "┌────────────┬─────────┬──────────┬─────────┬──────────────┬─────────────────┬────────────────────────────────────────────────────────────────────┬───────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬─────────────────┬────────────────┬───────────────┬────────────┬──────────────┬─────────┬─────────────────┬───────────────┬─────────────┬──────────────────────┬───────────────────┬────────────────────────┬──────────────────────────┬──────────────────────────────────┬───────────────────────────────────────┬───────────────────────────────────────────┬──────────────────────────────────────────────┬──────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────┬────────────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────┐\n", + "│ dt │ chain │ chain_id │ network │ block_number │ block_timestamp │ transaction_hash │ transaction_index │ trace_from_address │ trace_to_address │ trace_gas_limit │ trace_gas_used │ trace_address │ trace_type │ call_type │ error │ trace_method_id │ trace_success │ trace_depth │ parent_trace_address │ num_traces_in_txn │ sum_subtraces_gas_used │ gas_used_minus_subtraces │ tx_l2_fee_native_minus_subtraces │ tx_l2_base_fee_native_minus_subtraces │ tx_l2_priority_fee_native_minus_subtraces │ tx_l2_legacy_base_fee_native_minus_subtraces │ tx_l2_gas_used_amortized_by_call │ tx_l1_gas_used_unified_amortized_by_call │ tx_l1_base_scaled_size_amortized_by_call │ tx_l1_blob_scaled_size_amortized_by_call │ tx_estimated_size_amortized_by_call │ tx_fee_native_amortized_by_call │ tx_l2_fee_native_amortized_by_call │ tx_l1_fee_native_amortized_by_call │ tx_l2_base_fee_native_amortized_by_call │ tx_l2_priority_fee_native_amortized_by_call │\n", + "│ date │ varchar │ int32 │ varchar │ int64 │ uint32 │ varchar │ int64 │ varchar │ varchar │ int64 │ int64 │ varchar │ varchar │ varchar │ varchar │ varchar │ boolean │ int64 │ varchar │ int64 │ int128 │ int128 │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ decimal(38,20) │ double │ double │ double │ double │ double │ double │ double │ double │ double │ double │\n", + "├────────────┼─────────┼──────────┼─────────┼──────────────┼─────────────────┼────────────────────────────────────────────────────────────────────┼───────────────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼─────────────────┼────────────────┼───────────────┼────────────┼──────────────┼─────────┼─────────────────┼───────────────┼─────────────┼──────────────────────┼───────────────────┼────────────────────────┼──────────────────────────┼──────────────────────────────────┼───────────────────────────────────────┼───────────────────────────────────────────┼──────────────────────────────────────────────┼──────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼──────────────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────┼────────────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────────┤\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x74e27bd4fdb82f36d843d049dee5fd2d5f03335f │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 15000000 │ 515374 │ │ call │ call │ │ 0x24f88863 │ true │ 0 │ none │ 44 │ 30205 │ 485169 │ 0.00000066170259234000 │ 0.00000000033234076500 │ 0.00000066137025157500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x1fb3cf6e48f1e7b10213e7b6d87d4c073c7fdb7b │ 14664287 │ 2696 │ 0 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 14652124 │ 5345 │ 1 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x478946bcd4a5a22b316470f5486fafb928c0ba25 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14420596 │ 2649 │ 1,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 1 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x85149247691df622eaf1a8bd0cafd40bc45154a9 │ 14551651 │ 2696 │ 10 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 10 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xb533c12fb4e7b53b5524eab9b47d93ff6c7a456f │ 14539554 │ 2696 │ 11 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 11 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x2ab22ac86b25bd448a4d9dc041bd2384655299c4 │ 14528633 │ 2696 │ 12 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 12 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xadab76dd2dca7ae080a796f0ce86170e482afb4a │ 14519558 │ 2696 │ 13 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 13 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xa0a215de234276cac1b844fd58901351a50fec8a │ 14509169 │ 5029 │ 14 │ call │ staticcall │ │ 0x443cb4bc │ true │ 1 │ 14 │ 44 │ 2363 │ 2666 │ 0.00000000363605076000 │ 0.00000000000182621000 │ 0.00000000363422455000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xa0a215de234276cac1b844fd58901351a50fec8a │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14279875 │ 2363 │ 14,0 │ call │ delegatecall │ │ 0x443cb4bc │ true │ 2 │ 14 │ 44 │ 0 │ 2363 │ 0.00000000322280118000 │ 0.00000000000161865500 │ 0.00000000322118252500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xa0a215de234276cac1b844fd58901351a50fec8a │ 14503695 │ 2528 │ 15 │ call │ staticcall │ │ 0x5a76f25e │ true │ 1 │ 15 │ 44 │ 2362 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xa0a215de234276cac1b844fd58901351a50fec8a │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14276947 │ 2362 │ 15,0 │ call │ delegatecall │ │ 0x5a76f25e │ true │ 2 │ 15 │ 44 │ 0 │ 2362 │ 0.00000000322143732000 │ 0.00000000000161797000 │ 0.00000000321981935000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xe9581d0f1a628b038fc8b2a7f5a7d904f0e2f937 │ 14497231 │ 2529 │ 16 │ call │ staticcall │ │ 0x443cb4bc │ true │ 1 │ 16 │ 44 │ 2363 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xe9581d0f1a628b038fc8b2a7f5a7d904f0e2f937 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14270584 │ 2363 │ 16,0 │ call │ delegatecall │ │ 0x443cb4bc │ true │ 2 │ 16 │ 44 │ 0 │ 2363 │ 0.00000000322280118000 │ 0.00000000000161865500 │ 0.00000000322118252500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xe9581d0f1a628b038fc8b2a7f5a7d904f0e2f937 │ 14494218 │ 2528 │ 17 │ call │ staticcall │ │ 0x5a76f25e │ true │ 1 │ 17 │ 44 │ 2362 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xe9581d0f1a628b038fc8b2a7f5a7d904f0e2f937 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14267618 │ 2362 │ 17,0 │ call │ delegatecall │ │ 0x5a76f25e │ true │ 2 │ 17 │ 44 │ 0 │ 2362 │ 0.00000000322143732000 │ 0.00000000000161797000 │ 0.00000000321981935000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x8134a2fdc127549480865fb8e5a9e8a8a95a54c5 │ 14487731 │ 2529 │ 18 │ call │ staticcall │ │ 0x443cb4bc │ true │ 1 │ 18 │ 44 │ 2363 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x8134a2fdc127549480865fb8e5a9e8a8a95a54c5 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14261233 │ 2363 │ 18,0 │ call │ delegatecall │ │ 0x443cb4bc │ true │ 2 │ 18 │ 44 │ 0 │ 2363 │ 0.00000000322280118000 │ 0.00000000000161865500 │ 0.00000000322118252500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x8134a2fdc127549480865fb8e5a9e8a8a95a54c5 │ 14484717 │ 2528 │ 19 │ call │ staticcall │ │ 0x5a76f25e │ true │ 1 │ 19 │ 44 │ 2362 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x8134a2fdc127549480865fb8e5a9e8a8a95a54c5 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14258266 │ 2362 │ 19,0 │ call │ delegatecall │ │ 0x5a76f25e │ true │ 2 │ 19 │ 44 │ 0 │ 2362 │ 0.00000000322143732000 │ 0.00000000000161797000 │ 0.00000000321981935000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xfc1f3296458f9b2a27a0b91dd7681c4020e09d05 │ 14637426 │ 2696 │ 2 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x84ce89b4f6f67e523a81a82f9f2f14d84b726f6b │ 14478206 │ 2845 │ 20 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 20 │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x84ce89b4f6f67e523a81a82f9f2f14d84b726f6b │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14251857 │ 2649 │ 20,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 20 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xa73c628eaf6e283e26a7b1f8001cf186aa4c0e8e │ 14468961 │ 2696 │ 21 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 21 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xc858a329bf053be78d6239c4a4343b8fbd21472b │ 14459852 │ 2696 │ 22 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 22 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0xe9e3893921de87b1194a8108f9d70c24bde71c27 │ 14448023 │ 2696 │ 23 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 23 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x8f47041adbef5bf321c9f63a0660326614ab6b60 │ 14435609 │ 2529 │ 24 │ call │ staticcall │ │ 0x443cb4bc │ true │ 1 │ 24 │ 44 │ 2363 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x8f47041adbef5bf321c9f63a0660326614ab6b60 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14209925 │ 2363 │ 24,0 │ call │ delegatecall │ │ 0x443cb4bc │ true │ 2 │ 24 │ 44 │ 0 │ 2363 │ 0.00000000322280118000 │ 0.00000000000161865500 │ 0.00000000322118252500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x8f47041adbef5bf321c9f63a0660326614ab6b60 │ 14432596 │ 2528 │ 25 │ call │ staticcall │ │ 0x5a76f25e │ true │ 1 │ 25 │ 44 │ 2362 │ 166 │ 0.00000000022640076000 │ 0.00000000000011371000 │ 0.00000000022628705000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x8f47041adbef5bf321c9f63a0660326614ab6b60 │ 0x95885af5492195f0754be71ad1545fe81364e531 │ 14206959 │ 2362 │ 25,0 │ call │ delegatecall │ │ 0x5a76f25e │ true │ 2 │ 25 │ 44 │ 0 │ 2362 │ 0.00000000322143732000 │ 0.00000000000161797000 │ 0.00000000321981935000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x522dc96e6fd6f78a4e7433d0ee05b7087e515236 │ 14426129 │ 2845 │ 26 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 26 │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x522dc96e6fd6f78a4e7433d0ee05b7087e515236 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14200593 │ 2649 │ 26,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 26 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x36e42931a765022790b797963e42c5522d6b585a │ 14416041 │ 2696 │ 27 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ 27 │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 14626736 │ 2845 │ 3 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x4dc22588ade05c40338a9d95a6da9dcee68bcd60 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14398066 │ 2649 │ 3,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 3 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x85c31ffa3706d1cce9d525a00f1c7d4a2911754c │ 14615868 │ 2696 │ 4 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 14605439 │ 2845 │ 5 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x319c0dd36284ac24a6b2bee73929f699b9f48c38 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14377102 │ 2649 │ 5,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 5 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x2fa71491f8070fa644d97b4782db5734854c0f6f │ 14594652 │ 2845 │ 6 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x2fa71491f8070fa644d97b4782db5734854c0f6f │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14366483 │ 2649 │ 6,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 6 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x39ed27d101aa4b7ce1cb4293b877954b8b5e14e5 │ 14585517 │ 2845 │ 7 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 2649 │ 196 │ 0.00000000026731656000 │ 0.00000000000013426000 │ 0.00000000026718230000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0x39ed27d101aa4b7ce1cb4293b877954b8b5e14e5 │ 0xc28ad28853a547556780bebf7847628501a3bcbb │ 14357491 │ 2649 │ 7,0 │ call │ delegatecall │ │ 0x3850c7bd │ true │ 2 │ 7 │ 44 │ 0 │ 2649 │ 0.00000000361286514000 │ 0.00000000000181456500 │ 0.00000000361105057500 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x68f5c0a2de713a54991e01858fd27a3832401849 │ 14573710 │ 2696 │ 8 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 128144612 │ 1731888001 │ 0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b │ 1 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x73b14a78a0d396c521f954532d43fd5ffe385216 │ 14562497 │ 2696 │ 9 │ call │ staticcall │ │ 0x3850c7bd │ true │ 1 │ │ 44 │ 0 │ 2696 │ 0.00000000367696656000 │ 0.00000000000184676000 │ 0.00000000367511980000 │ 0.00000000000000000000 │ 11713.045454545454 │ 36.36363636363637 │ 0.19007272727272728 │ 2.3050295454545453 │ 2.272727272727273 │ 1.8581477424386363e-08 │ 1.5974954173636362e-08 │ 2.60652325075e-09 │ 8.023436136363637e-12 │ 1.59669307375e-08 │\n", + "├────────────┴─────────┴──────────┴─────────┴──────────────┴─────────────────┴────────────────────────────────────────────────────────────────────┴───────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴─────────────────┴────────────────┴───────────────┴────────────┴──────────────┴─────────┴─────────────────┴───────────────┴─────────────┴──────────────────────┴───────────────────┴────────────────────────┴──────────────────────────┴──────────────────────────────────┴───────────────────────────────────────┴───────────────────────────────────────────┴──────────────────────────────────────────────┴──────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴──────────────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────┴────────────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────┤\n", + "│ 44 rows 37 columns │\n", + "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n", + "\n" + ] + } + ], + "source": [ + "ctx.client.sql(\"\"\"\n", + "SELECT * FROM refined_traces__traces_txs_join\n", + "WHERE transaction_hash = '0x455d3fa505b6ff90bdb6385735c258a399d21c9d46c0a457c9a10505e09e925b'\n", + "ORDER BY trace_address\n", + "\"\"\").show(max_rows=100)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "┌─────────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n", + "│ column_name │ column_type │ null │ key │ default │ extra │\n", + "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n", + "├─────────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n", + "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n", + "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n", + "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ nonce │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ transaction_index │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ from_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ block_number │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ block_timestamp │ UINTEGER │ YES │ NULL │ NULL │ NULL │\n", + "│ hash │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ transaction_type │ INTEGER │ YES │ NULL │ NULL │ NULL │\n", + "│ gas_price │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ gas_limit │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_gas_used │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ receipt_l1_gas_used │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_fee │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_gas_price │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_blob_base_fee │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ base_fee_per_gas │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ max_priority_fee_per_gas │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_fee_scalar │ DECIMAL(12,6) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_base_fee_scalar │ DECIMAL(26,7) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_blob_base_fee_scalar │ DECIMAL(26,7) │ YES │ NULL │ NULL │ NULL │\n", + "│ legacy_extra_fee_per_gas │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_fee │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_priority_fee │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_base_fee │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ method_id │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ success │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n", + "│ input_byte_length │ INTEGER │ YES │ NULL │ NULL │ NULL │\n", + "│ input_zero_bytes │ INTEGER │ YES │ NULL │ NULL │ NULL │\n", + "│ is_system_transaction │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n", + "│ is_attributes_deposited_transaction │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n", + "│ block_hour │ TIMESTAMP │ YES │ NULL │ NULL │ NULL │\n", + "│ estimated_size │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_gas_used_unified │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_fee │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_legacy_extra_fee │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_base_fee │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_base_scaled_size │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_blob_fee │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_blob_scaled_size │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_blob_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_priority_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_legacy_extra_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_priority_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ l2_legacy_extra_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ l1_blob_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "├─────────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n", + "│ 57 rows 6 columns │\n", + "└──────────────────────────────────────────────────────────────────────────────────────────────┘\n", + "\n" + ] + } + ], + "source": [ + "ctx.client.sql(f\"\"\"DESCRIBE {refined_txs_table}\"\"\").show(max_rows=100)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "┌───────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n", + "│ column_name │ column_type │ null │ key │ default │ extra │\n", + "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n", + "├───────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n", + "│ tx_l2_gas_used │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l1_gas_used_unified │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_estimated_size │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_from_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l1_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l2_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l2_priority_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l2_base_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l2_legacy_extra_fee_native │ DECIMAL(38,19) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l2_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l2_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l2_priority_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l2_legacy_extra_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l1_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l1_blob_base_gas_price_gwei │ DECIMAL(38,10) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_input_byte_length │ INTEGER │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_input_zero_bytes │ INTEGER │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l1_base_scaled_size │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_l1_blob_scaled_size │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_method_id │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ block_hour │ TIMESTAMP │ YES │ NULL │ NULL │ NULL │\n", + "│ tx_success │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n", + "│ is_system_transaction │ BOOLEAN │ YES │ NULL │ NULL │ NULL │\n", + "├───────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n", + "│ 25 rows 6 columns │\n", + "└────────────────────────────────────────────────────────────────────────────────────────────┘\n", + "\n" + ] + } + ], + "source": [ + "ctx.client.sql(f\"\"\"DESCRIBE {refined_txs_projection}\"\"\").show(max_rows=100)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CREATE OR REPLACE TABLE refined_traces__txs_projection AS\n", + "SELECT\n", + " -- Raw Transaction Fields\n", + " t.l2_gas_used AS tx_l2_gas_used\n", + " , t.l1_gas_used_unified AS tx_l1_gas_used_unified\n", + " , t.estimated_size AS tx_estimated_size\n", + " , t.from_address AS tx_from_address\n", + " , t.to_address AS tx_to_address\n", + " -- Computed Transaction Fee Fields\n", + " , t.tx_fee_native\n", + " , t.l1_fee_native AS tx_l1_fee_native\n", + " , t.l2_fee_native AS tx_l2_fee_native\n", + " , t.l2_priority_fee_native AS tx_l2_priority_fee_native\n", + " , t.l2_base_fee_native AS tx_l2_base_fee_native\n", + " , t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native\n", + " -- Computed Transaction Gas Price Fields\n", + " , t.l2_gas_price_gwei AS tx_l2_gas_price_gwei\n", + " , t.l2_base_gas_price_gwei AS tx_l2_base_gas_price_gwei\n", + " , t.l2_priority_gas_price_gwei AS tx_l2_priority_gas_price_gwei\n", + " , t.l2_legacy_extra_gas_price_gwei AS tx_l2_legacy_extra_gas_price_gwei\n", + " , t.l1_base_gas_price_gwei AS tx_l1_base_gas_price_gwei\n", + " , t.l1_blob_base_gas_price_gwei AS tx_l1_blob_base_gas_price_gwei\n", + " -- Computed Transaction Size Fields\n", + " , t.input_byte_length AS tx_input_byte_length\n", + " , t.input_zero_bytes AS tx_input_zero_bytes\n", + " , t.l1_base_scaled_size AS tx_l1_base_scaled_size\n", + " , t.l1_blob_scaled_size AS tx_l1_blob_scaled_size\n", + "\n", + " , t.method_id AS tx_method_id\n", + " , t.block_hour\n", + " , t.success AS tx_success\n", + " , t.is_system_transaction\n", + "\n", + "FROM (WITH\n", + "\n", + "pb AS (\n", + " SELECT\n", + " number\n", + " , base_fee_per_gas\n", + " FROM\n", + " (\n", + "\n", + " SELECT * FROM \n", + " read_parquet(\n", + " 'gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet',\n", + " hive_partitioning = true\n", + " )\n", + " \n", + " \n", + " \n", + ")\n", + ")\n", + "\n", + "-- Select the columns that we want from transactions joined to blocks.\n", + "-- Include some minor transformations that are needed for further calculations.\n", + ", pt1 AS (\n", + " SELECT\n", + " -- Transaction fields\n", + " t.dt\n", + " , t.chain\n", + " , t.chain_id\n", + " , t.network\n", + " , t.nonce\n", + " , t.transaction_index\n", + " , t.from_address\n", + " , t.to_address\n", + " , t.block_number\n", + " , t.block_timestamp\n", + " , t.hash\n", + " , t.transaction_type\n", + " , t.gas_price\n", + " , t.gas AS gas_limit\n", + " , t.receipt_gas_used AS l2_gas_used\n", + " , t.receipt_l1_gas_used\n", + "\n", + " -- EXCLUDED\n", + " -- t.input, --comment out for now to save on data space\n", + " -- t.blob_versioned_hashes -- bring in if/when we apply this to L1, or see L2 blobs\n", + "\n", + " -- L1 Fees\n", + " , CASE WHEN t.gas_price = 0 THEN 0 ELSE t.receipt_l1_fee END AS l1_fee\n", + " , t.receipt_l1_gas_price AS l1_gas_price\n", + " , t.receipt_l1_blob_base_fee AS l1_blob_base_fee\n", + " , b.base_fee_per_gas\n", + " , t.max_priority_fee_per_gas\n", + "\n", + " -- L1 Fee Scalars\n", + " , t.receipt_l1_fee_scalar::DECIMAL(12, 6) AS l1_fee_scalar\n", + " , micro(t.receipt_l1_base_fee_scalar) AS l1_base_fee_scalar\n", + " , micro(t.receipt_l1_blob_base_fee_scalar) AS l1_blob_base_fee_scalar\n", + "\n", + " -- L2 Fees and breakdown into BASE and PRIORITY contributions\n", + " , if(t.max_priority_fee_per_gas = 0 AND t.gas_price > 0, t.gas_price - b.base_fee_per_gas, 0) AS legacy_extra_fee_per_gas\n", + " , CASE WHEN t.gas_price = 0 THEN 0 ELSE t.gas_price * t.receipt_gas_used END AS l2_fee\n", + " , CASE WHEN t.gas_price = 0 THEN 0 ELSE t.max_priority_fee_per_gas * t.receipt_gas_used END AS l2_priority_fee\n", + " , CASE WHEN t.gas_price = 0 THEN 0 ELSE b.base_fee_per_gas * t.receipt_gas_used END AS l2_base_fee\n", + "\n", + " -- Transaction Information\n", + " , hexstr_method_id(t.input) AS method_id\n", + " , t.receipt_status = 1 AS success\n", + " , hexstr_bytelen(t.input) AS input_byte_length\n", + " , hexstr_zero_bytes(t.input) AS input_zero_bytes\n", + " , t.transaction_type = 126 OR t.gas_price = 0 AS is_system_transaction\n", + " -- Attributes Deposited Spec:\n", + " -- https://specs.optimism.io/protocol/deposits.html#l1-attributes-deposited-transaction\n", + " , (\n", + " (t.transaction_type = 126 OR t.gas_price = 0)\n", + " AND t.from_address = lower('0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001')\n", + " AND t.to_address = lower('0x4200000000000000000000000000000000000015')\n", + " ) AS is_attributes_deposited_transaction\n", + "\n", + " , epoch_to_hour(t.block_timestamp) AS block_hour\n", + "\n", + " FROM (\n", + "\n", + " SELECT * FROM \n", + " read_parquet(\n", + " 'gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet',\n", + " hive_partitioning = true\n", + " )\n", + " \n", + " \n", + " \n", + ") AS t\n", + " INNER JOIN pb AS b\n", + " ON t.block_number = b.number\n", + " WHERE 1 = 1\n", + ")\n", + "\n", + "-- Add fallback l1 gas estimate based on observed fee and weighted gas and blob prices.\n", + "-- Ecotone+ specs on L1 Fee Calculations: https://specs.optimism.io/protocol/exec-engine.html#l1-cost-fees-l1-fee-vault\n", + "-- Fjord+ specs on Estimated Size: https://specs.optimism.io/protocol/fjord/predeploys.html#l1-gas-usage-estimation\n", + ", pt2 AS (\n", + " SELECT\n", + " *\n", + " -- Note that this is the \"unified\" L1 Gas Used.\n", + " -- The meaning of the field has changed in Fjord.\n", + " , coalesce(receipt_l1_gas_used, 16 * estimated_size) AS l1_gas_used_unified\n", + " FROM (\n", + " SELECT\n", + " *\n", + " -- Estimated Size in bytes calculation, post-Fjord.\n", + " -- This is not equivalent to L1 Gas Used.\n", + " , (l1_fee / (\n", + " (16 * l1_base_fee_scalar * l1_gas_price)\n", + " + (l1_blob_base_fee_scalar * l1_blob_base_fee)\n", + " ))::INT64\n", + " AS estimated_size\n", + " FROM pt1\n", + " )\n", + ")\n", + "\n", + "-- Add more fee calculations.\n", + "-- Reuses results from the previous CTEs.\n", + "\n", + ", pt3 AS (\n", + " SELECT\n", + " *\n", + "\n", + " -- Total fee\n", + " , l2_fee + l1_fee AS tx_fee\n", + "\n", + " -- L2 Legacy Fee\n", + " , if(l2_priority_fee = 0, l2_fee - l2_base_fee, 0) AS l2_legacy_extra_fee\n", + "\n", + " -- L1 Base\n", + " , div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) * l1_gas_price AS l1_base_fee\n", + " , div16(l1_gas_used_unified) * coalesce(16 * l1_base_fee_scalar, l1_fee_scalar) AS l1_base_scaled_size\n", + "\n", + " -- L1 Blob\n", + " , coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar * l1_blob_base_fee, 0) AS l1_blob_fee\n", + " , coalesce(div16(l1_gas_used_unified) * l1_blob_base_fee_scalar, 0) AS l1_blob_scaled_size\n", + "\n", + " FROM pt2\n", + ")\n", + "\n", + "\n", + "-- Generate gas fee breakdowns in native terms, for later aggregation\n", + "-- Generate gas prices in gwei terms\n", + "SELECT\n", + " *\n", + "\n", + " -- Fees\n", + " , wei_to_eth(tx_fee) AS tx_fee_native\n", + "\n", + " -- Native Breakdown\n", + " , wei_to_eth(l1_fee) AS l1_fee_native\n", + " , wei_to_eth(l2_fee) AS l2_fee_native\n", + "\n", + " -- L1 Breakdown\n", + " , wei_to_eth(l1_base_fee) AS l1_base_fee_native\n", + " , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native\n", + "\n", + " -- L2 Breakdown\n", + " , wei_to_eth(l2_base_fee) AS l2_base_fee_native\n", + " , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native\n", + " , wei_to_eth(l2_legacy_extra_fee) AS l2_legacy_extra_fee_native\n", + "\n", + " -- Gas Prices\n", + " , wei_to_gwei(gas_price) AS l2_gas_price_gwei\n", + " , wei_to_gwei(base_fee_per_gas) AS l2_base_gas_price_gwei\n", + " , wei_to_gwei(max_priority_fee_per_gas) AS l2_priority_gas_price_gwei\n", + " , wei_to_gwei(legacy_extra_fee_per_gas) AS l2_legacy_extra_gas_price_gwei\n", + "\n", + " , wei_to_gwei(l1_gas_price) AS l1_base_gas_price_gwei\n", + " , wei_to_gwei(l1_blob_base_fee) AS l1_blob_base_gas_price_gwei\n", + "\n", + "FROM pt3\n", + ") AS t\n", + ";\n", + "\n", + "CREATE OR REPLACE TABLE refined_traces__traces_amortized AS\n", + "WITH\n", + "\n", + "\n", + "-- Select race fields with minor transformations that are needed for further calculations.\n", + "base_level_traces AS (\n", + " SELECT\n", + " -- Raw Trace fields\n", + " r.dt\n", + " , r.chain\n", + " , r.chain_id\n", + " , r.network\n", + " , r.block_number\n", + " , r.block_timestamp\n", + " , r.transaction_hash\n", + " , r.transaction_index\n", + " , r.from_address AS trace_from_address\n", + " , r.to_address AS trace_to_address\n", + " , r.gas AS trace_gas_limit\n", + " , r.gas_used AS trace_gas_used\n", + " , r.trace_address\n", + " , r.trace_type\n", + " , r.call_type\n", + " , r.error\n", + " , hexstr_method_id(r.input) AS trace_method_id\n", + " , r.status = 1 AS trace_success\n", + " -- Trace address helpers.\n", + " , trace_address_depth(r.trace_address) AS trace_depth\n", + " , trace_address_parent(r.trace_address) AS parent_trace_address\n", + " -- Trace i/o data - comment out for now to save on data space\n", + " -- , r.input\n", + " -- , r.output\n", + "\n", + " FROM (\n", + "\n", + " SELECT * FROM \n", + " read_parquet(\n", + " 'gs://oplabs-tools-data-sink/ingestion/traces_v1/chain=op/dt=2024-11-18/000128144000.parquet',\n", + " hive_partitioning = true\n", + " )\n", + " \n", + " ORDER BY block_number, transaction_hash, trace_address\n", + " \n", + ") AS r\n", + ")\n", + "\n", + "--get amount of calls per transcation, to use for amortizing\n", + ", get_traces_per_tansaction AS (\n", + " SELECT\n", + " dt\n", + " , chain_id\n", + " , block_number\n", + " , block_timestamp\n", + " , transaction_hash\n", + " , count(*) AS count_traces_in_transaction\n", + " FROM base_level_traces\n", + " GROUP BY 1, 2, 3, 4, 5\n", + ")\n", + "\n", + "--get subtrace gas used, for isolating each call\n", + ", get_subtraces_gas_per_trace AS (\n", + " SELECT\n", + " dt\n", + " , chain_id\n", + " , block_number\n", + " , block_timestamp\n", + " , transaction_hash\n", + " , parent_trace_address\n", + " , trace_depth\n", + " , sum(trace_gas_used) AS trace_gas_used_in_subtraces\n", + " , count(*) AS count_subtraces_in_trace\n", + " FROM base_level_traces\n", + " GROUP BY 1, 2, 3, 4, 5, 6, 7\n", + ")\n", + "\n", + "\n", + "SELECT\n", + " bl.*\n", + " --\n", + " , tpt.count_traces_in_transaction\n", + " , coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_in_subtraces\n", + " --\n", + " , bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_minus_subtraces\n", + "\n", + " /*\n", + " -- the subtraces will never add up to part of whole, but leave as is\n", + " , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))\n", + " * gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_l2_fee_native_minus_subtraces\n", + " , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))\n", + " * gwei_to_eth(bl.tx_l2_base_gas_price_gwei) AS tx_l2_base_fee_native_minus_subtraces\n", + " , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))\n", + " * gwei_to_eth(bl.tx_l2_priority_gas_price_gwei) AS tx_l2_priority_fee_native_minus_subtraces\n", + " , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))\n", + " * gwei_to_eth(bl.tx_l2_legacy_extra_gas_price_gwei) AS tx_l2_legacy_base_fee_native_minus_subtraces\n", + "\n", + " -- Amortize evenly across all calls\n", + "\n", + " , bl.tx_l2_gas_used / tpt.count_traces_in_transaction AS tx_l2_gas_used_amortized_by_call\n", + " , bl.tx_l1_gas_used_unified / tpt.count_traces_in_transaction AS tx_l1_gas_used_unified_amortized_by_call\n", + " , bl.tx_l1_base_scaled_size / tpt.count_traces_in_transaction AS tx_l1_base_scaled_size_amortized_by_call\n", + " , bl.tx_l1_blob_scaled_size / tpt.count_traces_in_transaction AS tx_l1_blob_scaled_size_amortized_by_call\n", + " , bl.tx_estimated_size / tpt.count_traces_in_transaction AS tx_estimated_size_amortized_by_call\n", + "\n", + " , bl.tx_fee_native / tpt.count_traces_in_transaction AS tx_fee_native_amortized_by_call\n", + " , bl.tx_l2_fee_native / tpt.count_traces_in_transaction AS tx_l2_fee_native_amortized_by_call\n", + " , bl.tx_l1_fee_native / tpt.count_traces_in_transaction AS tx_l1_fee_native_amortized_by_call\n", + " , bl.tx_l2_base_fee_native / tpt.count_traces_in_transaction AS tx_l2_base_fee_native_amortized_by_call\n", + " , bl.tx_l2_priority_fee_native / tpt.count_traces_in_transaction AS tx_l2_priority_fee_native_amortized_by_call\n", + "\n", + " --\n", + " , (bl.tx_l1_fee_native / tpt.count_traces_in_transaction) + (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0))\n", + " * gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_fee_native_l1_amortized_l2_minus_subtraces\n", + " */\n", + "\n", + "FROM base_level_traces AS bl\n", + "INNER JOIN get_traces_per_tansaction AS tpt -- join on txn level\n", + " ON\n", + " bl.dt = tpt.dt\n", + " AND bl.chain_id = tpt.chain_id\n", + " AND bl.block_number = tpt.block_number\n", + " AND bl.transaction_hash = tpt.transaction_hash\n", + "LEFT JOIN get_subtraces_gas_per_trace AS st -- join on trace level 1 level down\n", + " ON\n", + " bl.dt = st.dt\n", + " AND bl.chain_id = st.chain_id\n", + " AND bl.block_number = st.block_number\n", + " AND bl.transaction_hash = st.transaction_hash\n", + " AND bl.trace_depth = (st.trace_depth - 1)\n", + " AND bl.trace_address = st.parent_trace_address\n", + "\n" + ] + } + ], + "source": [ + "print(\";\\n\\n\".join([stmt1, stmt2]))" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-20 12:34:40\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 113.5MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m91188\u001b[0m\n" + ] + } + ], + "source": [ + "from op_analytics.coreutils.threads import run_concurrently\n", + "\n", + "run_concurrently(ctx.client.sql, [stmt1, stmt2])\n", + "ctx.client.sql(\"SHOW TABLES\")\n", + "ctx.report_size()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-20 12:33:04\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 113.5MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m91188\u001b[0m\n" + ] + } + ], + "source": [ + "ctx.client.sql(stmt1)\n", + "ctx.client.sql(stmt2)\n", + "ctx.client.sql(\"SHOW TABLES\")\n", + "ctx.report_size()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-20 12:33:14\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 114.0MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m91188\u001b[0m\n" + ] + } + ], + "source": [ + "ctx.client.sql(\";\\n\\n\".join([stmt1, stmt2]))\n", + "ctx.client.sql(\"SHOW TABLES\")\n", + "ctx.report_size()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-20 12:31:46\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduck db size: 64.8MB \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m33\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m91188\u001b[0m\n" + ] + } + ], + "source": [ + "ctx.report_size()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "refined_txs_statement = aux_views[\"refined_transactions_fees\"].create_table_statement(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"raw_blocks\": f\"(\\n{blocks}\\n)\" ,\n", + " \"raw_transactions\": f\"(\\n{transactions}\\n)\" ,\n", + " },\n", + ")\n", + "\n", + "\n", + "\n", + "refined_traces = AuxiliaryView(\"refined_traces_fees\").create_table_statement(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"raw_traces\": traces,\n", + " \"refined_transactions_fees\": refined_txs,\n", + " },\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Create a table with the refined transactions\n", + "\n", + "blocks_view = input_datasets[\"ingestion/blocks_v1\"].create_view()\n", + "transactions_view = input_datasets[\"ingestion/transactions_v1\"].create_view()\n", + "\n", + "refined_txs = aux_views[\"refined_transactions_fees\"].create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"raw_blocks\": blocks_view,\n", + " \"raw_transactions\": transactions_view,\n", + " },\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from op_analytics.datapipeline.models.compute.auxview import AuxiliaryView\n", + "\n", + "traces_table = input_datasets[\"ingestion/traces_v1\"].create_table(\n", + " additional_sql=\"ORDER BY block_number, transaction_hash, trace_address\"\n", + ")\n", + "\n", + "refined_traces = AuxiliaryView(\"refined_traces_fees\").create_table(\n", + " duckdb_context=ctx,\n", + " template_parameters={\n", + " \"raw_traces\": traces_table,\n", + " \"refined_transactions_fees\": refined_txs,\n", + " },\n", + " )\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n", + "\n", + "execute_model_in_memory(\n", + " duckdb_client=duckdb_client,\n", + " model=model_name,\n", + " data_reader=batch,\n", + " limit_input_parquet_files=1\n", + ")\n", + "\n", + "# The duckdb database will have the following:\n", + "# - input tables\n", + "# - views used by the model\n", + "# - model outputs\n", + "# \n", + "# You can use duckdb to inspect any of the above results.\n", + "duckdb_client.sql(\"SHOW TABLES\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Verify model results - Traces" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "duckdb_client.sql(\"SELECT * FROM daily_traces_tr_to_v1 ORDER BY count_transactions_called DESC LIMIT 10\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Test Transaction Metrics" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "duckdb_client.sql(\"\"\"\n", + " SELECT trace_to_address,\n", + " count_transactions_called_with_internal_type_call, count_transactions_called_with_internal_type_call_or_delegate,\n", + " count_transactions_called\n", + " FROM daily_traces_tr_to_v1\n", + " ORDER BY count_transactions_called_with_internal_type_call DESC\n", + " LIMIT 10\n", + " \"\"\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Test Gas Used Metrics" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "duckdb_client.sql(\"\"\"\n", + " SELECT\n", + " trace_to_address,\n", + " \n", + " sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call,\n", + " sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call,\n", + " \n", + " sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call\n", + " sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call,\n", + " sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call,\n", + " \n", + " count_transactions_called_with_internal_type_call,\n", + " count_transactions_called_with_internal_type_call_or_delegate,\n", + " count_transactions_called\n", + " \n", + " FROM daily_traces_tr_to_v1\n", + " ORDER BY sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call DESC\n", + " LIMIT 10\n", + " \"\"\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "duckdb_client.sql(\"\"\"\n", + " SELECT * FROM refined_traces_fees_v1\n", + " where transaction_hash = '0xc620133c2339f36d8bfae889ea29e9986a70182f7bbe3380d0622f3801619eda'\n", + " AND block_number = 128145924\n", + " ORDER BY trace_address ASC\n", + " LIMIT 10\n", + " \"\"\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Check the data output size" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "duckdb_client.sql(\"SELECT COUNT(*) AS interm_num_calls, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM refined_traces_fees_v1\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT transaction_hash) AS num_txs, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM aggregated_traces_tr_to_hash_v1\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT trace_to_address) AS num_trace_tos FROM daily_traces_tr_to_v1\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Get table schema" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "duckdb_client.sql(\"DESCRIBE daily_traces_tr_to_v1\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.6" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/notebooks/adhoc/refined_traces_models_dev_v2.ipynb b/notebooks/adhoc/refined_traces_models_dev_v2.ipynb index e8709206800..a305d191fae 100644 --- a/notebooks/adhoc/refined_traces_models_dev_v2.ipynb +++ b/notebooks/adhoc/refined_traces_models_dev_v2.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Prepare data reader and up model execution context" + "## Prepare data reader and model execution context" ] }, { diff --git a/notebooks/adhoc/refined_transactions_address_models_dev.ipynb b/notebooks/adhoc/refined_transactions_address_models_dev.ipynb new file mode 100644 index 00000000000..c30a30b9d9a --- /dev/null +++ b/notebooks/adhoc/refined_transactions_address_models_dev.ipynb @@ -0,0 +1,453 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Prepare data reader for a given chain and date" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mconnecting to OPLABS Clickhouse client...\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m25\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mloaded vault from .env file \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m32\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1mloaded vault: 17 items \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mvault.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m76\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1mdebug \u001b[0m] \u001b[1minitialized OPLABS Clickhouse client.\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m37\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mprepared 1 input batches. \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mbydate.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m96\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n" + ] + } + ], + "source": [ + "from op_analytics.coreutils.duckdb_inmem import init_client\n", + "from op_analytics.coreutils.partitioned.reader import DataReader\n", + "from op_analytics.coreutils.partitioned.location import DataLocation\n", + "from op_analytics.datapipeline.etl.intermediate.construct import construct_data_readers\n", + "\n", + "from op_analytics.datapipeline.models.compute.udfs import create_duckdb_macros\n", + "\n", + "model_name = \"refined_transactions_addresses_models\"\n", + "\n", + "# Define the input data range.\n", + "read_batches: list[DataReader] = construct_data_readers(\n", + " chains=[\"op\"],\n", + " models=[model_name],\n", + " range_spec=\"@20241118:+1\",\n", + " read_from=DataLocation.GCS\n", + ")\n", + "\n", + "\n", + "# Select input for one date and build the intermediate model inputs.\n", + "batch = read_batches[0]\n", + "\n", + "\n", + "duckdb_client = init_client()\n", + "create_duckdb_macros(duckdb_client)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Run the model\n", + "\n", + "This automatically registers the model outputs as duckdb tables." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mExecuting model function... \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mtestutils.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m220\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:15\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/transactions_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/transactions_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_transactions_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:16\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/blocks_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/blocks_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_blocks_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:18\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mduckdb dataset='ingestion/logs_v1' using 1/22 parquet paths, first path is gs://oplabs-tools-data-sink/ingestion/logs_v1/chain=op/dt=2024-11-18/000128144000.parquet\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mreader.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m68\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mregistered view: 'ingestion_logs_v1' using 1 parquet paths\u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mclient.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m53\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mrefined_transactions_fees\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mlogs_topic0_filters\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mevent_emitting_transactions\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_address_summary\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_from_tx_to_method\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_to_method\u001b[0m\n", + "\u001b[2m2024-12-14 22:09:19\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mRendering query \u001b[0m \u001b[36mfilename\u001b[0m=\u001b[35mquerybuilder.py\u001b[0m \u001b[36mlineno\u001b[0m=\u001b[35m40\u001b[0m \u001b[36mprocess\u001b[0m=\u001b[35m46924\u001b[0m \u001b[36mtemplate\u001b[0m=\u001b[35mdaily_transactions_agg_tx_to\u001b[0m\n", + "dict_keys(['refined_transactions_fees_v1', 'event_emitting_transactions_v1', 'summary_v1', 'daily_transactions_agg_tx_from_tx_to_method_v1', 'daily_transactions_agg_tx_to_method_v1', 'daily_transactions_agg_tx_to_v1'])\n" + ] + }, + { + "data": { + "text/plain": [ + "┌────────────────────────────────────────────────┐\n", + "│ name │\n", + "│ varchar │\n", + "├────────────────────────────────────────────────┤\n", + "│ daily_address_summary │\n", + "│ daily_transactions_agg_tx_from_tx_to_method │\n", + "│ daily_transactions_agg_tx_from_tx_to_method_v1 │\n", + "│ daily_transactions_agg_tx_to │\n", + "│ daily_transactions_agg_tx_to_method │\n", + "│ daily_transactions_agg_tx_to_method_v1 │\n", + "│ daily_transactions_agg_tx_to_v1 │\n", + "│ event_emitting_transactions │\n", + "│ event_emitting_transactions_v1 │\n", + "│ ingestion_blocks_v1 │\n", + "│ ingestion_logs_v1 │\n", + "│ ingestion_transactions_v1 │\n", + "│ logs_topic0_filters │\n", + "│ refined_transactions_fees │\n", + "│ refined_transactions_fees_v1 │\n", + "│ summary_v1 │\n", + "├────────────────────────────────────────────────┤\n", + "│ 16 rows │\n", + "└────────────────────────────────────────────────┘" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from op_analytics.datapipeline.models.compute.testutils import execute_model_in_memory\n", + "\n", + "execute_model_in_memory(\n", + " duckdb_client=duckdb_client,\n", + " model=model_name,\n", + " data_reader=batch,\n", + " limit_input_parquet_files=1\n", + ")\n", + "\n", + "# The duckdb database will have the following:\n", + "# - input tables\n", + "# - views used by the model\n", + "# - model outputs\n", + "# \n", + "# You can use duckdb to inspect any of the above results.\n", + "duckdb_client.sql(\"SHOW TABLES\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Verify model results - Transactions" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "┌────────────┬─────────┬──────────┬─────────┬────────────────────────────────────────────┬────────────────────────────────────────────┬────────────┬────────────────────┬────────────────────────────┬─────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────────┬───────────────────────┬────────────────────────────┬────────────────────────────┬────────────────────────────────────┬────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────┬─────────────────────────────────┬───────────────────────┬──────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────────────────┐\n", + "│ dt │ chain │ chain_id │ network │ from_address │ to_address │ method_id │ count_transactions │ count_transactions_success │ count_unique_blocks │ sum_l2_gas_used │ sum_l2_gas_used_success │ sum_tx_fee_native │ sum_tx_fee_native_success │ l1_fee_native │ l1_fee_native_success │ l2_fee_native │ l2_fee_native_success │ l2_priority_fee_native │ l2_priority_fee_native_success │ l2_base_fee_native │ l2_base_fee_native_success │ l2_legacy_extra_fee_native │ l2_legacy_extra_fee_native_success │ avg_l2_gas_price_gwei │ avg_l2_priority_gas_price_gwei │ avg_l2_legacy_extra_gas_price_gwei │ avg_l1_base_gas_price_gwei │ avg_l1_blob_base_gas_price_gwei │ sum_input_byte_length │ sum_input_zero_bytes │ sum_input_nonzero_bytes │ sum_l1_base_scaled_size │ sum_l1_blob_scaled_size │ sum_l1_gas_used_unified │ sum_estimated_size │\n", + "│ date │ varchar │ int32 │ varchar │ varchar │ varchar │ varchar │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │\n", + "├────────────┼─────────┼──────────┼─────────┼────────────────────────────────────────────┼────────────────────────────────────────────┼────────────┼────────────────────┼────────────────────────────┼─────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────────┼───────────────────────┼────────────────────────────┼────────────────────────────┼────────────────────────────────────┼────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────┼─────────────────────────────────┼───────────────────────┼──────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼────────────────────┤\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xabe58b50367fb4cea7d19c41c228abed381ed2ef │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 1382 │ 1382 │ 1358 │ 482318566 │ 482318566 │ 0.0003913002292985670 │ 0.0003913002292985670 │ 0.0003412383580521060 │ 0.0003412383580521060 │ 0.0000500618712464610 │ 0.0000500618712464610 │ 0.0000495272351094990 │ 0.0000495272351094990 │ 0.0000005346361369620 │ 0.0000005346361369620 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.00010379420319984324 │ 0.00010268573221271976 │ 0.0 │ 8.181933951719273 │ 1.7652776299931656 │ 2764 │ 1382 │ 1382 │ 11557.942400000000 │ 140164.236600000000 │ 2211200 │ 138200 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x669bee230facc9240e2ef81c2e566c3ebadd7c71 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1380 │ 1380 │ 1338 │ 710920321 │ 710920321 │ 0.0005336257693735600 │ 0.0005336257693735600 │ 0.0003400395876824320 │ 0.0003400395876824320 │ 0.0001935861816911280 │ 0.0001935861816911280 │ 0.0001928001503458680 │ 0.0001928001503458680 │ 0.0000007860313452600 │ 0.0000007860313452600 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0002723036266832609 │ 0.00027119797345878373 │ 0.0 │ 8.182952605069152 │ 1.754385178728055 │ 5520 │ 0 │ 5520 │ 11541.216000000000 │ 139961.394000000000 │ 2208000 │ 138000 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xae0b5df2dfaacd6eb6c1c56cc710f529f31c6c44 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1378 │ 1378 │ 1011 │ 709892239 │ 709892239 │ 0.0003405743725520270 │ 0.0003405743725520270 │ 0.0003381303792971470 │ 0.0003381303792971470 │ 0.0000024439932548800 │ 0.0000024439932548800 │ 0.0000016614856152610 │ 0.0000016614856152610 │ 0.0000007825076396190 │ 0.0000007825076396190 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 3.4427665504876723e-06 │ 2.3404758130635094e-06 │ 0.0 │ 8.174754733242228 │ 1.7449185898165436 │ 5512 │ 0 │ 5512 │ 11524.489600000000 │ 139758.551400000000 │ 2204800 │ 137800 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xc96909cd052f6000ffaf3e9ff17f9c2047cfd1b8 │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 1377 │ 1377 │ 1294 │ 489785396 │ 489785396 │ 0.0005479238051485660 │ 0.0005479238051485660 │ 0.0003398517049643630 │ 0.0003398517049643630 │ 0.0002080721001842030 │ 0.0002080721001842030 │ 0.0002075249990322950 │ 0.0002075249990322950 │ 0.0000005471011519080 │ 0.0000005471011519080 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.000424822997752679 │ 0.00042370597557035976 │ 0.0 │ 8.186137752838 │ 1.7737158616522526 │ 2754 │ 1377 │ 1377 │ 11516.126400000000 │ 139657.130100000000 │ 2203200 │ 137700 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xc96faba4ff9941a55754d7a4b02aeaf7d53f43b9 │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1375 │ 1375 │ 1243 │ 708337771 │ 708337771 │ 0.0003951649379339080 │ 0.0003951649379339080 │ 0.0003377082167361510 │ 0.0003377082167361510 │ 0.0000574567211977570 │ 0.0000574567211977570 │ 0.0000566747668676990 │ 0.0000566747668676990 │ 0.0000007819543300580 │ 0.0000007819543300580 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 8.111486292287101e-05 │ 8.001093431413104e-05 │ 0.0 │ 8.180426687822184 │ 1.7466995186037855 │ 5500 │ 0 │ 5500 │ 11499.400000000000 │ 139454.287500000000 │ 2200000 │ 137500 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x3c9779d3ec32ed4985a3e634c44d38c517564f5b │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 1373 │ 1373 │ 1294 │ 491075055 │ 491075055 │ 0.0008552131244147220 │ 0.0008552131244147220 │ 0.0003387120382349520 │ 0.0003387120382349520 │ 0.0005165010861797700 │ 0.0005165010861797700 │ 0.0005159557138518800 │ 0.0005159557138518800 │ 0.0000005453723278900 │ 0.0000005453723278900 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0010517762629579505 │ 0.0010506656947823995 │ 0.0 │ 8.185846771361819 │ 1.7679067135344035 │ 2746 │ 1373 │ 1373 │ 11482.673600000000 │ 139251.444900000000 │ 2196800 │ 137300 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x74e27bd4fdb82f36d843d049dee5fd2d5f03335f │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1364 │ 1364 │ 1341 │ 703534687 │ 703534687 │ 0.0010010743284877850 │ 0.0010010743284877850 │ 0.0003357583603829810 │ 0.0003357583603829810 │ 0.0006653159681048040 │ 0.0006653159681048040 │ 0.0006645372476909190 │ 0.0006645372476909190 │ 0.0000007787204138850 │ 0.0000007787204138850 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0009456761413454004 │ 0.0009445692728024922 │ 0.0 │ 8.188979361125213 │ 1.750083199381662 │ 5456 │ 0 │ 5456 │ 11407.404800000000 │ 138338.653200000000 │ 2182400 │ 136400 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x678fa1d680beb37d345412fb60b381c429276faf │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 1269 │ 1269 │ 1158 │ 653747506 │ 653747506 │ 0.0006606553463715090 │ 0.0006606553463715090 │ 0.0003128380455535130 │ 0.0003128380455535130 │ 0.0003478173008179960 │ 0.0003478173008179960 │ 0.0003470885916694200 │ 0.0003470885916694200 │ 0.0000007287091485760 │ 0.0000007287091485760 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0005320361418220018 │ 0.0005309214773041444 │ 0.0 │ 8.21656335963141 │ 1.7527739641574809 │ 5076 │ 0 │ 5076 │ 10612.900800000000 │ 128703.629700000000 │ 2030400 │ 126900 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xa750a354528b56a62ee6f8538ca340f1d986c878 │ 0xca11bde05977b3631167028862be2a173976ca11 │ 0x82ad56cb │ 645 │ 645 │ 643 │ 120615423 │ 120615423 │ 0.0005615134749219040 │ 0.0005615134749219040 │ 0.0005054401110283420 │ 0.0005054401110283420 │ 0.0000560733638935620 │ 0.0000560733638935620 │ 0.0000559428295058780 │ 0.0000559428295058780 │ 0.0000001305343876840 │ 0.0000001305343876840 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0004648938129045238 │ 0.00046381157661635027 │ 0.0 │ 8.190255176056374 │ 1.7265227217195962 │ 783860 │ 595812 │ 188048 │ 17367.684949000000 │ 210619.521895687500 │ 3322687 │ 207804 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x0771483e9ad0d8c452efbca3451e4e56249b64bd │ 0x1b52af3d107491c2036d745478176eb3c7863eb5 │ 0xe129b4b8 │ 531 │ 411 │ 244 │ 255606813 │ 240203893 │ 0.0006421451107887370 │ 0.0005577252442263160 │ 0.0003349658754101420 │ 0.0002690557854285030 │ 0.0003071792353785950 │ 0.0002886694587978130 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000003774028573460 │ 0.0000003553926710770 │ 0.0003068018325212490 │ 0.0002883140661267360 │ 0.0012017646625819595 │ 0.0 │ 0.001200288164937329 │ 8.250504460545287 │ 2.1931209621529346 │ 124991 │ 28064 │ 96927 │ 9585.962564000000 │ 116249.854719750000 │ 1833932 │ 114638 │\n", + "├────────────┴─────────┴──────────┴─────────┴────────────────────────────────────────────┴────────────────────────────────────────────┴────────────┴────────────────────┴────────────────────────────┴─────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────────┴───────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────────────┴────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────┴─────────────────────────────────┴───────────────────────┴──────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────────────────┤\n", + "│ 10 rows 36 columns │\n", + "└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "duckdb_client.sql(\"SELECT * FROM daily_transactions_tx_from_tx_to_method_v1 ORDER BY count_transactions DESC LIMIT 10\")" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "┌────────────┬─────────┬──────────┬─────────┬────────────────────────────────────────────┬────────────┬────────────────────┬────────────────────────────┬─────────────────────┬─────────────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────────┬───────────────────────┬────────────────────────────┬────────────────────────────┬────────────────────────────────────┬────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────┬─────────────────────────────────┬───────────────────────┬──────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────────────────┐\n", + "│ dt │ chain │ chain_id │ network │ to_address │ method_id │ count_transactions │ count_transactions_success │ count_unique_blocks │ count_unique_from_addresses │ sum_l2_gas_used │ sum_l2_gas_used_success │ sum_tx_fee_native │ sum_tx_fee_native_success │ l1_fee_native │ l1_fee_native_success │ l2_fee_native │ l2_fee_native_success │ l2_priority_fee_native │ l2_priority_fee_native_success │ l2_base_fee_native │ l2_base_fee_native_success │ l2_legacy_extra_fee_native │ l2_legacy_extra_fee_native_success │ avg_l2_gas_price_gwei │ avg_l2_priority_gas_price_gwei │ avg_l2_legacy_extra_gas_price_gwei │ avg_l1_base_gas_price_gwei │ avg_l1_blob_base_gas_price_gwei │ sum_input_byte_length │ sum_input_zero_bytes │ sum_input_nonzero_bytes │ sum_l1_base_scaled_size │ sum_l1_blob_scaled_size │ sum_l1_gas_used_unified │ sum_estimated_size │\n", + "│ date │ varchar │ int32 │ varchar │ varchar │ varchar │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │\n", + "├────────────┼─────────┼──────────┼─────────┼────────────────────────────────────────────┼────────────┼────────────────────┼────────────────────────────┼─────────────────────┼─────────────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────────┼───────────────────────┼────────────────────────────┼────────────────────────────┼────────────────────────────────────┼────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────┼─────────────────────────────────┼───────────────────────┼──────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼────────────────────┤\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 0x24f88863 │ 6766 │ 6766 │ 1366 │ 5 │ 3486432524 │ 3486432524 │ 0.0029310947547187890 │ 0.0029310947547187890 │ 0.0016644745896522240 │ 0.0016644745896522240 │ 0.0012666201650665650 │ 0.0012666201650665650 │ 0.0012627622421891670 │ 0.0012627622421891670 │ 0.0000038579228773980 │ 0.0000038579228773980 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.00036329977888496914 │ 0.00036219322573906987 │ 0.0 │ 8.188288767636077 │ 1.749725911569594 │ 27064 │ 0 │ 27064 │ 56585.411200000000 │ 686216.515800000000 │ 10825600 │ 676600 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 0x0001 │ 4132 │ 4132 │ 1361 │ 3 │ 1463179017 │ 1463179017 │ 0.0017944371588618550 │ 0.0017944371588618550 │ 0.0010198021012514210 │ 0.0010198021012514210 │ 0.0007746350576104340 │ 0.0007746350576104340 │ 0.0007730079479936740 │ 0.0007730079479936740 │ 0.0000016271096167600 │ 0.0000016271096167600 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0005294191951977904 │ 0.0005283071579160528 │ 0.0 │ 8.18465436287236 │ 1.76898462682423 │ 8264 │ 4132 │ 4132 │ 34556.742400000000 │ 419072.811600000000 │ 6611200 │ 413200 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xca11bde05977b3631167028862be2a173976ca11 │ 0x82ad56cb │ 1953 │ 1953 │ 1025 │ 14 │ 368648954 │ 368648954 │ 0.0017152021180275460 │ 0.0017152021180275460 │ 0.0015446633785242060 │ 0.0015446633785242060 │ 0.0001705387395033400 │ 0.0001705387395033400 │ 0.0001693481029723900 │ 0.0001693481029723900 │ 0.0000003977523406470 │ 0.0000003977523406470 │ 0.0000007956603712990 │ 0.0000007956603712990 │ 0.0004626047019879514 │ 0.00045937497213782957 │ 2.158314468726256e-06 │ 8.150272419802972 │ 1.7415342558618798 │ 2368996 │ 1799132 │ 569864 │ 52768.666254000000 │ 639930.496789125000 │ 10095402 │ 631379 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x802b65b5d9016621e66003aed0b16615093f328b │ 0xa00597a0 │ 1232 │ 1062 │ 555 │ 24 │ 147821257 │ 137693545 │ 0.0100565704491694620 │ 0.0094198296878668720 │ 0.0004155514541569470 │ 0.0003572613217446540 │ 0.0096410189950125150 │ 0.0090625683661222180 │ 0.0096408431679565280 │ 0.0090624058163189720 │ 0.0000001758270559870 │ 0.0000001625498032460 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0652207888816188 │ 0.06521959942443546 │ 0.0 │ 8.179245044635106 │ 1.8934894037806322 │ 241472 │ 171539 │ 69933 │ 13313.498301000000 │ 161454.025401187500 │ 2547063 │ 159449 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x06a8087693b98e068b79f362687c718de6e5b5ae │ 0x00000001 │ 860 │ 581 │ 334 │ 39 │ 196779084 │ 168296201 │ 0.0059076257887813410 │ 0.0043030184416324580 │ 0.0003818180253589620 │ 0.0002561905894682100 │ 0.0055258077634223790 │ 0.0040468278521642480 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000002658997551030 │ 0.0000002266407367040 │ 0.0055255418636672760 │ 0.0040466012114275440 │ 0.028081275972513316 │ 0.0 │ 0.028079924712258928 │ 8.244433172100253 │ 2.1350748990277957 │ 120703 │ 29229 │ 91474 │ 11095.358127000000 │ 134554.434332062500 │ 2122701 │ 132793 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 0xa9059cbb │ 728 │ 728 │ 537 │ 563 │ 25456048 │ 25456048 │ 0.0040625414726000710 │ 0.0040625414726000710 │ 0.0001964661196555430 │ 0.0001964661196555430 │ 0.0038660753529445280 │ 0.0038660753529445280 │ 0.0033772419587455260 │ 0.0033772419587455260 │ 0.0000000295539835420 │ 0.0000000295539835420 │ 0.0004888038402154600 │ 0.0004888038402154600 │ 0.15187256690215734 │ 0.1326695313720938 │ 0.019201874549241108 │ 8.035720630971008 │ 1.972745485799214 │ 49504 │ 29316 │ 20188 │ 6088.409600000000 │ 73834.706400000000 │ 1164800 │ 72800 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 0xb2460c48 │ 645 │ 582 │ 258 │ 22 │ 91833326 │ 88720964 │ 0.1301338657302059040 │ 0.1267186651330060110 │ 0.0001795861496755980 │ 0.0001617806061999360 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.0000001239708663080 │ 0.0000001194382884650 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 1.4151102354773724 │ 1.4151102354773724 │ 0.0 │ 8.34974817814926 │ 2.0426825710566794 │ 23220 │ 7212 │ 16008 │ 5394.264000000000 │ 65416.738500000000 │ 1032000 │ 64500 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x1b52af3d107491c2036d745478176eb3c7863eb5 │ 0xe129b4b8 │ 531 │ 411 │ 244 │ 1 │ 255606813 │ 240203893 │ 0.0006421451107887370 │ 0.0005577252442263160 │ 0.0003349658754101420 │ 0.0002690557854285030 │ 0.0003071792353785950 │ 0.0002886694587978130 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000003774028573460 │ 0.0000003553926710770 │ 0.0003068018325212490 │ 0.0002883140661267360 │ 0.0012017646625819595 │ 0.0 │ 0.001200288164937329 │ 8.250504460545287 │ 2.1931209621529346 │ 124991 │ 28064 │ 96927 │ 9585.962564000000 │ 116249.854719750000 │ 1833932 │ 114638 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x2b86d9abaf056661ab3d43201211172aa0e0b8c4 │ 0x00000000 │ 427 │ 312 │ 220 │ 20 │ 99067881 │ 89687455 │ 0.0015839057563132140 │ 0.0013702666997647930 │ 0.0002492569463044840 │ 0.0001831644931472380 │ 0.0013346488100087300 │ 0.0011871022066175550 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000001285124851690 │ 0.0000001167377014790 │ 0.0013345202975235610 │ 0.0011869854689160760 │ 0.013472063766143641 │ 0.0 │ 0.013470766549690923 │ 8.370617304692704 │ 1.9801324067381532 │ 109286 │ 26074 │ 83212 │ 7670.575457000000 │ 93021.778098937500 │ 1467491 │ 91738 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x06a8087693b98e068b79f362687c718de6e5b5ae │ 0x00000002 │ 375 │ 233 │ 242 │ 39 │ 45886694 │ 34563118 │ 0.0026296801972266880 │ 0.0016010900793226030 │ 0.0001423950597136840 │ 0.0000905432151757250 │ 0.0024872851375130040 │ 0.0015105468641468780 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000594774491490 │ 0.0000000457077350370 │ 0.0024872256600638550 │ 0.0015105011564118410 │ 0.054204932207864084 │ 0.0 │ 0.05420363602712052 │ 8.205539296170423 │ 1.9898004619641945 │ 57375 │ 27431 │ 29944 │ 4422.569927000000 │ 53632.914594562500 │ 846101 │ 52881 │\n", + "├────────────┴─────────┴──────────┴─────────┴────────────────────────────────────────────┴────────────┴────────────────────┴────────────────────────────┴─────────────────────┴─────────────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────────┴───────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────────────┴────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────┴─────────────────────────────────┴───────────────────────┴──────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────────────────┤\n", + "│ 10 rows 36 columns │\n", + "└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "duckdb_client.sql(\"SELECT * FROM daily_transactions_tx_to_method_v1 ORDER BY count_transactions DESC LIMIT 10\")" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "┌────────────┬─────────┬──────────┬─────────┬────────────────────────────────────────────┬────────────────────┬────────────────────────────┬─────────────────────┬─────────────────────────────┬─────────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────────┬───────────────────────┬────────────────────────────┬────────────────────────────┬────────────────────────────────────┬────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────┬─────────────────────────────────┬───────────────────────┬──────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────────────────┐\n", + "│ dt │ chain │ chain_id │ network │ to_address │ count_transactions │ count_transactions_success │ count_unique_blocks │ count_unique_from_addresses │ count_unique_method_ids │ sum_l2_gas_used │ sum_l2_gas_used_success │ sum_tx_fee_native │ sum_tx_fee_native_success │ l1_fee_native │ l1_fee_native_success │ l2_fee_native │ l2_fee_native_success │ l2_priority_fee_native │ l2_priority_fee_native_success │ l2_base_fee_native │ l2_base_fee_native_success │ l2_legacy_extra_fee_native │ l2_legacy_extra_fee_native_success │ avg_l2_gas_price_gwei │ avg_l2_priority_gas_price_gwei │ avg_l2_legacy_extra_gas_price_gwei │ avg_l1_base_gas_price_gwei │ avg_l1_blob_base_gas_price_gwei │ sum_input_byte_length │ sum_input_zero_bytes │ sum_input_nonzero_bytes │ sum_l1_base_scaled_size │ sum_l1_blob_scaled_size │ sum_l1_gas_used_unified │ sum_estimated_size │\n", + "│ date │ varchar │ int32 │ varchar │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │\n", + "├────────────┼─────────┼──────────┼─────────┼────────────────────────────────────────────┼────────────────────┼────────────────────────────┼─────────────────────┼─────────────────────────────┼─────────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────────┼───────────────────────┼────────────────────────────┼────────────────────────────┼────────────────────────────────────┼────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────┼─────────────────────────────────┼───────────────────────┼──────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼────────────────────┤\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 6766 │ 6766 │ 1366 │ 5 │ 1 │ 3486432524 │ 3486432524 │ 0.0029310947547187890 │ 0.0029310947547187890 │ 0.0016644745896522240 │ 0.0016644745896522240 │ 0.0012666201650665650 │ 0.0012666201650665650 │ 0.0012627622421891670 │ 0.0012627622421891670 │ 0.0000038579228773980 │ 0.0000038579228773980 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.00036329977888496914 │ 0.00036219322573906987 │ 0.0 │ 8.188288767636077 │ 1.749725911569594 │ 27064 │ 0 │ 27064 │ 56585.411200000000 │ 686216.515800000000 │ 10825600 │ 676600 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 4132 │ 4132 │ 1361 │ 3 │ 1 │ 1463179017 │ 1463179017 │ 0.0017944371588618550 │ 0.0017944371588618550 │ 0.0010198021012514210 │ 0.0010198021012514210 │ 0.0007746350576104340 │ 0.0007746350576104340 │ 0.0007730079479936740 │ 0.0007730079479936740 │ 0.0000016271096167600 │ 0.0000016271096167600 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0005294191951977904 │ 0.0005283071579160528 │ 0.0 │ 8.18465436287236 │ 1.76898462682423 │ 8264 │ 4132 │ 4132 │ 34556.742400000000 │ 419072.811600000000 │ 6611200 │ 413200 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xca11bde05977b3631167028862be2a173976ca11 │ 1953 │ 1953 │ 1025 │ 14 │ 1 │ 368648954 │ 368648954 │ 0.0017152021180275460 │ 0.0017152021180275460 │ 0.0015446633785242060 │ 0.0015446633785242060 │ 0.0001705387395033400 │ 0.0001705387395033400 │ 0.0001693481029723900 │ 0.0001693481029723900 │ 0.0000003977523406470 │ 0.0000003977523406470 │ 0.0000007956603712990 │ 0.0000007956603712990 │ 0.0004626047019879514 │ 0.00045937497213782957 │ 2.158314468726256e-06 │ 8.150272419802972 │ 1.7415342558618798 │ 2368996 │ 1799132 │ 569864 │ 52768.666254000000 │ 639930.496789125000 │ 10095402 │ 631379 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x802b65b5d9016621e66003aed0b16615093f328b │ 1416 │ 1244 │ 570 │ 29 │ 2 │ 181646841 │ 171429824 │ 0.0108782510554045840 │ 0.0102386569241862050 │ 0.0004951275076615130 │ 0.0004362167537166010 │ 0.0103831235477430710 │ 0.0098024401704696040 │ 0.0103829011191635720 │ 0.0098022311425260160 │ 0.0000002224285794990 │ 0.0000002090279435880 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0571610466253199 │ 0.05715982211418459 │ 0.0 │ 8.171833945862689 │ 1.9660420553473057 │ 283424 │ 200785 │ 82639 │ 15534.450601000000 │ 188387.719382437500 │ 2971963 │ 185984 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x06a8087693b98e068b79f362687c718de6e5b5ae │ 1254 │ 833 │ 433 │ 40 │ 4 │ 243866812 │ 204060353 │ 0.0085534027251148020 │ 0.0059202052600618340 │ 0.0005297215979739630 │ 0.0003522423175452520 │ 0.0080236811271408390 │ 0.0055679629425165820 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000003272555681630 │ 0.0000002742268356520 │ 0.0080233538715726760 │ 0.0055676887156809300 │ 0.03290189862793154 │ 0.0 │ 0.03290055668408326 │ 8.239423478882845 │ 2.107833908320731 │ 179978 │ 57796 │ 122182 │ 15677.633812000000 │ 190124.115426750000 │ 2999356 │ 187582 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 773 │ 773 │ 560 │ 593 │ 3 │ 27282141 │ 27282141 │ 0.0044753602954082940 │ 0.0044753602954082940 │ 0.0002091756264387080 │ 0.0002091756264387080 │ 0.0042661846689695860 │ 0.0042661846689695860 │ 0.0037770245145686980 │ 0.0037770245145686980 │ 0.0000000319845278930 │ 0.0000000319845278930 │ 0.0004891283261214480 │ 0.0004891283261214480 │ 0.156372795997557 │ 0.13844311245839167 │ 0.017928516904939684 │ 8.045102861593637 │ 1.9794536922851642 │ 52660 │ 30871 │ 21789 │ 6466.818265000000 │ 78423.703283437500 │ 1237195 │ 77325 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 645 │ 582 │ 258 │ 22 │ 1 │ 91833326 │ 88720964 │ 0.1301338657302059040 │ 0.1267186651330060110 │ 0.0001795861496755980 │ 0.0001617806061999360 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.0000001239708663080 │ 0.0000001194382884650 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 1.4151102354773724 │ 1.4151102354773724 │ 0.0 │ 8.34974817814926 │ 2.0426825710566794 │ 23220 │ 7212 │ 16008 │ 5394.264000000000 │ 65416.738500000000 │ 1032000 │ 64500 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x8864dedd579cd1d7c36e099adf18465a8ded456d │ 640 │ 189 │ 341 │ 14 │ 4 │ 50096969 │ 30864767 │ 0.0070723659366675420 │ 0.0038263909960486210 │ 0.0001833643481359590 │ 0.0000549551334551500 │ 0.0068890015885315830 │ 0.0037714358625934710 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000678510879360 │ 0.0000000442586674330 │ 0.0068889337374436470 │ 0.0037713916039260380 │ 0.13751334114707783 │ 0.0 │ 0.13751198675200585 │ 8.266924337552002 │ 2.030841530355978 │ 82134 │ 58371 │ 23763 │ 5545.617012000000 │ 67252.210476750000 │ 1060956 │ 66365 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x2b86d9abaf056661ab3d43201211172aa0e0b8c4 │ 562 │ 429 │ 270 │ 21 │ 4 │ 115573680 │ 104304264 │ 0.0018842709429315030 │ 0.0016301632833440710 │ 0.0003077722249904040 │ 0.0002336658955041920 │ 0.0015764987179410990 │ 0.0013964973878398790 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000001519665802760 │ 0.0000001374043068420 │ 0.0015763467513608230 │ 0.0013963599835330370 │ 0.01364063788520967 │ 0.0 │ 0.013639322996038743 │ 8.359806547584222 │ 2.007466056351254 │ 129090 │ 32946 │ 96144 │ 9360.077759000000 │ 113510.528795062500 │ 1790717 │ 111940 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 540 │ 457 │ 431 │ 15 │ 4 │ 118174601 │ 114226587 │ 0.0009009555701843000 │ 0.0008705263939930400 │ 0.0001733808189142260 │ 0.0001510135358454320 │ 0.0007275747512700740 │ 0.0007195128581476080 │ 0.0007268461725643530 │ 0.0007187874416905200 │ 0.0000000965964031140 │ 0.0000000934341544810 │ 0.0000006319833258710 │ 0.0000006319833258710 │ 0.006156777726459801 │ 0.006150612453215331 │ 5.347877805578545e-06 │ 7.875161467080705 │ 1.4186915815533334 │ 228688 │ 196058 │ 32630 │ 6869.098639000000 │ 83302.194590062500 │ 1314157 │ 82155 │\n", + "├────────────┴─────────┴──────────┴─────────┴────────────────────────────────────────────┴────────────────────┴────────────────────────────┴─────────────────────┴─────────────────────────────┴─────────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────────┴───────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────────────┴────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────┴─────────────────────────────────┴───────────────────────┴──────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────────────────┤\n", + "│ 10 rows 36 columns │\n", + "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "duckdb_client.sql(\"SELECT * FROM daily_transactions_tx_to_v1 ORDER BY count_transactions DESC LIMIT 10\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "┌────────────┬─────────┬──────────┬─────────┬────────────────────────────────────────────┬────────────────────┬────────────────────────────┬─────────────────────┬─────────────────────────────┬─────────────────────────┬─────────────────┬─────────────────────────┬───────────────────────┬───────────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬───────────────────────┬────────────────────────┬────────────────────────────────┬───────────────────────┬────────────────────────────┬────────────────────────────┬────────────────────────────────────┬────────────────────────┬────────────────────────────────┬────────────────────────────────────┬────────────────────────────┬─────────────────────────────────┬───────────────────────┬──────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────────────────┐\n", + "│ dt │ chain │ chain_id │ network │ to_address │ count_transactions │ count_transactions_success │ count_unique_blocks │ count_unique_from_addresses │ count_unique_method_ids │ sum_l2_gas_used │ sum_l2_gas_used_success │ sum_tx_fee_native │ sum_tx_fee_native_success │ l1_fee_native │ l1_fee_native_success │ l2_fee_native │ l2_fee_native_success │ l2_priority_fee_native │ l2_priority_fee_native_success │ l2_base_fee_native │ l2_base_fee_native_success │ l2_legacy_extra_fee_native │ l2_legacy_extra_fee_native_success │ avg_l2_gas_price_gwei │ avg_l2_priority_gas_price_gwei │ avg_l2_legacy_extra_gas_price_gwei │ avg_l1_base_gas_price_gwei │ avg_l1_blob_base_gas_price_gwei │ sum_input_byte_length │ sum_input_zero_bytes │ sum_input_nonzero_bytes │ sum_l1_base_scaled_size │ sum_l1_blob_scaled_size │ sum_l1_gas_used_unified │ sum_estimated_size │\n", + "│ date │ varchar │ int32 │ varchar │ varchar │ int64 │ int64 │ int64 │ int64 │ int64 │ decimal(38,0) │ decimal(38,0) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ decimal(38,19) │ double │ double │ double │ double │ double │ decimal(38,0) │ decimal(38,0) │ decimal(38,0) │ decimal(38,12) │ decimal(38,12) │ decimal(38,0) │ decimal(38,0) │\n", + "├────────────┼─────────┼──────────┼─────────┼────────────────────────────────────────────┼────────────────────┼────────────────────────────┼─────────────────────┼─────────────────────────────┼─────────────────────────┼─────────────────┼─────────────────────────┼───────────────────────┼───────────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼───────────────────────┼────────────────────────┼────────────────────────────────┼───────────────────────┼────────────────────────────┼────────────────────────────┼────────────────────────────────────┼────────────────────────┼────────────────────────────────┼────────────────────────────────────┼────────────────────────────┼─────────────────────────────────┼───────────────────────┼──────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼─────────────────────────┼────────────────────┤\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xabf4daac18925530d1e4f99fd538d57b8bf1017c │ 6766 │ 6766 │ 1366 │ 5 │ 1 │ 3486432524 │ 3486432524 │ 0.0029310947547187890 │ 0.0029310947547187890 │ 0.0016644745896522240 │ 0.0016644745896522240 │ 0.0012666201650665650 │ 0.0012666201650665650 │ 0.0012627622421891670 │ 0.0012627622421891670 │ 0.0000038579228773980 │ 0.0000038579228773980 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.00036329977888496914 │ 0.00036219322573906987 │ 0.0 │ 8.188288767636077 │ 1.749725911569594 │ 27064 │ 0 │ 27064 │ 56585.411200000000 │ 686216.515800000000 │ 10825600 │ 676600 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xd3dc079ac6f98275bbbcd0aff11cbaadb4d8f2ac │ 4132 │ 4132 │ 1361 │ 3 │ 1 │ 1463179017 │ 1463179017 │ 0.0017944371588618550 │ 0.0017944371588618550 │ 0.0010198021012514210 │ 0.0010198021012514210 │ 0.0007746350576104340 │ 0.0007746350576104340 │ 0.0007730079479936740 │ 0.0007730079479936740 │ 0.0000016271096167600 │ 0.0000016271096167600 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0005294191951977904 │ 0.0005283071579160528 │ 0.0 │ 8.18465436287236 │ 1.76898462682423 │ 8264 │ 4132 │ 4132 │ 34556.742400000000 │ 419072.811600000000 │ 6611200 │ 413200 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0xca11bde05977b3631167028862be2a173976ca11 │ 1953 │ 1953 │ 1025 │ 14 │ 1 │ 368648954 │ 368648954 │ 0.0017152021180275460 │ 0.0017152021180275460 │ 0.0015446633785242060 │ 0.0015446633785242060 │ 0.0001705387395033400 │ 0.0001705387395033400 │ 0.0001693481029723900 │ 0.0001693481029723900 │ 0.0000003977523406470 │ 0.0000003977523406470 │ 0.0000007956603712990 │ 0.0000007956603712990 │ 0.0004626047019879514 │ 0.00045937497213782957 │ 2.158314468726256e-06 │ 8.150272419802972 │ 1.7415342558618798 │ 2368996 │ 1799132 │ 569864 │ 52768.666254000000 │ 639930.496789125000 │ 10095402 │ 631379 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x802b65b5d9016621e66003aed0b16615093f328b │ 1416 │ 1244 │ 570 │ 29 │ 2 │ 181646841 │ 171429824 │ 0.0108782510554045840 │ 0.0102386569241862050 │ 0.0004951275076615130 │ 0.0004362167537166010 │ 0.0103831235477430710 │ 0.0098024401704696040 │ 0.0103829011191635720 │ 0.0098022311425260160 │ 0.0000002224285794990 │ 0.0000002090279435880 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0571610466253199 │ 0.05715982211418459 │ 0.0 │ 8.171833945862689 │ 1.9660420553473057 │ 283424 │ 200785 │ 82639 │ 15534.450601000000 │ 188387.719382437500 │ 2971963 │ 185984 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x06a8087693b98e068b79f362687c718de6e5b5ae │ 1254 │ 833 │ 433 │ 40 │ 4 │ 243866812 │ 204060353 │ 0.0085534027251148020 │ 0.0059202052600618340 │ 0.0005297215979739630 │ 0.0003522423175452520 │ 0.0080236811271408390 │ 0.0055679629425165820 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000003272555681630 │ 0.0000002742268356520 │ 0.0080233538715726760 │ 0.0055676887156809300 │ 0.03290189862793154 │ 0.0 │ 0.03290055668408326 │ 8.239423478882845 │ 2.107833908320731 │ 179978 │ 57796 │ 122182 │ 15677.633812000000 │ 190124.115426750000 │ 2999356 │ 187582 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 │ 773 │ 773 │ 560 │ 593 │ 3 │ 27282141 │ 27282141 │ 0.0044753602954082940 │ 0.0044753602954082940 │ 0.0002091756264387080 │ 0.0002091756264387080 │ 0.0042661846689695860 │ 0.0042661846689695860 │ 0.0037770245145686980 │ 0.0037770245145686980 │ 0.0000000319845278930 │ 0.0000000319845278930 │ 0.0004891283261214480 │ 0.0004891283261214480 │ 0.156372795997557 │ 0.13844311245839167 │ 0.017928516904939684 │ 8.045102861593637 │ 1.9794536922851642 │ 52660 │ 30871 │ 21789 │ 6466.818265000000 │ 78423.703283437500 │ 1237195 │ 77325 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x6f1fe5b048de0417c4e838b1fc4245aaf254f1dc │ 645 │ 582 │ 258 │ 22 │ 1 │ 91833326 │ 88720964 │ 0.1301338657302059040 │ 0.1267186651330060110 │ 0.0001795861496755980 │ 0.0001617806061999360 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.1299542795805303060 │ 0.1265568845268060750 │ 0.0000001239708663080 │ 0.0000001194382884650 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 1.4151102354773724 │ 1.4151102354773724 │ 0.0 │ 8.34974817814926 │ 2.0426825710566794 │ 23220 │ 7212 │ 16008 │ 5394.264000000000 │ 65416.738500000000 │ 1032000 │ 64500 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x8864dedd579cd1d7c36e099adf18465a8ded456d │ 640 │ 189 │ 341 │ 14 │ 4 │ 50096969 │ 30864767 │ 0.0070723659366675420 │ 0.0038263909960486210 │ 0.0001833643481359590 │ 0.0000549551334551500 │ 0.0068890015885315830 │ 0.0037714358625934710 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000000678510879360 │ 0.0000000442586674330 │ 0.0068889337374436470 │ 0.0037713916039260380 │ 0.13751334114707783 │ 0.0 │ 0.13751198675200585 │ 8.266924337552002 │ 2.030841530355978 │ 82134 │ 58371 │ 23763 │ 5545.617012000000 │ 67252.210476750000 │ 1060956 │ 66365 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x2b86d9abaf056661ab3d43201211172aa0e0b8c4 │ 562 │ 429 │ 270 │ 21 │ 4 │ 115573680 │ 104304264 │ 0.0018842709429315030 │ 0.0016301632833440710 │ 0.0003077722249904040 │ 0.0002336658955041920 │ 0.0015764987179410990 │ 0.0013964973878398790 │ 0.0000000000000000000 │ 0.0000000000000000000 │ 0.0000001519665802760 │ 0.0000001374043068420 │ 0.0015763467513608230 │ 0.0013963599835330370 │ 0.01364063788520967 │ 0.0 │ 0.013639322996038743 │ 8.359806547584222 │ 2.007466056351254 │ 129090 │ 32946 │ 96144 │ 9360.077759000000 │ 113510.528795062500 │ 1790717 │ 111940 │\n", + "│ 2024-11-18 │ op │ 10 │ mainnet │ 0x416b433906b1b72fa758e166e239c43d68dc6f29 │ 540 │ 457 │ 431 │ 15 │ 4 │ 118174601 │ 114226587 │ 0.0009009555701843000 │ 0.0008705263939930400 │ 0.0001733808189142260 │ 0.0001510135358454320 │ 0.0007275747512700740 │ 0.0007195128581476080 │ 0.0007268461725643530 │ 0.0007187874416905200 │ 0.0000000965964031140 │ 0.0000000934341544810 │ 0.0000006319833258710 │ 0.0000006319833258710 │ 0.006156777726459801 │ 0.006150612453215331 │ 5.347877805578545e-06 │ 7.875161467080705 │ 1.4186915815533334 │ 228688 │ 196058 │ 32630 │ 6869.098639000000 │ 83302.194590062500 │ 1314157 │ 82155 │\n", + "├────────────┴─────────┴──────────┴─────────┴────────────────────────────────────────────┴────────────────────┴────────────────────────────┴─────────────────────┴─────────────────────────────┴─────────────────────────┴─────────────────┴─────────────────────────┴───────────────────────┴───────────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴───────────────────────┴────────────────────────┴────────────────────────────────┴───────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────────────┴────────────────────────┴────────────────────────────────┴────────────────────────────────────┴────────────────────────────┴─────────────────────────────────┴───────────────────────┴──────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────────────────┤\n", + "│ 10 rows 36 columns │\n", + "└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Check System tx identification\n", + "duckdb_client.sql(\"SELECT * FROM daily_transactions_tx_to_v1 ORDER BY count_transactions DESC LIMIT 10\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Check the data output size" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "┌──────────┬─────────┬─────────┐\n", + "│ num_rows │ num_tos │ num_txs │\n", + "│ int64 │ int64 │ int128 │\n", + "├──────────┼─────────┼─────────┤\n", + "│ 5885 │ 1374 │ 31773 │\n", + "└──────────┴─────────┴─────────┘" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_tx_from_tx_to_method_v1\")" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "┌──────────┬─────────┬─────────┐\n", + "│ num_rows │ num_tos │ num_txs │\n", + "│ int64 │ int64 │ int128 │\n", + "├──────────┼─────────┼─────────┤\n", + "│ 2327 │ 1374 │ 31773 │\n", + "└──────────┴─────────┴─────────┘" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_tx_to_method_v1\")" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "┌──────────┬─────────┬─────────┐\n", + "│ num_rows │ num_tos │ num_txs │\n", + "│ int64 │ int64 │ int128 │\n", + "├──────────┼─────────┼─────────┤\n", + "│ 1374 │ 1374 │ 31773 │\n", + "└──────────┴─────────┴─────────┘" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "duckdb_client.sql(\"SELECT COUNT(*) AS num_rows, COUNT(DISTINCT to_address) AS num_tos, SUM(count_transactions) AS num_txs FROM daily_transactions_tx_to_v1\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Get table schema" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "┌────────────────────────────────────┬────────────────┬─────────┬─────────┬─────────┬─────────┐\n", + "│ column_name │ column_type │ null │ key │ default │ extra │\n", + "│ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │\n", + "├────────────────────────────────────┼────────────────┼─────────┼─────────┼─────────┼─────────┤\n", + "│ dt │ DATE │ YES │ NULL │ NULL │ NULL │\n", + "│ chain │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ chain_id │ INTEGER │ YES │ NULL │ NULL │ NULL │\n", + "│ network │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ to_address │ VARCHAR │ YES │ NULL │ NULL │ NULL │\n", + "│ count_transactions │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ count_transactions_success │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ count_unique_blocks │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ count_unique_from_addresses │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ count_unique_method_ids │ BIGINT │ YES │ NULL │ NULL │ NULL │\n", + "│ · │ · │ · │ · │ · │ · │\n", + "│ · │ · │ · │ · │ · │ · │\n", + "│ · │ · │ · │ · │ · │ · │\n", + "│ avg_l2_legacy_extra_gas_price_gwei │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n", + "│ avg_l1_base_gas_price_gwei │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n", + "│ avg_l1_blob_base_gas_price_gwei │ DOUBLE │ YES │ NULL │ NULL │ NULL │\n", + "│ sum_input_byte_length │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n", + "│ sum_input_zero_bytes │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n", + "│ sum_input_nonzero_bytes │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n", + "│ sum_l1_base_scaled_size │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n", + "│ sum_l1_blob_scaled_size │ DECIMAL(38,12) │ YES │ NULL │ NULL │ NULL │\n", + "│ sum_l1_gas_used_unified │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n", + "│ sum_estimated_size │ DECIMAL(38,0) │ YES │ NULL │ NULL │ NULL │\n", + "├────────────────────────────────────┴────────────────┴─────────┴─────────┴─────────┴─────────┤\n", + "│ 36 rows (20 shown) 6 columns │\n", + "└─────────────────────────────────────────────────────────────────────────────────────────────┘" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "duckdb_client.sql(\"DESCRIBE daily_transactions_tx_to_v1\")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/src/op_analytics/datapipeline/models/code/daily_address_summary_old.py b/src/op_analytics/datapipeline/models/code/daily_address_summary_old.py new file mode 100644 index 00000000000..25f8f38aed3 --- /dev/null +++ b/src/op_analytics/datapipeline/models/code/daily_address_summary_old.py @@ -0,0 +1,21 @@ +# import duckdb + +# from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery +# from op_analytics.datapipeline.models.compute.registry import register_model +# from op_analytics.datapipeline.models.compute.types import NamedRelations + + +# @register_model( +# input_datasets=["intermediate/refined_transactions_fees_v1"], +# expected_outputs=["summary_v1"], +# auxiliary_views=[ +# TemplatedSQLQuery( +# template_name="daily_address_summary", +# context={}, +# ), +# ], +# ) +# def daily_address_summary_old(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations: +# return { +# "summary_v1": duckdb_client.view("daily_address_summary"), +# } diff --git a/src/op_analytics/datapipeline/models/code/daily_transactions_fees_by_to.py b/src/op_analytics/datapipeline/models/code/daily_transactions_fees_by_to.py new file mode 100644 index 00000000000..343dfd39765 --- /dev/null +++ b/src/op_analytics/datapipeline/models/code/daily_transactions_fees_by_to.py @@ -0,0 +1,26 @@ +import duckdb + +from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery +from op_analytics.datapipeline.models.compute.registry import register_model +from op_analytics.datapipeline.models.compute.types import NamedRelations + + +@register_model( + input_datasets=["intermediate/enriched_transactions_v1"], + expected_outputs=["daily_transactions_fees_by_to_v1"], + # TODO: Uncomment if we do this as a view (or some element as a view) + # auxiliary_views=[ + # TemplatedSQLQuery( + # template_name="daily_transactions_fees_by_to", + # context={}, + # ), + # ], +) +def daily_transactions_fees_by_to(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations: + return { + "daily_transactions_fees_by_to_v1": duckdb_client.view( + """ + TODO: AGGREGATION CODE + """ + ), + } diff --git a/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py b/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py new file mode 100644 index 00000000000..b5e156333f9 --- /dev/null +++ b/src/op_analytics/datapipeline/models/code/event_emitting_transactions.py @@ -0,0 +1,31 @@ +# # TO DEPRECATE? + +# import duckdb + +# from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery +# from op_analytics.datapipeline.models.compute.registry import register_model +# from op_analytics.datapipeline.models.compute.types import NamedRelations + + +# @register_model( +# input_datasets=["ingestion/logs_v1", "ingestion/transactions_v1", "ingestion/blocks_v1"], +# expected_outputs=["event_emitting_transactions_v1"], +# auxiliary_views=[ +# TemplatedSQLQuery( +# template_name="refined_transactions_fees", +# context={}, +# ), +# TemplatedSQLQuery( +# template_name="logs_topic0_filters", +# context={}, +# ), +# TemplatedSQLQuery( +# template_name="event_emitting_transactions", +# context={}, +# ), +# ], +# ) +# def event_emitting_transactions(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations: +# return { +# "event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"), +# } diff --git a/src/op_analytics/datapipeline/models/code/refined_trace_calls.py b/src/op_analytics/datapipeline/models/code/refined_trace_calls.py new file mode 100644 index 00000000000..e3db8c4185c --- /dev/null +++ b/src/op_analytics/datapipeline/models/code/refined_trace_calls.py @@ -0,0 +1,21 @@ +# import duckdb + +# from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery +# from op_analytics.datapipeline.models.compute.registry import register_model +# from op_analytics.datapipeline.models.compute.types import NamedRelations + + +# @register_model( +# input_datasets=["ingestion/traces_v1", "refined_transactions_fees_v1"], +# expected_outputs=["refined_trace_calls_v1"], +# auxiliary_views=[ +# TemplatedSQLQuery( +# template_name="refined_trace_calls", +# context={}, +# ), +# ], +# ) +# def refined_trace_calls(duckdb_client: duckdb.DuckDBPyConnection) -> NamedRelations: +# return { +# "refined_trace_calls_v1": duckdb_client.view("refined_trace_calls"), +# } diff --git a/src/op_analytics/datapipeline/models/code/refined_traces.py b/src/op_analytics/datapipeline/models/code/refined_traces.py index 0adb7355f28..c636ef5e958 100644 --- a/src/op_analytics/datapipeline/models/code/refined_traces.py +++ b/src/op_analytics/datapipeline/models/code/refined_traces.py @@ -1,5 +1,5 @@ -from op_analytics.coreutils.duckdb_inmem.client import DuckDBContext -from op_analytics.datapipeline.models.compute.model import AuxiliaryView, ParquetData +from op_analytics.coreutils.duckdb_inmem.client import DuckDBContext, ParquetData +from op_analytics.datapipeline.models.compute.model import AuxiliaryView from op_analytics.datapipeline.models.compute.registry import register_model from op_analytics.datapipeline.models.compute.types import NamedRelations @@ -10,12 +10,15 @@ "ingestion/traces_v1", "ingestion/transactions_v1", ], - expected_outputs=[ - "create_traces_v1", - ], auxiliary_views=[ "refined_transactions_fees", - "refined_traces_fees", + "refined_traces/traces_projection", + "refined_traces/traces_amortized", + "refined_traces/traces_txs_join", + ], + expected_outputs=[ + "refined_transactions_fees_v1", + "refined_traces_fees_v1", ], ) def refined_traces( @@ -23,5 +26,47 @@ def refined_traces( input_datasets: dict[str, ParquetData], auxiliary_views: dict[str, AuxiliaryView], ) -> NamedRelations: - # Not implemented yet. - return {} + refined_txs = auxiliary_views["refined_transactions_fees"].create_table( + duckdb_context=ctx, + template_parameters={ + "raw_blocks": input_datasets["ingestion/blocks_v1"].as_subquery(), + "raw_transactions": input_datasets["ingestion/transactions_v1"].as_subquery(), + }, + ) + + refined_traces_projection = auxiliary_views["refined_traces/traces_projection"].create_table( + duckdb_context=ctx, + template_parameters={ + "raw_traces": input_datasets["ingestion/traces_v1"].as_subquery(), + }, + ) + + traces_amortized = auxiliary_views["refined_traces/traces_amortized"].create_table( + duckdb_context=ctx, + template_parameters={ + "refined_traces_projection": refined_traces_projection, + }, + ) + + traces_txs_join = auxiliary_views["refined_traces/traces_txs_join"].create_table( + duckdb_context=ctx, + template_parameters={ + "traces_amortized": traces_amortized, + "refined_transactions_fees": refined_txs, + }, + ) + + ctx.client.sql(f"DROP TABLE {refined_traces_projection}") + ctx.client.sql(f"DROP TABLE {traces_amortized}") + + return { + "refined_transactions_fees_v1": refined_txs, + "refined_traces_fees_v1": traces_txs_join, + # Also included in Michael's original implementation. + # "aggregated_traces_tr_from_tr_to_hash_v1": duckdb_client.view( + # "aggregated_traces_tr_from_tr_to_hash" + # ), + # "aggregated_traces_tr_to_hash_v1": duckdb_client.view("aggregated_traces_tr_to_hash"), + # "daily_traces_tr_to_tx_to_v1": duckdb_client.view("daily_traces_tr_to_tx_to"), + # "daily_traces_tr_to_v1": duckdb_client.view("daily_traces_tr_to"), + } diff --git a/src/op_analytics/datapipeline/models/code/refined_traces_models.py b/src/op_analytics/datapipeline/models/code/refined_traces_models.py new file mode 100644 index 00000000000..67bb788d428 --- /dev/null +++ b/src/op_analytics/datapipeline/models/code/refined_traces_models.py @@ -0,0 +1,58 @@ +import duckdb + +from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery +from op_analytics.datapipeline.models.compute.registry import register_model +from op_analytics.datapipeline.models.compute.types import NamedRelations + + +@register_model( + input_datasets=[ + "ingestion/transactions_v1", + "ingestion/blocks_v1", + "ingestion/traces_v1", + ], + expected_outputs=[ + "refined_traces_fees_v1", + "refined_traces_fees_tr_from_tr_to_hash_v1", + "daily_traces_tr_to_tx_to_v1", + "daily_traces_to_v1", + ], + auxiliary_views=[ + TemplatedSQLQuery( + template_name="refined_transactions_fees", + context={}, + ), + TemplatedSQLQuery( + template_name="refined_traces_fees", + context={}, + ), + TemplatedSQLQuery( + template_name="aggregated_traces_tr_from_tr_to_hash", + context={}, + ), + TemplatedSQLQuery( + template_name="aggregated_traces_tr_to_hash", + context={}, + ), + TemplatedSQLQuery( + template_name="daily_traces_tr_to_tx_to", + context={}, + ), + TemplatedSQLQuery( + template_name="daily_traces_tr_to", + context={}, + ), + ], +) +def refined_traces_models( + duckdb_client: duckdb.DuckDBPyConnection, +) -> NamedRelations: + return { + "refined_traces_fees_v1": duckdb_client.view("refined_traces_fees"), + "aggregated_traces_tr_from_tr_to_hash_v1": duckdb_client.view( + "aggregated_traces_tr_from_tr_to_hash" + ), + "aggregated_traces_tr_to_hash_v1": duckdb_client.view("aggregated_traces_tr_to_hash"), + "daily_traces_tr_to_tx_to_v1": duckdb_client.view("daily_traces_tr_to_tx_to"), + "daily_traces_tr_to_v1": duckdb_client.view("daily_traces_tr_to"), + } diff --git a/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py b/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py new file mode 100644 index 00000000000..0ea35566c02 --- /dev/null +++ b/src/op_analytics/datapipeline/models/code/refined_transactions_addresses_models.py @@ -0,0 +1,65 @@ +import duckdb + +from op_analytics.datapipeline.models.compute.querybuilder import TemplatedSQLQuery +from op_analytics.datapipeline.models.compute.registry import register_model +from op_analytics.datapipeline.models.compute.types import NamedRelations + + +@register_model( + input_datasets=[ + "ingestion/transactions_v1", + "ingestion/blocks_v1", + "ingestion/logs_v1", + ], + expected_outputs=[ + "refined_transactions_fees_v1", + "event_emitting_transactions_v1", + "summary_v1", + "daily_transactions_tx_from_tx_to_method_v1", + "daily_transactions_tx_to_method_v1", + "daily_transactions_tx_to_v1", + ], + auxiliary_views=[ + TemplatedSQLQuery( + template_name="refined_transactions_fees", + context={}, + ), + TemplatedSQLQuery( + template_name="logs_topic0_filters", + context={}, + ), + TemplatedSQLQuery( + template_name="event_emitting_transactions", + context={}, + ), + TemplatedSQLQuery( + template_name="daily_address_summary", + context={}, + ), + TemplatedSQLQuery( + template_name="daily_transactions_tx_from_tx_to_method", + context={}, + ), + TemplatedSQLQuery( + template_name="daily_transactions_tx_to_method", + context={}, + ), + TemplatedSQLQuery( + template_name="daily_transactions_tx_to", + context={}, + ), + ], +) +def refined_transactions_addresses_models( + duckdb_client: duckdb.DuckDBPyConnection, +) -> NamedRelations: + return { + "refined_transactions_fees_v1": duckdb_client.view("refined_transactions_fees"), + "event_emitting_transactions_v1": duckdb_client.view("event_emitting_transactions"), + "summary_v1": duckdb_client.view("daily_address_summary"), + "daily_transactions_tx_from_tx_to_method_v1": duckdb_client.view( + "daily_transactions_tx_from_tx_to_method" + ), + "daily_transactions_tx_to_method_v1": duckdb_client.view("daily_transactions_tx_to_method"), + "daily_transactions_tx_to_v1": duckdb_client.view("daily_transactions_tx_to"), + } diff --git a/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_from_tr_to_hash.sql.j2 b/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_from_tr_to_hash.sql.j2 new file mode 100644 index 00000000000..43ab1df0cb3 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_from_tr_to_hash.sql.j2 @@ -0,0 +1,91 @@ +-- NOTE: May not materialize this for now. We expect to use the to/from/method as our most granular in practice + +/* + Aggregate Trace Calls by day at the trace from/to and transaction hash level. + This is our most granular aggregation of traces, and comes enriched with transaction and trace gas fields. + + Use cases include: + - Reducing table size for a better query and model-building experience than raw traces. + - Investigating specific transactions to see where the internal gas usage comes from. + - Investigating specific to / from combinations to evaluate what top-level user actions call them. +*/ + +SELECT + -- Descriptors + dt, chain, network, chain_id + , trace_from_address, trace_to_address, trace_type + , block_timestamp, block_number + , tx_from_address, tx_to_address, transaction_hash, tx_method_id + -- Transaction-Level gas & fees + , tx_l2_gas_used + , tx_fee_native, tx_l1_fee_native, tx_l2_fee_native + , tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native + -- Transaction-Level Gas Prices + , tx_l2_gas_price_gwei, tx_l2_base_gas_price_gwei, tx_l2_priority_gas_price_gwei, tx_l2_legacy_extra_gas_price_gwei + , tx_l1_base_gas_price_gwei, tx_l1_blob_base_gas_price_gwei + -- Transaction-Level transaction sizes + , tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes + , tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size + -- Attributes + , tx_success + , is_system_transaction + + -- Sum Internal Trace Gas + , SUM(trace_gas_used) AS sum_trace_gas_used + , SUM(trace_gas_used_minus_subtraces) AS sum_trace_gas_used_minus_subtraces + + , SUM(tx_l2_fee_native_minus_subtraces) AS sum_tx_l2_fee_native_minus_subtraces + , SUM(tx_l2_base_fee_native_minus_subtraces) AS sum_tx_l2_base_fee_native_minus_subtraces + , SUM(tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces + , SUM(tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces + + , SUM(tx_l2_gas_used_amortized_by_call) AS sum_tx_l2_gas_used_amortized_by_call + , SUM(tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call + , SUM(tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call + , SUM(tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call + , SUM(tx_estimated_size_amortized_by_call) AS sum_tx_estimated_size_amortized_by_call + + , SUM(tx_fee_native_amortized_by_call) AS sum_tx_fee_native_amortized_by_call + , SUM(tx_l2_fee_native_amortized_by_call) AS sum_tx_l2_fee_native_amortized_by_call + , SUM(tx_l1_fee_native_amortized_by_call) AS sum_tx_l1_fee_native_amortized_by_call + , SUM(tx_l2_base_fee_native_amortized_by_call) AS sum_tx_l2_base_fee_native_amortized_by_call + , SUM(tx_l2_priority_fee_native_amortized_by_call) AS sum_tx_l2_priority_fee_native_amortized_by_call + + , SUM(tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces + + -- Count Call Types + , COUNT(*) FILTER (WHERE trace_address = '' AND call_type != '') AS count_top_level_calls + --count non-null trace addresses, null is the transaction-level call. + , COUNT(*) FILTER (WHERE trace_address != '' AND call_type != '') AS count_internal_calls_all_types + , COUNT(*) FILTER (WHERE trace_address != '' AND call_type != '' AND trace_success) AS count_internal_calls_all_types_trace_success + --static calls only read state, and can not write + , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'staticcall') AS count_internal_calls_static_type + , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'staticcall' AND trace_success) AS count_internal_calls_static_type_trace_success + --delegate calls call a function on another contract + , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'delegatecall') AS count_internal_calls_delegate_type + , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'delegatecall' AND trace_success) AS count_internal_calls_delegate_type_trace_success + --normal function calls + , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'call') AS count_internal_calls_call_type + , COUNT(*) FILTER (WHERE trace_address != '' AND call_type = 'call' AND trace_success) AS count_internal_calls_call_type_trace_success + +FROM refined_traces_fees + +GROUP BY + -- Descriptors + dt, chain, network, chain_id + , trace_from_address, trace_to_address, trace_type + , block_timestamp, block_number + , tx_from_address, tx_to_address, transaction_hash, tx_method_id + -- Transaction-Level gas & fees + , tx_l2_gas_used + , tx_fee_native, tx_l1_fee_native, tx_l2_fee_native + , tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native + -- Transaction-Level Gas Prices + , tx_l2_gas_price_gwei, tx_l2_base_gas_price_gwei, tx_l2_priority_gas_price_gwei, tx_l2_legacy_extra_gas_price_gwei + , tx_l1_base_gas_price_gwei, tx_l1_blob_base_gas_price_gwei + -- Transaction-Level transaction sizes + , tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes + , tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size + -- Attributes + , tx_success + , is_system_transaction diff --git a/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_to_hash.sql.j2 b/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_to_hash.sql.j2 new file mode 100644 index 00000000000..c7703c1ec2f --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/aggregated_traces_tr_to_hash.sql.j2 @@ -0,0 +1,110 @@ +-- Base-Level Aggregation view to generate unique transaction & to combinations before we aggregate up + +WITH get_transactions_by_call_type AS ( +-- Tag Transactions by internal call types +SELECT dt, chain_id, block_number, transaction_hash + , SUM(count_internal_calls_call_type) > 0 AS is_transaction_with_internal_call_type_call + , SUM(coalesce(count_internal_calls_call_type,0)+coalesce(count_internal_calls_delegate_type,0)) > 0 AS is_transaction_with_internal_call_type_call_or_delegate + FROM aggregated_traces_tr_from_tr_to_hash + GROUP BY + dt, chain_id, block_number, transaction_hash + +) + +, raw_aggregation AS ( +SELECT +dt, chain, network, chain_id, + trace_to_address, transaction_hash, block_timestamp, block_number, + tx_from_address, tx_to_address, tx_method_id +-- Transaction-Level gas & fees + , tx_l2_gas_used + , tx_fee_native, tx_l1_fee_native, tx_l2_fee_native + , tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native + -- Transaction-Level Gas Prices + , tx_l2_gas_price_gwei, tx_l2_base_gas_price_gwei, tx_l2_priority_gas_price_gwei, tx_l2_legacy_extra_gas_price_gwei + , tx_l1_base_gas_price_gwei, tx_l1_blob_base_gas_price_gwei + -- Transaction-Level transaction sizes + , tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes + , tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size + -- Attributes + , tx_success + , is_system_transaction + +-- Sum Internal Trace Gas + , SUM(sum_trace_gas_used) AS sum_trace_gas_used + , SUM(sum_trace_gas_used_minus_subtraces) AS sum_trace_gas_used_minus_subtraces + , SUM(sum_tx_l2_fee_native_minus_subtraces) AS sum_tx_l2_fee_native_minus_subtraces + , SUM(sum_tx_l2_base_fee_native_minus_subtraces) AS sum_tx_l2_base_fee_native_minus_subtraces + , SUM(sum_tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces + , SUM(sum_tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces + + , SUM(sum_tx_l2_gas_used_amortized_by_call) AS sum_tx_l2_gas_used_amortized_by_call + , SUM(sum_tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call + , SUM(sum_tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call + , SUM(sum_tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call + , SUM(sum_tx_estimated_size_amortized_by_call) AS sum_tx_estimated_size_amortized_by_call + + , SUM(sum_tx_fee_native_amortized_by_call) AS sum_tx_fee_native_amortized_by_call + , SUM(sum_tx_l2_fee_native_amortized_by_call) AS sum_tx_l2_fee_native_amortized_by_call + , SUM(sum_tx_l1_fee_native_amortized_by_call) AS sum_tx_l1_fee_native_amortized_by_call + , SUM(sum_tx_l2_base_fee_native_amortized_by_call) AS sum_tx_l2_base_fee_native_amortized_by_call + , SUM(sum_tx_l2_priority_fee_native_amortized_by_call) AS sum_tx_l2_priority_fee_native_amortized_by_call + + , SUM(sum_tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces + + -- Calls + , SUM(count_top_level_calls) AS count_top_level_calls + --count non-null trace addresses, null is the transaction-level call. + , SUM(count_internal_calls_all_types) AS count_internal_calls_all_types + , SUM(count_internal_calls_all_types_trace_success) AS count_internal_calls_all_types_trace_success + --static calls only read state, and can not write + , SUM(count_internal_calls_static_type) AS count_internal_calls_static_type + , SUM(count_internal_calls_static_type_trace_success) AS count_internal_calls_static_type_trace_success + --delegate calls call a function on another contract + , SUM(count_internal_calls_delegate_type) AS count_internal_calls_delegate_type + , SUM(count_internal_calls_delegate_type_trace_success) AS count_internal_calls_delegate_type_trace_success + --normal function calls + , SUM(count_internal_calls_call_type) AS count_internal_calls_call_type + , SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success + + --count by trace type + ,COUNT(*) AS count_traces_type_all_types + ,COUNT(*) FILTER (WHERE trace_type = 'call') AS count_traces_trace_type_call + ,COUNT(*) FILTER (WHERE trace_type = 'suicide') AS count_traces_trace_type_suicide + ,COUNT(*) FILTER (WHERE trace_type = 'create') AS count_traces_trace_type_create + ,COUNT(*) FILTER (WHERE trace_type = 'create2') AS count_traces_trace_type_create2 + ,COUNT(*) FILTER (WHERE trace_type LIKE 'create%') AS count_traces_trace_type_create_any + +FROM aggregated_traces_tr_from_tr_to_hash + +GROUP BY +dt, chain, network, chain_id, + trace_to_address, transaction_hash, block_timestamp, block_number, + tx_from_address, tx_to_address, tx_method_id +-- Transaction-Level gas & fees + , tx_l2_gas_used + , tx_fee_native, tx_l1_fee_native, tx_l2_fee_native + , tx_l2_priority_fee_native, tx_l2_base_fee_native, tx_l2_legacy_extra_fee_native + -- Transaction-Level Gas Prices + , tx_l2_gas_price_gwei, tx_l2_base_gas_price_gwei, tx_l2_priority_gas_price_gwei, tx_l2_legacy_extra_gas_price_gwei + , tx_l1_base_gas_price_gwei, tx_l1_blob_base_gas_price_gwei + -- Transaction-Level transaction sizes + , tx_input_byte_length, tx_input_zero_bytes, tx_input_nonzero_bytes + , tx_l1_base_scaled_size, tx_l1_blob_scaled_size, tx_l1_gas_used_unified, tx_estimated_size + -- Attributes + , tx_success + , is_system_transaction + +) + +SELECT +ra.*, + gt.is_transaction_with_internal_call_type_call, + gt.is_transaction_with_internal_call_type_call_or_delegate + +FROM raw_aggregation AS ra + LEFT JOIN get_transactions_by_call_type AS gt + ON ra.dt = gt.dt + AND ra.chain_id = gt.chain_id + AND ra.block_number = gt.block_number + AND ra.transaction_hash = gt.transaction_hash diff --git a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 index 366a21c7760..f657c6401c0 100644 --- a/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 +++ b/src/op_analytics/datapipeline/models/templates/daily_address_summary.sql.j2 @@ -2,6 +2,7 @@ SELECT dt , chain , chain_id + , network , from_address AS address -- Aggregates @@ -43,9 +44,9 @@ SELECT , sum(if(success, l2_gas_used, 0)) AS success_l2_gas_used_sum - , sum(l1_gas_used_unified) AS l1_gas_used_sum + , sum(l1_gas_used_unified) AS l1_gas_used_unified_sum - , sum(if(success, l1_gas_used_unified, 0)) AS success_l1_gas_used_sum + , sum(if(success, l1_gas_used_unified, 0)) AS success_l1_gas_used_unified_sum , wei_to_eth(sum(tx_fee)) AS tx_fee_sum_eth @@ -87,11 +88,27 @@ SELECT , wei_to_gwei(safe_div(sum(l1_blob_fee), sum(l1_blob_scaled_size))) AS l1_blob_fee_avg_gwei + + -- Data Processed + , sum(input_zero_bytes) AS input_zero_bytes_sum + , sum(if(success, input_zero_bytes, 0)) AS success_input_zero_bytes_sum + + , sum(input_byte_length - input_zero_bytes) AS input_nonzero_bytes_sum + , sum(if(success, input_byte_length - input_zero_bytes, 0)) AS success_input_nonzero_bytes_sum + + , sum(input_byte_length) AS input_byte_length_sum + , sum(if(success, input_byte_length, 0)) AS success_input_byte_length_sum + + , sum(estimated_size) AS estimated_size_sum + , sum(if(success, estimated_size, 0)) AS success_estimated_size_sum + FROM {{ refined_transactions_fees }} -WHERE gas_price > 0 +WHERE + NOT is_system_transaction GROUP BY 1 , 2 , 3 , 4 + , 5 diff --git a/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to.sql.j2 new file mode 100644 index 00000000000..eb8d04df574 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to.sql.j2 @@ -0,0 +1,170 @@ +-- Aggreagte traces by day and the contract called (to address) +-- This will be used as the final table for dashboards that show the most used contracts in aggregate + +-- Get Unique contracts that call this contract, since we lose this granularity at the to_hash level +WITH get_unique_callers AS ( + SELECT + dt, chain_id, trace_to_address, + COUNT(DISTINCT trace_from_address) AS count_unique_trace_from_addresses + FROM aggregated_traces_tr_from_tr_to_hash + GROUP BY + dt, chain, network, chain_id, trace_to_address +) + +, raw_aggregation AS ( +SELECT +dt, chain, network, chain_id, trace_to_address +-- Aggregate transaction metrics, in transactions when a given contract was called +/* + Note: We can NOT sum these up at the project level, since a project may have + many of its contracts called in a single transaction. + + For these use cases (i.e. project impact metrics), we can aggregate `daily_trace_calls_agg_to_hash` + at the project name level, only after all trace_to_address entries are mapped to their respective + project name (i.e. a transaction may call 10 contracts, but this may only represent 3 projects). +*/ +-- Attributes + , COUNT(*) AS count_transactions_called + , COUNT(*) FILTER (WHERE tx_success) AS count_transactions_called_tx_success + , COUNT(DISTINCT block_number) AS count_unique_blocks_called + , COUNT(DISTINCT tx_from_address) AS count_unique_tx_from_addresses + , COUNT(DISTINCT tx_to_address) AS count_unique_tx_to_addresses + , COUNT(DISTINCT tx_method_id) AS count_unique_tx_method_ids +-- Transaction-Level gas & fees + , SUM(tx_l2_gas_used) AS sum_tx_l2_gas_used_called + , SUM(tx_l2_gas_used) FILTER (WHERE tx_success) AS sum_tx_l2_gas_used_called_tx_success + + , SUM(tx_fee_native) AS sum_tx_fee_native_called + , SUM(tx_fee_native) FILTER (WHERE tx_success) AS sum_tx_fee_native_called_tx_success + + , SUM(tx_l1_fee_native) AS tx_l1_fee_native + , SUM(tx_l1_fee_native) FILTER (WHERE tx_success) AS tx_l1_fee_native_tx_success + + , SUM(tx_l2_fee_native) AS tx_l2_fee_native + , SUM(tx_l2_fee_native) FILTER (WHERE tx_success) AS tx_l2_fee_native_tx_success + + , SUM(tx_l2_priority_fee_native) AS tx_l2_priority_fee_native + , SUM(tx_l2_priority_fee_native) FILTER (WHERE tx_success) AS tx_l2_priority_fee_native_tx_success + + , SUM(tx_l2_base_fee_native) AS tx_l2_base_fee_native + , SUM(tx_l2_base_fee_native) FILTER (WHERE tx_success) AS tx_l2_base_fee_native_tx_success + + , SUM(tx_l2_legacy_extra_fee_native) AS tx_l2_legacy_extra_fee_native + , SUM(tx_l2_legacy_extra_fee_native) FILTER (WHERE tx_success) AS tx_l2_legacy_extra_fee_native_tx_success + + -- Transaction-Level Gas Prices + , SUM(tx_l2_gas_used * tx_l2_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_gas_price_gwei_called + , SUM(tx_l2_gas_used * tx_l2_priority_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_priority_gas_price_gwei_called + , SUM(tx_l2_gas_used * tx_l2_legacy_extra_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_legacy_extra_gas_price_gwei_called + , SUM(tx_l2_gas_used * tx_l1_base_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l1_base_gas_price_gwei_called + , SUM(tx_l2_gas_used * tx_l1_blob_base_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l1_blob_base_gas_price_gwei_called + -- Transaction-Level transaction sizes + , SUM(tx_input_byte_length) AS sum_tx_input_byte_length_called + , SUM(tx_input_zero_bytes) AS sum_tx_input_zero_bytes_called + , SUM(tx_input_nonzero_bytes) AS sum_tx_input_nonzero_bytes_called + , SUM(tx_l1_base_scaled_size) AS sum_tx_l1_base_scaled_size_called + , SUM(tx_l1_blob_scaled_size) AS sum_tx_l1_blob_scaled_size_called + , SUM(tx_l1_gas_used_unified) AS sum_tx_l1_gas_used_unified_called + , SUM(tx_estimated_size) AS sum_tx_estimated_size_called + +-- Sum Internal Trace Gas +/* + Note: As opposed to transaction-level equivalent metrics, these CAN be summed up at a project level. + These methodologies were designed to distribute gas usage and fees across each call, so that they + still represent a "part of a whole," whereas transaction-level metrics do not. +*/ + + , SUM(sum_trace_gas_used) AS sum_trace_gas_used + , SUM(sum_trace_gas_used) FILTER (WHERE tx_success) AS sum_trace_gas_used_tx_success + + , SUM(sum_trace_gas_used_minus_subtraces) AS sum_trace_gas_used_minus_subtraces + , SUM(sum_trace_gas_used_minus_subtraces) FILTER (WHERE tx_success) AS sum_trace_gas_used_minus_subtraces_tx_success + + + , SUM(sum_tx_l2_gas_used_amortized_by_call) AS sum_tx_l2_gas_used_amortized_by_call + , SUM(sum_tx_l2_gas_used_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l2_gas_used_amortized_by_call_tx_success + + , SUM(sum_tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call + , SUM(sum_tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call + , SUM(sum_tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call + , SUM(sum_tx_estimated_size_amortized_by_call) AS sum_tx_estimated_size_amortized_by_call + + , SUM(sum_tx_l2_fee_native_minus_subtraces) AS sum_tx_l2_fee_native_minus_subtraces + , SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER (WHERE tx_success) AS sum_tx_l2_fee_native_minus_subtraces_tx_success + + , SUM(sum_tx_l2_base_fee_native_minus_subtraces) AS sum_tx_l2_base_fee_native_minus_subtraces + , SUM(sum_tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces + , SUM(sum_tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces + + , SUM(sum_tx_fee_native_amortized_by_call) AS sum_tx_fee_native_amortized_by_call + , SUM(sum_tx_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_fee_native_amortized_by_call_tx_success + + , SUM(sum_tx_l2_fee_native_amortized_by_call) AS sum_tx_l2_fee_native_amortized_by_call + , SUM(sum_tx_l2_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l2_fee_native_amortized_by_call_tx_success + + , SUM(sum_tx_l1_fee_native_amortized_by_call) AS sum_tx_l1_fee_native_amortized_by_call + , SUM(sum_tx_l1_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l1_fee_native_amortized_by_call_tx_success + + , SUM(sum_tx_l2_base_fee_native_amortized_by_call) AS sum_tx_l2_base_fee_native_amortized_by_call + , SUM(sum_tx_l2_priority_fee_native_amortized_by_call) AS sum_tx_l2_priority_fee_native_amortized_by_call + + , SUM(sum_tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces + + -- Calls + , SUM(count_top_level_calls) AS count_top_level_calls + --count non-null trace addresses, null is the transaction-level call. + , SUM(count_internal_calls_all_types) AS count_internal_calls_all_types + , SUM(count_internal_calls_all_types_trace_success) AS count_internal_calls_all_types_trace_success + --static calls only read state, and can not write + , SUM(count_internal_calls_static_type) AS count_internal_calls_static_type + , SUM(count_internal_calls_static_type_trace_success) AS count_internal_calls_static_type_trace_success + --delegate calls call a function on another contract + , SUM(count_internal_calls_delegate_type) AS count_internal_calls_delegate_type + , SUM(count_internal_calls_delegate_type_trace_success) AS count_internal_calls_delegate_type_trace_success + --normal function calls + , SUM(count_internal_calls_call_type) AS count_internal_calls_call_type + , SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success + + -- Experimental + , COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call) AS count_transactions_called_with_internal_type_call + , COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call_or_delegate) AS count_transactions_called_with_internal_type_call_or_delegate + + , SUM(sum_trace_gas_used_minus_subtraces) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call +, SUM(sum_tx_l2_gas_used_amortized_by_call) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call +, SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call +, SUM(sum_tx_l2_fee_native_amortized_by_call) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call +, SUM(sum_tx_fee_native_amortized_by_call) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call + +--count by trace type +,SUM(count_traces_type_all_types) AS count_traces_type_all_types +,SUM(count_traces_trace_type_call) AS count_traces_trace_type_call +,SUM(count_traces_trace_type_suicide) AS count_traces_trace_type_suicide +,SUM(count_traces_trace_type_create) AS count_traces_trace_type_create +,SUM(count_traces_trace_type_create2) AS count_traces_trace_type_create2 +,SUM(count_traces_trace_type_create_any) AS count_traces_trace_type_create_any + +FROM aggregated_traces_tr_to_hash +WHERE NOT is_system_transaction + +GROUP BY +dt, chain, network, chain_id, trace_to_address +) + +SELECT +ra.*, gu.count_unique_trace_from_addresses + +FROM raw_aggregation ra +LEFT JOIN get_unique_callers gu +ON ra.trace_to_address = gu.trace_to_address +AND ra.dt = gu.dt +AND ra.chain_id = gu.chain_id diff --git a/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to_tx_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to_tx_to.sql.j2 new file mode 100644 index 00000000000..08ff098c20f --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/daily_traces_tr_to_tx_to.sql.j2 @@ -0,0 +1,177 @@ +/*Aggreagte traces by day, + The internal contract called (trace to address), + direct contract called (tx to address), + and direct function called (tx method id). + This will be used as the to show in what direct user action contracts are often called within + (i.e. see that an oracle contract was called within a lending market action) +*/ + +-- Get Unique contracts that call this contract, since we lose this granularity at the to_hash level +WITH get_unique_callers AS ( + SELECT + dt, chain_id, trace_to_address, tx_to_address, tx_method_id, + COUNT(DISTINCT trace_from_address) AS count_unique_trace_from_addresses + FROM aggregated_traces_tr_from_tr_to_hash + GROUP BY + dt, chain, network, chain_id, trace_to_address, tx_to_address, tx_method_id +) + +, raw_aggregation AS ( +SELECT +dt, chain, network, chain_id, trace_to_address, tx_to_address, tx_method_id +-- Aggregate transaction metrics, in transactions when a given contract was called +/* + Note: We can NOT sum these up at the project level, since a project may have + many of its contracts called in a single transaction. + + For these use cases (i.e. project impact metrics), we can aggregate `daily_trace_calls_agg_to_hash` + at the project name level, only after all trace_to_address entries are mapped to their respective + project name (i.e. a transaction may call 10 contracts, but this may only represent 3 projects). +*/ +-- Attributes + -- Since we're aggregating from the to & hash level, count(*) returns distinct transactions + , COUNT(*) AS count_transactions_called + , COUNT(*) FILTER (WHERE tx_success) AS count_transactions_called_tx_success + , COUNT(DISTINCT block_number) AS count_unique_blocks_called + , COUNT(DISTINCT tx_from_address) AS count_unique_tx_from_addresses +-- Transaction-Level gas & fees + , SUM(tx_l2_gas_used) AS sum_tx_l2_gas_used_called + , SUM(tx_l2_gas_used) FILTER (WHERE tx_success) AS sum_tx_l2_gas_used_called_tx_success + + , SUM(tx_fee_native) AS sum_tx_fee_native_called + , SUM(tx_fee_native) FILTER (WHERE tx_success) AS sum_tx_fee_native_called_tx_success + + , SUM(tx_l1_fee_native) AS tx_l1_fee_native + , SUM(tx_l1_fee_native) FILTER (WHERE tx_success) AS tx_l1_fee_native_tx_success + + , SUM(tx_l2_fee_native) AS tx_l2_fee_native + , SUM(tx_l2_fee_native) FILTER (WHERE tx_success) AS tx_l2_fee_native_tx_success + + , SUM(tx_l2_priority_fee_native) AS tx_l2_priority_fee_native + , SUM(tx_l2_priority_fee_native) FILTER (WHERE tx_success) AS tx_l2_priority_fee_native_tx_success + + , SUM(tx_l2_base_fee_native) AS tx_l2_base_fee_native + , SUM(tx_l2_base_fee_native) FILTER (WHERE tx_success) AS tx_l2_base_fee_native_tx_success + + , SUM(tx_l2_legacy_extra_fee_native) AS tx_l2_legacy_extra_fee_native + , SUM(tx_l2_legacy_extra_fee_native) FILTER (WHERE tx_success) AS tx_l2_legacy_extra_fee_native_tx_success + + -- Transaction-Level Gas Prices + , SUM(tx_l2_gas_used * tx_l2_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_gas_price_gwei_called + , SUM(tx_l2_gas_used * tx_l2_priority_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_priority_gas_price_gwei_called + , SUM(tx_l2_gas_used * tx_l2_legacy_extra_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l2_legacy_extra_gas_price_gwei_called + , SUM(tx_l2_gas_used * tx_l1_base_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l1_base_gas_price_gwei_called + , SUM(tx_l2_gas_used * tx_l1_blob_base_gas_price_gwei) / SUM(tx_l2_gas_used) AS avg_tx_l1_blob_base_gas_price_gwei_called + -- Transaction-Level transaction sizes + , SUM(tx_input_byte_length) AS sum_tx_input_byte_length_called + , SUM(tx_input_zero_bytes) AS sum_tx_input_zero_bytes_called + , SUM(tx_input_nonzero_bytes) AS sum_tx_input_nonzero_bytes_called + , SUM(tx_l1_base_scaled_size) AS sum_tx_l1_base_scaled_size_called + , SUM(tx_l1_blob_scaled_size) AS sum_tx_l1_blob_scaled_size_called + , SUM(tx_l1_gas_used_unified) AS sum_tx_l1_gas_used_unified_called + , SUM(tx_estimated_size) AS sum_tx_estimated_size_called + +-- Sum Internal Trace Gas +/* + Note: As opposed to transaction-level equivalent metrics, these CAN be summed up at a project level. + These methodologies were designed to distribute gas usage and fees across each call, so that they + still represent a "part of a whole," whereas transaction-level metrics do not. +*/ + + , SUM(sum_trace_gas_used) AS sum_trace_gas_used + , SUM(sum_trace_gas_used) FILTER (WHERE tx_success) AS sum_trace_gas_used_tx_success + + , SUM(sum_trace_gas_used_minus_subtraces) AS sum_trace_gas_used_minus_subtraces + , SUM(sum_trace_gas_used_minus_subtraces) FILTER (WHERE tx_success) AS sum_trace_gas_used_minus_subtraces_tx_success + + + , SUM(sum_tx_l2_gas_used_amortized_by_call) AS sum_tx_l2_gas_used_amortized_by_call + , SUM(sum_tx_l2_gas_used_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l2_gas_used_amortized_by_call_tx_success + + , SUM(sum_tx_l1_gas_used_unified_amortized_by_call) AS sum_tx_l1_gas_used_unified_amortized_by_call + , SUM(sum_tx_l1_base_scaled_size_amortized_by_call) AS sum_tx_l1_base_scaled_size_amortized_by_call + , SUM(sum_tx_l1_blob_scaled_size_amortized_by_call) AS sum_tx_l1_blob_scaled_size_amortized_by_call + , SUM(sum_tx_estimated_size_amortized_by_call) AS sum_tx_estimated_size_amortized_by_call + + , SUM(sum_tx_l2_fee_native_minus_subtraces) AS sum_tx_l2_fee_native_minus_subtraces + , SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER (WHERE tx_success) AS sum_tx_l2_fee_native_minus_subtraces_tx_success + + , SUM(sum_tx_l2_base_fee_native_minus_subtraces) AS sum_tx_l2_base_fee_native_minus_subtraces + , SUM(sum_tx_l2_priority_fee_native_minus_subtraces) AS sum_tx_l2_priority_fee_native_minus_subtraces + , SUM(sum_tx_l2_legacy_base_fee_native_minus_subtraces) AS sum_tx_l2_legacy_base_fee_native_minus_subtraces + + , SUM(sum_tx_fee_native_amortized_by_call) AS sum_tx_fee_native_amortized_by_call + , SUM(sum_tx_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_fee_native_amortized_by_call_tx_success + + , SUM(sum_tx_l2_fee_native_amortized_by_call) AS sum_tx_l2_fee_native_amortized_by_call + , SUM(sum_tx_l2_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l2_fee_native_amortized_by_call_tx_success + + , SUM(sum_tx_l1_fee_native_amortized_by_call) AS sum_tx_l1_fee_native_amortized_by_call + , SUM(sum_tx_l1_fee_native_amortized_by_call) FILTER (WHERE tx_success) AS sum_tx_l1_fee_native_amortized_by_call_tx_success + + , SUM(sum_tx_l2_base_fee_native_amortized_by_call) AS sum_tx_l2_base_fee_native_amortized_by_call + , SUM(sum_tx_l2_priority_fee_native_amortized_by_call) AS sum_tx_l2_priority_fee_native_amortized_by_call + + , SUM(sum_tx_fee_native_l1_amortized_l2_minus_subtraces) AS sum_tx_fee_native_l1_amortized_l2_minus_subtraces + + -- Calls + , SUM(count_top_level_calls) AS count_top_level_calls + --count non-null trace addresses, null is the transaction-level call. + , SUM(count_internal_calls_all_types) AS count_internal_calls_all_types + , SUM(count_internal_calls_all_types_trace_success) AS count_internal_calls_all_types_trace_success + --static calls only read state, and can not write + , SUM(count_internal_calls_static_type) AS count_internal_calls_static_type + , SUM(count_internal_calls_static_type_trace_success) AS count_internal_calls_static_type_trace_success + --delegate calls call a function on another contract + , SUM(count_internal_calls_delegate_type) AS count_internal_calls_delegate_type + , SUM(count_internal_calls_delegate_type_trace_success) AS count_internal_calls_delegate_type_trace_success + --normal function calls + , SUM(count_internal_calls_call_type) AS count_internal_calls_call_type + , SUM(count_internal_calls_call_type_trace_success) AS count_internal_calls_call_type_trace_success + + -- Experimental + , COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call) AS count_transactions_called_with_internal_type_call + , COUNT(*) FILTER (WHERE is_transaction_with_internal_call_type_call_or_delegate) AS count_transactions_called_with_internal_type_call_or_delegate + + , SUM(sum_trace_gas_used_minus_subtraces) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_trace_gas_used_minus_subtraces_tx_success_called_with_internal_type_call +, SUM(sum_tx_l2_gas_used_amortized_by_call) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_tx_l2_gas_used_amortized_by_call_tx_success_called_with_internal_type_call +, SUM(sum_tx_l2_fee_native_minus_subtraces) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_tx_l2_fee_native_minus_subtraces_tx_success_called_with_internal_type_call +, SUM(sum_tx_l2_fee_native_amortized_by_call) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_tx_l2_fee_native_amortized_by_call_tx_success_called_with_internal_type_call +, SUM(sum_tx_fee_native_amortized_by_call) FILTER ( + WHERE tx_success AND is_transaction_with_internal_call_type_call + ) AS sum_tx_fee_native_amortized_by_call_tx_success_called_with_internal_type_call + +--count by trace type +,SUM(count_traces_type_all_types) AS count_traces_type_all_types +,SUM(count_traces_trace_type_call) AS count_traces_trace_type_call +,SUM(count_traces_trace_type_suicide) AS count_traces_trace_type_suicide +,SUM(count_traces_trace_type_create) AS count_traces_trace_type_create +,SUM(count_traces_trace_type_create2) AS count_traces_trace_type_create2 +,SUM(count_traces_trace_type_create_any) AS count_traces_trace_type_create_any + + +FROM aggregated_traces_tr_to_hash +WHERE NOT is_system_transaction + +GROUP BY +dt, chain, network, chain_id, trace_to_address, tx_to_address, tx_method_id +) + +SELECT +ra.*, gu.count_unique_trace_from_addresses + +FROM raw_aggregation ra +LEFT JOIN get_unique_callers gu +ON ra.trace_to_address = gu.trace_to_address +AND ra.tx_to_address = gu.tx_to_address +AND ra.tx_method_id = gu.tx_method_id +AND ra.dt = gu.dt +AND ra.chain_id = gu.chain_id diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_from_tx_to_method.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_from_tx_to_method.sql.j2 new file mode 100644 index 00000000000..0465b00f622 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_from_tx_to_method.sql.j2 @@ -0,0 +1,67 @@ +/* +Aggregates at the transaction level, at the most granular-level (from, to, method). +"From address" enables filtering by known senders (i.e. bots, relayers). +"Method ID" enables segmenting and filtering by function called (i.e. swap, transfer, approve, handle userops) +"To address" is the contract (or address) that the sender (from address) is directly interacting with. +Downstream, we can use contracts tables to filter for transactions to contracts versus others. +*/ + +SELECT + dt, + chain, + chain_id, + network, + from_address, + to_address, + method_id + + -- Aggregations + , COUNT(*) AS count_transactions + , COUNT(*) FILTER (WHERE success) AS count_transactions_success + + , COUNT(DISTINCT block_number) AS count_unique_blocks + + , SUM(l2_gas_used) AS sum_l2_gas_used + , SUM(l2_gas_used) FILTER (WHERE success) AS sum_l2_gas_used_success + + , SUM(tx_fee_native) AS sum_tx_fee_native + , SUM(tx_fee_native) FILTER (WHERE success) AS sum_tx_fee_native_success + + , SUM(l1_fee_native) AS l1_fee_native + , SUM(l1_fee_native) FILTER (WHERE success) AS l1_fee_native_success + + , SUM(l2_fee_native) AS l2_fee_native + , SUM(l2_fee_native) FILTER (WHERE success) AS l2_fee_native_success + + , SUM(l2_priority_fee_native) AS l2_priority_fee_native + , SUM(l2_priority_fee_native) FILTER (WHERE success) AS l2_priority_fee_native_success + + , SUM(l2_base_fee_native) AS l2_base_fee_native + , SUM(l2_base_fee_native) FILTER (WHERE success) AS l2_base_fee_native_success + + , SUM(l2_legacy_extra_fee_native) AS l2_legacy_extra_fee_native + , SUM(l2_legacy_extra_fee_native) FILTER (WHERE success) AS l2_legacy_extra_fee_native_success + + -- Transaction-Level Gas Prices + , SUM(l2_gas_used * l2_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_gas_price_gwei + , SUM(l2_gas_used * l2_priority_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_priority_gas_price_gwei + , SUM(l2_gas_used * l2_legacy_extra_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_legacy_extra_gas_price_gwei + , SUM(l2_gas_used * l1_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_base_gas_price_gwei + , SUM(l2_gas_used * l1_blob_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_blob_base_gas_price_gwei + + -- Transaction-Level transaction sizes + , SUM(input_byte_length) AS sum_input_byte_length + , SUM(input_zero_bytes) AS sum_input_zero_bytes + , SUM(input_nonzero_bytes) AS sum_input_nonzero_bytes + , SUM(l1_base_scaled_size) AS sum_l1_base_scaled_size + , SUM(l1_blob_scaled_size) AS sum_l1_blob_scaled_size + , SUM(l1_gas_used_unified) AS sum_l1_gas_used_unified + , SUM(estimated_size) AS sum_estimated_size + + +FROM refined_transactions_fees +WHERE NOT is_system_transaction + +GROUP BY + dt, chain, chain_id, network, + from_address, to_address, method_id diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2 new file mode 100644 index 00000000000..eb92b3d4b55 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to.sql.j2 @@ -0,0 +1,65 @@ +/* +Aggregates at the transaction level, at transaction to. +"To address" is the contract (or address) that the sender (from address) is directly interacting with. +Downstream, we can use contracts tables to filter for transactions to contracts versus others. +*/ + +SELECT + dt + , chain + , chain_id + , network + , to_address + + -- Aggregations + , COUNT(*) AS count_transactions + , COUNT(*) FILTER (WHERE success) AS count_transactions_success + + , COUNT(DISTINCT block_number) AS count_unique_blocks + , COUNT(DISTINCT from_address) AS count_unique_from_addresses + , COUNT(DISTINCT method_id) AS count_unique_method_ids + + , SUM(l2_gas_used) AS sum_l2_gas_used + , SUM(l2_gas_used) FILTER (WHERE success) AS sum_l2_gas_used_success + + , SUM(tx_fee_native) AS sum_tx_fee_native + , SUM(tx_fee_native) FILTER (WHERE success) AS sum_tx_fee_native_success + + , SUM(l1_fee_native) AS l1_fee_native + , SUM(l1_fee_native) FILTER (WHERE success) AS l1_fee_native_success + + , SUM(l2_fee_native) AS l2_fee_native + , SUM(l2_fee_native) FILTER (WHERE success) AS l2_fee_native_success + + , SUM(l2_priority_fee_native) AS l2_priority_fee_native + , SUM(l2_priority_fee_native) FILTER (WHERE success) AS l2_priority_fee_native_success + + , SUM(l2_base_fee_native) AS l2_base_fee_native + , SUM(l2_base_fee_native) FILTER (WHERE success) AS l2_base_fee_native_success + + , SUM(l2_legacy_extra_fee_native) AS l2_legacy_extra_fee_native + , SUM(l2_legacy_extra_fee_native) FILTER (WHERE success) AS l2_legacy_extra_fee_native_success + + -- Transaction-Level Gas Prices + , SUM(l2_gas_used * l2_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_gas_price_gwei + , SUM(l2_gas_used * l2_priority_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_priority_gas_price_gwei + , SUM(l2_gas_used * l2_legacy_extra_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_legacy_extra_gas_price_gwei + , SUM(l2_gas_used * l1_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_base_gas_price_gwei + , SUM(l2_gas_used * l1_blob_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_blob_base_gas_price_gwei + + -- Transaction-Level transaction sizes + , SUM(input_byte_length) AS sum_input_byte_length + , SUM(input_zero_bytes) AS sum_input_zero_bytes + , SUM(input_nonzero_bytes) AS sum_input_nonzero_bytes + , SUM(l1_base_scaled_size) AS sum_l1_base_scaled_size + , SUM(l1_blob_scaled_size) AS sum_l1_blob_scaled_size + , SUM(l1_gas_used_unified) AS sum_l1_gas_used_unified + , SUM(estimated_size) AS sum_estimated_size + + +FROM refined_transactions_fees +WHERE NOT is_system_transaction + +GROUP BY + dt, chain, chain_id, network + , to_address diff --git a/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to_method.sql.j2 b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to_method.sql.j2 new file mode 100644 index 00000000000..aeb1ea4eed5 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/daily_transactions_tx_to_method.sql.j2 @@ -0,0 +1,66 @@ +/* +Aggregates at the transaction level, at transaction to and method. +"Method ID" enables segmenting and filtering by function called (i.e. swap, transfer, approve, handle userops) +"To address" is the contract (or address) that the sender (from address) is directly interacting with. +Downstream, we can use contracts tables to filter for transactions to contracts versus others. +*/ + +SELECT + dt, + chain, + chain_id, + network, + to_address, + method_id + + -- Aggregations + , COUNT(*) AS count_transactions + , COUNT(*) FILTER (WHERE success) AS count_transactions_success + + , COUNT(DISTINCT block_number) AS count_unique_blocks + , COUNT(DISTINCT from_address) AS count_unique_from_addresses + + , SUM(l2_gas_used) AS sum_l2_gas_used + , SUM(l2_gas_used) FILTER (WHERE success) AS sum_l2_gas_used_success + + , SUM(tx_fee_native) AS sum_tx_fee_native + , SUM(tx_fee_native) FILTER (WHERE success) AS sum_tx_fee_native_success + + , SUM(l1_fee_native) AS l1_fee_native + , SUM(l1_fee_native) FILTER (WHERE success) AS l1_fee_native_success + + , SUM(l2_fee_native) AS l2_fee_native + , SUM(l2_fee_native) FILTER (WHERE success) AS l2_fee_native_success + + , SUM(l2_priority_fee_native) AS l2_priority_fee_native + , SUM(l2_priority_fee_native) FILTER (WHERE success) AS l2_priority_fee_native_success + + , SUM(l2_base_fee_native) AS l2_base_fee_native + , SUM(l2_base_fee_native) FILTER (WHERE success) AS l2_base_fee_native_success + + , SUM(l2_legacy_extra_fee_native) AS l2_legacy_extra_fee_native + , SUM(l2_legacy_extra_fee_native) FILTER (WHERE success) AS l2_legacy_extra_fee_native_success + + -- Transaction-Level Gas Prices + , SUM(l2_gas_used * l2_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_gas_price_gwei + , SUM(l2_gas_used * l2_priority_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_priority_gas_price_gwei + , SUM(l2_gas_used * l2_legacy_extra_gas_price_gwei) / SUM(l2_gas_used) AS avg_l2_legacy_extra_gas_price_gwei + , SUM(l2_gas_used * l1_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_base_gas_price_gwei + , SUM(l2_gas_used * l1_blob_base_gas_price_gwei) / SUM(l2_gas_used) AS avg_l1_blob_base_gas_price_gwei + + -- Transaction-Level transaction sizes + , SUM(input_byte_length) AS sum_input_byte_length + , SUM(input_zero_bytes) AS sum_input_zero_bytes + , SUM(input_nonzero_bytes) AS sum_input_nonzero_bytes + , SUM(l1_base_scaled_size) AS sum_l1_base_scaled_size + , SUM(l1_blob_scaled_size) AS sum_l1_blob_scaled_size + , SUM(l1_gas_used_unified) AS sum_l1_gas_used_unified + , SUM(estimated_size) AS sum_estimated_size + + +FROM refined_transactions_fees +WHERE NOT is_system_transaction + +GROUP BY + dt, chain, chain_id, network, + to_address, method_id diff --git a/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 new file mode 100644 index 00000000000..6f0a463b997 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/event_emitting_transactions.sql.j2 @@ -0,0 +1,64 @@ +-- Select the columns for joining back to transactions and sum event types +-- Calculate types of events emitted for downstream "qualified transaction" filtering + +WITH event_emitting AS ( + SELECT + l.dt + , epoch_to_hour(l.block_timestamp) AS block_hour + , l.block_timestamp + , l.network + , l.chain + , l.chain_id + , l.block_number + , l.transaction_hash + + , count(*) AS count_total_events + , sum(CASE WHEN f.category = 'Approval' THEN 1 ELSE 0 END) AS count_approval_events + , sum(CASE WHEN f.category = 'Wrapping' THEN 1 ELSE 0 END) AS count_wrapping_events + , sum(CASE WHEN f.category = 'Transfer' THEN 1 ELSE 0 END) AS count_transfer_events + + FROM ingestion_logs_v1 AS l + LEFT JOIN logs_topic0_filters AS f + ON l.topic0 = f.topic + + GROUP BY 1, 2, 3, 4, 5, 6, 7, 8 +) + +SELECT + ee.* + + , t.transaction_index + + , t.transaction_type + + -- Join Transaction Fields + , t.tx_fee_native + , t.l1_fee_native AS tx_l1_fee_native + -- gas fees + , t.l2_fee_native AS tx_l2_fee_native + + , t.l1_base_fee_native AS tx_l1_base_fee_native + , t.l1_blob_fee_native AS tx_l1_blob_fee_native + + , t.l2_base_fee_native AS tx_l2_base_fee_native + , t.l2_priority_fee_native AS tx_l2_priority_fee_native + + , t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native + , t.input_byte_length AS tx_input_byte_length + -- transaction attributes + , t.l1_gas_used_unified AS tx_l1_gas_used_unified + , t.estimated_size AS tx_estimated_size + , t.l2_gas_used AS tx_l2_gas_used + , ee.count_total_events + > ee.count_approval_events + ee.count_wrapping_events + ee.count_transfer_events + AS is_qualified_tx_not_approval_wrapping_transfer + , ee.count_total_events + > ee.count_approval_events + ee.count_wrapping_events + AS is_qualified_tx_not_approval_wrapping + + +FROM event_emitting AS ee +INNER JOIN refined_transactions_fees AS t + ON + ee.block_number = t.block_number + AND ee.transaction_hash = t.hash diff --git a/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2 b/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2 new file mode 100644 index 00000000000..32beb4623c2 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/logs_topic0_filters.sql.j2 @@ -0,0 +1,22 @@ +WITH topic0_filters AS ( -- list of events that we want to indicate for possible future filtering. + SELECT DISTINCT + lower(topic) AS topic + , description + , category + FROM ( + VALUES + ('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', 'ERC20 Approval', 'Approval') + , ('0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31', 'ERC721/ERC1155 Approval', 'Approval') + + , ('0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c', 'WETH Wrap', 'Wrapping') + , ('0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65', 'WETH Unwrap', 'Wrapping') + + , ('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', 'ERC20/ERC721 Transfer', 'Transfer') + , ('0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', 'ERC1155 Transfer Single', 'Transfer') + , ('0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb', 'ERC1155 Transfer Batch', 'Transfer') + , ('0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4', 'Polygon Log Transfer', 'Transfer') + , ('0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63', 'Polygon Log Fee Transfer', 'Transfer') + ) +) + +SELECT * FROM topic0_filters diff --git a/src/op_analytics/datapipeline/models/templates/refined_traces/traces_amortized.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_traces/traces_amortized.sql.j2 new file mode 100644 index 00000000000..68546d4db20 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/refined_traces/traces_amortized.sql.j2 @@ -0,0 +1,44 @@ +WITH + +-- Count traces per transaction +tx_aggregate AS ( + SELECT + block_number + , transaction_hash + , count(*) AS traces_cnt + FROM {{ refined_traces_projection }} + GROUP BY 1, 2 +) + +-- Count subtraces and sum of gas used at each parent trace. +, subtrace_aggregate AS ( + SELECT + block_number + , transaction_hash + , parent_trace_address + , trace_depth + , sum(trace_gas_used) AS gas_used_sum + , count(*) AS cnt + FROM {{ refined_traces_projection }} + GROUP BY 1, 2, 3, 4 +) + +SELECT + traces.* + , tx_agg.traces_cnt AS num_traces_in_txn + , coalesce(subtrace_agg.gas_used_sum, 0) AS sum_subtraces_gas_used + , traces.trace_gas_used - coalesce(subtrace_agg.gas_used_sum, 0) AS gas_used_minus_subtraces + +FROM {{ refined_traces_projection }} AS traces +INNER JOIN tx_aggregate AS tx_agg -- join on txn level + ON + traces.block_number = tx_agg.block_number + AND traces.transaction_hash = tx_agg.transaction_hash +LEFT JOIN subtrace_aggregate AS subtrace_agg -- join on trace level 1 level down + ON + traces.block_number = subtrace_agg.block_number + AND traces.transaction_hash = subtrace_agg.transaction_hash + AND traces.trace_depth = (subtrace_agg.trace_depth - 1) + AND traces.trace_address = subtrace_agg.parent_trace_address + + diff --git a/src/op_analytics/datapipeline/models/templates/refined_traces/traces_projection.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_traces/traces_projection.sql.j2 new file mode 100644 index 00000000000..b8afdd1c29f --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/refined_traces/traces_projection.sql.j2 @@ -0,0 +1,29 @@ +SELECT + -- Raw Trace fields + r.dt + , r.chain + , r.chain_id + , r.network + , r.block_number + , r.block_timestamp + , r.transaction_hash + , r.transaction_index + , r.from_address AS trace_from_address + , r.to_address AS trace_to_address + , r.gas AS trace_gas_limit + , r.gas_used AS trace_gas_used + , r.trace_address + , r.trace_type + , r.call_type + , r.error + , hexstr_method_id(r.input) AS trace_method_id + , r.status = 1 AS trace_success + -- Trace address helpers. + , trace_address_depth(r.trace_address) AS trace_depth + , trace_address_parent(r.trace_address) AS parent_trace_address +-- Trace i/o data - comment out for now to save on data space +-- , r.input +-- , r.output + +FROM {{ raw_traces }} AS r +ORDER BY r.block_number, r.transaction_hash, trace_depth, parent_trace_address diff --git a/src/op_analytics/datapipeline/models/templates/refined_traces/traces_txs_join.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_traces/traces_txs_join.sql.j2 new file mode 100644 index 00000000000..052a78cf4ec --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/refined_traces/traces_txs_join.sql.j2 @@ -0,0 +1,55 @@ +SELECT + r.* + + -- Parent trace fees. + -- the subtraces will never add up to part of whole, but leave as is + , r.gas_used_minus_subtraces * gwei_to_eth(t.l2_gas_price_gwei) + AS tx_l2_fee_native_minus_subtraces + + , r.gas_used_minus_subtraces * gwei_to_eth(t.l2_base_gas_price_gwei) + AS tx_l2_base_fee_native_minus_subtraces + + , r.gas_used_minus_subtraces * gwei_to_eth(t.l2_priority_gas_price_gwei) + AS tx_l2_priority_fee_native_minus_subtraces + + , r.gas_used_minus_subtraces * gwei_to_eth(t.l2_legacy_extra_gas_price_gwei) + AS tx_l2_legacy_base_fee_native_minus_subtraces + + -- Amortize evenly across all calls + + , t.l2_gas_used / r.num_traces_in_txn + AS tx_l2_gas_used_amortized_by_call + + , t.l1_gas_used_unified / r.num_traces_in_txn + AS tx_l1_gas_used_unified_amortized_by_call + + , t.l1_base_scaled_size / r.num_traces_in_txn + AS tx_l1_base_scaled_size_amortized_by_call + + , t.l1_blob_scaled_size / r.num_traces_in_txn + AS tx_l1_blob_scaled_size_amortized_by_call + + , t.estimated_size / r.num_traces_in_txn + AS tx_estimated_size_amortized_by_call + + , t.tx_fee_native / r.num_traces_in_txn + AS tx_fee_native_amortized_by_call + + , t.l2_fee_native / r.num_traces_in_txn + AS tx_l2_fee_native_amortized_by_call + + , t.l1_fee_native / r.num_traces_in_txn + AS tx_l1_fee_native_amortized_by_call + + , t.l2_base_fee_native / r.num_traces_in_txn + AS tx_l2_base_fee_native_amortized_by_call + + , t.l2_priority_fee_native / r.num_traces_in_txn + AS tx_l2_priority_fee_native_amortized_by_call + + +FROM {{ traces_amortized }} AS r +INNER JOIN {{ refined_transactions_fees }} AS t + ON + r.block_number = t.block_number + AND r.transaction_hash = t.hash diff --git a/src/op_analytics/datapipeline/models/templates/refined_traces/txs_projection.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_traces/txs_projection.sql.j2 new file mode 100644 index 00000000000..5240ef491d9 --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/refined_traces/txs_projection.sql.j2 @@ -0,0 +1,33 @@ +SELECT + -- Raw Transaction Fields + t.l2_gas_used AS tx_l2_gas_used + , t.l1_gas_used_unified AS tx_l1_gas_used_unified + , t.estimated_size AS tx_estimated_size + , t.from_address AS tx_from_address + , t.to_address AS tx_to_address + -- Computed Transaction Fee Fields + , t.tx_fee_native + , t.l1_fee_native AS tx_l1_fee_native + , t.l2_fee_native AS tx_l2_fee_native + , t.l2_base_fee_native AS tx_l2_base_fee_native + , t.l2_priority_fee_native AS tx_l2_priority_fee_native + , t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native + -- Computed Transaction Gas Price Fields + , t.l2_gas_price_gwei AS tx_l2_gas_price_gwei + , t.l2_base_gas_price_gwei AS tx_l2_base_gas_price_gwei + , t.l2_priority_gas_price_gwei AS tx_l2_priority_gas_price_gwei + , t.l2_legacy_extra_gas_price_gwei AS tx_l2_legacy_extra_gas_price_gwei + , t.l1_base_gas_price_gwei AS tx_l1_base_gas_price_gwei + , t.l1_blob_base_gas_price_gwei AS tx_l1_blob_base_gas_price_gwei + -- Computed Transaction Size Fields + , t.input_byte_length AS tx_input_byte_length + , t.input_zero_bytes AS tx_input_zero_bytes + , t.l1_base_scaled_size AS tx_l1_base_scaled_size + , t.l1_blob_scaled_size AS tx_l1_blob_scaled_size + + , t.method_id AS tx_method_id + , t.block_hour + , t.success AS tx_success + , t.is_system_transaction + +FROM {{ refined_transactions_fees }} AS t diff --git a/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2 new file mode 100644 index 00000000000..2abe482823c --- /dev/null +++ b/src/op_analytics/datapipeline/models/templates/refined_traces_fees.sql.j2 @@ -0,0 +1,182 @@ +WITH + +-- Select the columns that we want from transactions joined to blocks. +-- Include some minor transformations that are needed for further calculations. +base_level_traces AS ( + SELECT + -- Raw Trace fields + r.dt + , r.chain + , r.chain_id + , r.network + , r.block_number + , r.block_timestamp + , r.transaction_hash + , r.transaction_index + , r.from_address AS trace_from_address + , r.to_address AS trace_to_address + , r.gas AS trace_gas_limit + , r.gas_used AS trace_gas_used + , r.trace_address + , r.trace_type + , r.call_type + -- Trace i/o data - comment out for now to save on data space + -- r.input, + -- r.output, + -- Raw Transaction Fields + , t.l2_gas_used AS tx_l2_gas_used + , t.l1_gas_used_unified AS tx_l1_gas_used_unified + , t.estimated_size AS tx_estimated_size + , t.from_address AS tx_from_address + , t.to_address AS tx_to_address + -- Computed Transaction Fee Fields + , t.tx_fee_native + , t.l1_fee_native AS tx_l1_fee_native + , t.l2_fee_native AS tx_l2_fee_native + , t.l2_priority_fee_native AS tx_l2_priority_fee_native + , t.l2_base_fee_native AS tx_l2_base_fee_native + , t.l2_legacy_extra_fee_native AS tx_l2_legacy_extra_fee_native + -- Computed Transaction Gas Price Fields + , t.l2_gas_price_gwei AS tx_l2_gas_price_gwei + , t.l2_base_gas_price_gwei AS tx_l2_base_gas_price_gwei + , t.l2_priority_gas_price_gwei AS tx_l2_priority_gas_price_gwei + , t.l2_legacy_extra_gas_price_gwei AS tx_l2_legacy_extra_gas_price_gwei + , t.l1_base_gas_price_gwei AS tx_l1_base_gas_price_gwei + , t.l1_blob_base_gas_price_gwei AS tx_l1_blob_base_gas_price_gwei + -- Computed Transaction Size Fields + , t.input_byte_length AS tx_input_byte_length + , t.input_zero_bytes AS tx_input_zero_bytes + , t.input_nonzero_bytes AS tx_input_nonzero_bytes + , t.l1_base_scaled_size AS tx_l1_base_scaled_size + , t.l1_blob_scaled_size AS tx_l1_blob_scaled_size + + , t.method_id AS tx_method_id + , t.block_hour + + -- Convenience columns + , t.success AS tx_success + , r.error + , hexstr_method_id(r.input) AS trace_method_id + , r.status = 1 AS trace_success + , t.is_system_transaction + + --Get the next trace level up so that we can subtract subtrace gas + , CASE + WHEN r.trace_address = '' THEN 0 + ELSE length(r.trace_address) - length(replace(r.trace_address, ',', '')) + 1 + END AS trace_address_cardinality + + , CASE + WHEN r.trace_address = '' THEN '-1' + WHEN strpos(r.trace_address, ',') = 0 THEN '' -- No comma found + WHEN length(r.trace_address) - length(replace(r.trace_address, ',', '')) = 1 + THEN + split_part(r.trace_address, ',', 1) -- Only one comma, return first part + ELSE + substr( + r.trace_address + , 1 + , length(r.trace_address) + - length(split_part(r.trace_address, ',', array_length(string_split(r.trace_address, ',')))) + - 1 + ) + END AS trace_address_uplevel + + -- get the first trace level, for downstream cases where we want to split by each action + , CASE + WHEN r.trace_address = '' THEN '' + ELSE split_part(r.trace_address, ',', 1) + END AS trace_address_toplevel + + + + FROM ingestion_traces_v1 AS r + INNER JOIN refined_transactions_fees AS t + ON + r.block_number = t.block_number + AND r.transaction_hash = t.hash + +) + +--get amount of calls per transcation, to use for amortizing +, get_traces_per_tansaction AS ( + SELECT + dt + , chain_id + , block_number + , block_timestamp + , transaction_hash + , count(*) AS count_traces_in_transaction + FROM base_level_traces + GROUP BY 1, 2, 3, 4, 5 +) + +--get subtrace gas used, for isolating each call +, get_subtraces_gas_per_trace AS ( + SELECT + dt + , chain_id + , block_number + , block_timestamp + , transaction_hash + , trace_address_uplevel + , trace_address_cardinality + , sum(trace_gas_used) AS trace_gas_used_in_subtraces + , count(*) AS count_subtraces_in_trace + FROM base_level_traces + GROUP BY 1, 2, 3, 4, 5, 6, 7 +) + + +SELECT + bl.* + -- + , tpt.count_traces_in_transaction + , coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_in_subtraces + -- + , bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0) AS trace_gas_used_minus_subtraces + + -- the subtraces will never add up to part of whole, but leave as is + , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0)) + * gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_l2_fee_native_minus_subtraces + , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0)) + * gwei_to_eth(bl.tx_l2_base_gas_price_gwei) AS tx_l2_base_fee_native_minus_subtraces + , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0)) + * gwei_to_eth(bl.tx_l2_priority_gas_price_gwei) AS tx_l2_priority_fee_native_minus_subtraces + , (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0)) + * gwei_to_eth(bl.tx_l2_legacy_extra_gas_price_gwei) AS tx_l2_legacy_base_fee_native_minus_subtraces + + -- Amortize evenly across all calls + , bl.tx_l2_gas_used / tpt.count_traces_in_transaction AS tx_l2_gas_used_amortized_by_call + , bl.tx_l1_gas_used_unified / tpt.count_traces_in_transaction AS tx_l1_gas_used_unified_amortized_by_call + , bl.tx_l1_base_scaled_size / tpt.count_traces_in_transaction AS tx_l1_base_scaled_size_amortized_by_call + , bl.tx_l1_blob_scaled_size / tpt.count_traces_in_transaction AS tx_l1_blob_scaled_size_amortized_by_call + , bl.tx_estimated_size / tpt.count_traces_in_transaction AS tx_estimated_size_amortized_by_call + + , bl.tx_fee_native / tpt.count_traces_in_transaction AS tx_fee_native_amortized_by_call + , bl.tx_l2_fee_native / tpt.count_traces_in_transaction AS tx_l2_fee_native_amortized_by_call + , bl.tx_l1_fee_native / tpt.count_traces_in_transaction AS tx_l1_fee_native_amortized_by_call + , bl.tx_l2_base_fee_native / tpt.count_traces_in_transaction AS tx_l2_base_fee_native_amortized_by_call + , bl.tx_l2_priority_fee_native / tpt.count_traces_in_transaction AS tx_l2_priority_fee_native_amortized_by_call + + -- + , (bl.tx_l1_fee_native / tpt.count_traces_in_transaction) + + (bl.trace_gas_used - coalesce(st.trace_gas_used_in_subtraces, 0)) + * gwei_to_eth(bl.tx_l2_gas_price_gwei) AS tx_fee_native_l1_amortized_l2_minus_subtraces + + +FROM base_level_traces AS bl +INNER JOIN get_traces_per_tansaction AS tpt -- join on txn level + ON + bl.dt = tpt.dt + AND bl.chain_id = tpt.chain_id + AND bl.block_number = tpt.block_number + AND bl.transaction_hash = tpt.transaction_hash +LEFT JOIN get_subtraces_gas_per_trace AS st -- join on trace level 1 level down + ON + bl.dt = st.dt + AND bl.chain_id = st.chain_id + AND bl.block_number = st.block_number + AND bl.transaction_hash = st.transaction_hash + AND bl.trace_address_cardinality = (st.trace_address_cardinality - 1) + AND bl.trace_address = st.trace_address_uplevel diff --git a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 index 31de046383d..c567b3b80e8 100644 --- a/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 +++ b/src/op_analytics/datapipeline/models/templates/refined_transactions_fees.sql.j2 @@ -134,11 +134,11 @@ SELECT , wei_to_eth(l1_fee) AS l1_fee_native , wei_to_eth(l2_fee) AS l2_fee_native - -- L1 Breakdown + -- Native L1 Breakdown , wei_to_eth(l1_base_fee) AS l1_base_fee_native , wei_to_eth(l1_blob_fee) AS l1_blob_fee_native - -- L2 Breakdown + -- Native L2 Breakdown , wei_to_eth(l2_base_fee) AS l2_base_fee_native , wei_to_eth(l2_priority_fee) AS l2_priority_fee_native , wei_to_eth(l2_legacy_extra_fee) AS l2_legacy_extra_fee_native