How To Index ETH Transactions (not just logs/events) #174
Answered
by
ryandotsmith
ryandotsmith
asked this question in
Support
-
I've had a couple questions come in regarding this topic so I thought I'd jot down the approach. |
Beta Was this translation helpful? Give feedback.
Answered by
ryandotsmith
Oct 10, 2023
Replies: 1 comment
-
In addition to indexing at the log level, Shovel can also index data at the transaction level. For example, say you wanted to save a transaction's input data when the transaction is addressed to a particular contract. This can be achieved with the following config: {
"pg_url": "postgres:///shovel",
"eth_sources": [
{"name": "main", "chain_id": 1, "url": "https://1.rlps.indexsupply.net"}
],
"integrations": [
{
"name": "txinputs",
"enabled": true,
"sources": [{"name": "main"}],
"table": {
"name": "txi",
"columns": [
{"name": "chain_id", "type": "numeric"},
{"name": "block_hash", "type": "bytea"},
{"name": "block_num", "type": "numeric"},
{"name": "tx_hash", "type": "bytea"},
{"name": "tx_idx", "type": "numeric"},
{"name": "tx_signer", "type": "bytea"},
{"name": "tx_to", "type": "bytea"},
{"name": "tx_input", "type": "bytea"}
]
},
"block": [
{"name": "chain_id", "column": "chain_id"},
{"name": "block_hash", "column": "block_hash"},
{"name": "block_num", "column": "block_num"},
{"name": "tx_hash", "column": "tx_hash"},
{"name": "tx_idx", "column": "tx_idx"},
{"name": "tx_signer", "column": "tx_signer"},
{"name": "tx_to", "column": "tx_to", "filter_op": "contains", "filter_arg": ["99C9fc46f92E8a1c0deC1b1747d010903E884bE1"]},
{"name": "tx_input", "column": "tx_input"}
]
}
]
} If this json is stored in a file named ./shovel -config txi.json |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ryandotsmith
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In addition to indexing at the log level, Shovel can also index data at the transaction level. For example, say you wanted to save a transaction's input data when the transaction is addressed to a particular contract. This can be achieved with the following config: