README.md (9706B)
1 # NAME 2 3 eth-monitor - Cache, index and monitor transactions with an EVM node rpc 4 5 # SYNOPSIS 6 7 **eth-monitor** \[ --skip-history \] \[ --single \] \[ p *eth_provider* 8 \] \[ --includes-file *file* \] \[ -i chain_spec \] **eth-monitor** \[ 9 --skip-history \] \[ --single \] \[ p *eth_provider* \] \[ 10 --excludes-file *file* \] \[ --include-default \] \[ -i chain_spec \] 11 12 # DESCRIPTION 13 14 The **eth-monitor** has fulfills three distinct but related functions: 15 16 > 1\. A customizable view of on transactions of interest. 17 > 18 > 2\. A block and transaction cache. 19 > 20 > 3\. Arbitrary code executions using a transaction (and its block) as 21 > input. 22 23 Using an EVM RPC endpoint, the **eth-monitor** tool will retrieve blocks 24 within a given range and provides arbitrary processing of each 25 transaction. 26 27 A collection of options is provided to control the behavior of which 28 block ranges to sync, which criteria to use for display and cache, and 29 what code to execute for matching transactions. Details on each topic 30 can be found in the **SYNCING**, **MATCHING ADDRESSES** and **DEFINING 31 FILTERS** sections below, respectively. 32 33 Example executions of the tool can be found in the **EXAMPLES** section. 34 35 ## OPTIONS 36 37 **-0** 38 Omit newline to output 39 40 **--address ***address* 41 Add an address of interest to match any role. Complements 42 **--address-file***.* 43 44 **-c ***config_dir, ***--config ***config_dir* 45 Load configuration files from given directory. All files with an .ini 46 extension will be loaded, of which all must contain valid ini file data. 47 48 **--dumpconfig ***format* 49 Output configuration settings rendered from environment and inputs. 50 Valid arguments are *ini for ini file output, and env for environment 51 variable output. See ***CONFIGURATION***.* 52 53 **--env-prefix** 54 Environment prefix for variables to overwrite configuration. Example: If 55 **--env-prefix*** is set to ***FOO*** then configuration variable 56 ***BAR_BAZ*** would be set by environment variable ***FOO_BAZ_BAR***. 57 Also see ***ENVIRONMENT***.* 58 59 **--excludes-file ***file* 60 Load address exclude matching rules from file. See **MATCHING 61 ADDRESSES***.* 62 63 **--exec ***address* 64 Add an address of interest to executable address array. Complements 65 **--address-file***.* 66 67 **--filter ***module* 68 Add code execution filter to all matched transactions. The argument must 69 be a python module path. Several filters may be added by supplying the 70 option multiple times. Filters will be executed in the order the options 71 are given. See **DEFINING FILTERS*** section of ***eth-monitor (1)*** 72 for more details.* 73 74 **--height** 75 Block height at which to query state for. Does not apply to 76 transactions. 77 78 **-i ***chain_spec, ***--chain-spec ***chain_spec* 79 Chain specification string, in the format 80 \<engine\>:\<fork\>:\<chain_id\>:\<common_name\>. Example: 81 "evm:london:1:ethereum". Overrides the *RPC_CREDENTIALS configuration 82 setting.* 83 84 **--include-default ** 85 Match all addresses by default. Addresses may be excluded using 86 --excludes-file. If this is set, --input, --output, --exec and 87 --includes-file will have no effect. 88 89 **--includes-file ***file* 90 Load address include matching rules from file. See **MATCHING 91 ADDRESSES***.* 92 93 **--input ***address* 94 Add an address of interest to inputs (recipients) array. Complements 95 **--address-file***.* 96 97 **-n ***namespace, ***--namespace ***namespace* 98 Load given configuration namespace. Configuration will be loaded from 99 the immediate configuration subdirectory with the same name. 100 101 **--no-logs** 102 Turn of logging completely. Negates **-v*** and ***-vv** 103 104 **--output ***address* 105 Add an address of interest to outputs (sender) array. Complements 106 **--address-file***.* 107 108 **-p***, ***--rpc-provider** 109 Fully-qualified URL of RPC provider. Overrides the *RPC_PROVIDER 110 configuration setting.* 111 112 **--raw** 113 Produce output most optimized for machines. 114 115 **--renderer ***module* 116 Add output renderer filter to all matched transactions. The argument 117 must be a python module path. Several renderers may be added by 118 supplying the option multiple times. See **RENDERERS*** section of 119 ***eth-monitor (1)*** for more details.* 120 121 **--rpc-dialect** 122 RPC backend dialect. If specified it *may help with encoding and 123 decoding issues. Overrides the RPC_DIALECT configuration setting.* 124 125 **--store-block-data ** 126 Store block data in cache for matching transactions. Requires 127 **--cache-dir***.* 128 129 **--store-tx-data ** 130 Store transaction data in cache for matching transactions. Requires 131 **--cache-dir***.* 132 133 **-u***, ***--unsafe** 134 Allow addresses that do not pass checksum. 135 136 **-v** 137 Verbose. Show logs for important state changes. 138 139 **-vv** 140 Very verbose. Show logs with debugging information. 141 142 **--x-address ***address* 143 Add an address of interest to match any role. 144 145 **--x-exec ***address* 146 Add an address of disinterest to executable address array. 147 148 **--x-input ***address* 149 Add an address of disinterest to inputs (recipients) array. 150 151 **--x-output ***address* 152 Add an address of disinterest to outputs (sender) array. 153 154 # CONFIGURATION 155 156 All configuration settings may be overriden both by environment 157 variables, or by overriding settings with the contents of ini-files in 158 the directory defined by the **-c*** option.* 159 160 The active configuration, with values assigned from environment and 161 arguments, can be output using the **--dumpconfig*** format option. Note 162 that entries having keys prefixed with underscore (e.g. \_SEQ) are not 163 actual configuration settings, and thus cannot be overridden with 164 environment variables.* 165 166 To refer to a configuration setting by environment variables, the 167 *section and key are concatenated together with an underscore, and 168 transformed to upper-case. For example, the configuration variable 169 FOO_BAZ_BAR refers to an ini-file entry as follows:* 170 171 [foo] 172 bar_baz = xyzzy 173 174 In the **ENVIRONMENT*** section below, the relevant configuration 175 settings for this tool is listed along with a short description of its 176 meaning.* 177 178 Some configuration settings may also be overriden by command line 179 options. Also note that the use of the **-n*** and ***--env-prefix*** 180 options affect how environment and configuration is read. The effects of 181 options on how configuration settings are affective is described in the 182 respective ***OPTIONS*** section.* 183 184 # MATCHING ADDRESSES 185 186 By default, addresses to match against transactions need to be 187 explicitly specified. This behavior can be reversed with the 188 **--include-default*** option. Addresses to match are defined using the 189 ***--input***, ***--output*** and ***--exec*** options. Addresses 190 specified multiple times will be deduplicated.* 191 192 Inclusion rules may also be loaded from file by specifying the 193 **--includes-file*** and ***--excludes-file*** options. Each file must 194 specify the outputs, inputs and exec addresses as comma separated lists 195 respectively, separated by tabs.* 196 197 In the current state of this tool, address matching will affect all 198 parts of the processing; cache, code execution and rendering. 199 200 # SYNCING 201 202 When a sync is initiated, the state of this sync is persisted. This way, 203 previous syncs that did not complete for some reason will be resumed 204 where they left off. 205 206 A special sync type **--head*** starts syncing at the current head of 207 the chain, and continue to sync until interrupted. When resuming sync, a 208 new sync range between the current block head and the block height at 209 which the previous ***--head*** sync left off will automatically be 210 created.* 211 212 Syncs can be forced to (re)run for ranges regardless of previous state 213 by using the **--single*** option. However, there is no protection in 214 place from preventing code filters from being executed again on the same 215 transaction when this is done. See ***DEFINING FILTERS*** below.* 216 217 # CACHE 218 219 When syncing, the hash of a block and transaction matching the address 220 criteria will be stored in the cache. The hashes can be used for future 221 data lookups. 222 223 If **--store-block-data*** and/or ***--store-tx-data*** is set, a copy 224 of the block and/or transaction data will also be stored, respectively.* 225 226 # RENDERING 227 228 Rendering in the context of **eth-monitor*** refers to a formatted 229 output stream that occurs independently of caching and code execution.* 230 231 Filters for rendering may be specified by specifying python modules to 232 the **--renderer*** option. This option may be specified multiple 233 times.* 234 235 Rendering filters will be executed in order, and the first filter to 236 return *False* 237 238 # DEFINING FILTERS 239 240 A python module used for filter must fulfill two conditions: 241 242 > 1\. It must provide a class named *Filter in the package base 243 > namespace.* 244 > 245 > 2\. The *Filter class must include a method named filter with the 246 > signature def filter(self, conn, block, tx, db_session=None). * 247 248 Filters will strictly be executed in the order which they are defined on 249 the command line. 250 251 # FURTHER READING 252 253 Refer to the **chainsyncer*** chapter n info chaintool for in-depth 254 information on the subjects of syncing and filtering.* 255 256 # ENVIRONMENT 257 258 *CHAIN_SPEC* 259 String specifying the type of chain connected to, in the format 260 *\<engine\>:\<fork\>:\<network_id\>:\<common_name\>. For EVM nodes the 261 engine value will always be evm.* 262 263 *RPC_DIALECT* 264 Enables translations of EVM node specific formatting and response codes. 265 266 *RPC_PROVIDER* 267 Fully-qualified URL to the RPC endpoint of the blockchain node. 268 269 # LICENSE 270 271 This documentation and its source is licensed under the Creative Commons 272 Attribution-Sharealike 4.0 International license. 273 274 The source code of the tool this documentation describes is licensed 275 under the GNU General Public License 3.0. 276 277 # COPYRIGHT 278 279 Louis Holbrook \<dev@holbrook.no\> (https://holbrook.no) PGP: 280 59A844A484AC11253D3A3E9DCDCBD24DD1D0E001 281 282 # SOURCE CODE 283 284 https://git.defalsify.org