Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

EVM-trackooor

> 编程语言
Open source

A modular tool to track anything on the EVM chain, including real-time tracking and alerts.

190 stars0 likes0 views
WebsiteGitHub

About

A modular tool to track anything on the EVM chain, including real-time tracking and alerts.

EVM trackooor

A modular tool to track and process anything on an EVM chain, including events, transactions and blocks.

Table of Contents

  • Examples
  • Usage
    • More details
    • Config file
  • Actions
    • Writing your own actions
  • Data Files
    • Adding event signature data
    • Adding function signature data
  • Supported Chains
  • Contributions and Support

Examples

  • Logging events from specific contracts, transactions from specific addresses, and blocks mined, either in realtime or historically

  • Scanning for contracts deployed by deployment transactions, for specific bytecodes

  • Tracking the volume of uniswap v2 & v3 pools, alerting via Discord webhook when there is a significant percentage change

  • Monitoring for ownership transfers and proxy upgrades

  • Tracking the common exploit pattern of withdrawing from Tornado.Cash then deploying a contract

  • Graphing funding paths, for both native ETH and ERC20 tokens to visualize transfers of funds

Usage

Usage: go run main.go track --config

List actions: go run main.go actions

  • More specific info about an action: go run main.go actions

More details

Whether to track events or blocks is automatically determined (based on what data the actions require), but you can also explicitly state what to track by putting blocks or events after historical/realtime.

  • events will use eth_subscribe to listen for logs, thus only events can be processed
  • blocks will use eth_subscribe to listen for newHeads, thus new blocks and transactions in those blocks can be tracked. As for events, another eth_getFilterLogs query is used to fetch all events in that block. Therefore, blocks is recommended as it allows events, txs and blocks to be tracked.

There is also an option for requesting historical data across a block range, in which case:

  • events will use eth_getFilterLogs to fetch event logs across multiple blocks, stepping a set amount of blocks at once (default 10000)
  • blocks will use eth_getBlockByNumber to fetch blocks and transactions in those blocks, then another call to eth_getFilterLogs for events in that block. Therefore, events is recommended if only event logs are required, as it is much faster, being able to query a wide range of blocks in a single call.

All events, txs and blocks will be sent to actions, which are specified in the config file.

Examples:

  • Track a specific contract, logging any transactions to that contract
    • go run main.go track realtime blocks --config ./config.json
    • Where in config.json, the Logging action is used with the contract address in its settings (see Actions)
  • Loop through blocks 1337 to 2000
    • go run main.go track historical blocks --config ./config.json --from-block 1337 --to-block 2000
    • You can also loop backwards (2000 to 1337) by setting --from-block 2000 --to-block 1337

Config file

The config file should contain what actions you want to run, and options for those actions. You should also specify the RPC URL there.

Basic structure:

json
{
  "rpcurl": "wss://...",
  "actions": {
    "ActionName": {
      "addresses": {
        "0xAA...": { "name": "optional contract name 1" },
        "0xBB...": { "name": "optional contract name 2" }
      },
      "options": {
        "custom-option-1": "something"
      }
    },
    "AnotherAction": {
      "addresses": {
        "0xCC...": { "name": "optional contract name 1" }
      },
      "options": {
        "custom-option-2": "something"
      }
    }
  }
}
  • "rpcurl" must be Websocket (wss:// or ws://)
  • "actions" contains multiple actions to run, each with their own addresses to track
  • Only 1 subscription log is used, therefore in the above example the addresses will be aggregated to form ["0xAA...", "0xBB...", "0xCC..."]. The same applies for event signatures.
  • "options" are custom options specific for each action. To see custom options for each action, list all actions (that are documented) using go run main.go actions

The example config below logs info for 0xA0b8... using the Logging action, and also records Tornado.Cash deposits/withdrawals for contract 0x910C... using the TornadoCash action:

…

There are also options specific to events. You shouldn't need to use these, unless you need to filter by events and it has to be fast. Both of these are optional.

  • "event-signatures" - List of event signatures (unhashed) to filter by
    • Example: "event-signatures":["Stored(uint256)", Retrieved(uint256)]
  • "event-topics" - Nested list of event topics to filter by. This explains it better. Event signatures provided from "event-signatures" are aggregated with this and placed in the first index as topic 0.
    • Example: [[],["0x0000000000000000000000000000000000000000000000000000000000000539"]]

Actions

Actions are golang code that 'postprocesses' data received from the trackooor.

Every time there is an event, transaction or block mined, action functions will be called depending on if the data (e.g. event sig, address) is being tracked.

For example, if you want to track transactions from/to an address, you add the address to a transaction address -> action functions mapping.

There are already premade actions, such as Logging, which simply outputs the data received.

Run go run main.go actions to list all actions (that have descriptions written).

Run go run main.go actions to search for actions and list their custom options and example config.

However, you can write your own actions for your own purposes.

Writing your own actions

To make your own custom actions, create a file in actions/, such as actions/action_logging.go.

Init functions

Each action has an initialization function, which will be called right before the trackooor starts. Registering what to listen for is usually done in this init function. The init function must start with Init and be a method of the action type. After the Init word should be your action name. This is important - your action name must be the same for other special functions (see action info and finished functions)

For example, func (p action) InitLogging() {} is the Init function with action name Logging.

The action type struct contains action options, which include addresses, event sigs and custom options:

go
type action struct {
	o shared.ActionOptions
}
go
type ActionOptions struct {
	Addresses     []common.Address       // addresses specific to each action
	EventSigs     []common.Hash          // event sigs specific to each action
	CustomOptions map[string]interface{} // custom options specific to each action
}

All of these options will be specified by the user in the config file. The reason Addresses and EventSigs are separate is because when running the trackooor, there are (usually) multiple actions ran at the same time, thus if using a filter log, the trackooor aggregates addresses and event sigs into a single filter log.

Custom options are JSON inputs by the user in the config file, actions should have their own info on what custom options they require.

Each action is responsible for registering what events/txs/blocks to listen for.

For example, if you wish to call logTx() when transactions are receieved from addresses in Addresses, you can loop through Addresses and call addTxAddressAction():

go
func (p action) InitLogging() {
    ...
    for _, address := range p.o.Addresses {
		addTxAddressAction(address, logTransaction)
	}
    ...
}

There are 5 functions to add tracking for events/txs/blocks:

  • Events
    • addEventSigAction() adds event sig string to event sig -> action funcs map, tracking all events that match that event sig
    • addAddressEventSigAction() adds an event sig string and contract address to contract address -> event sig -> action funcs map, tracking a specific event from a specific contract
    • addAddressEventAction() adds contract address to contract address -> action funcs map, essentially calling action functions regardless of event signature
    • WARNING: if your function tries type-asserting the event data, it might crash as the field might not exist. For example, anonymous events could have emit indexed bytes32 and put a keccak hash of a valid event signature, but not actually have the relevant topics/data. As such, when using addEventSigAction(), you should first check if the mapping (e.g p.DecodedTopics["from"]) exists.
  • Transactions and Blocks
    • addTxAddressAction() adds an address to address -> action funcs map, tracking all transactions to and from an address
    • addBlockAction() adds an action func to action funcs array, which will be called every time a new block is mined

Action functions

Action functions process the received data.

They can take either event, transaction or block data:

go
type ActionEventData struct {
	EventLog      types.Log
	EventFields   shared.EventFields
	DecodedTopics map[string]interface{}
	DecodedData   map[string]interface{}
}

type ActionTxData struct {
	Transaction *types.Transaction
	From        *common.Address
	To          *common.Address
	Block       *types.Block // block which the tx was in
}

type ActionBlockData struct {
	Block *types.Block
}

For example, checking a transaction calldata takes transaction data, thus ActionTxData:

go
func checkFunctionCall(p ActionTxData) {
	// continue only if tx was contract interaction
	txType := shared.DetermineTxType(p.Transaction, p.Block.Number())
	if txType != shared.ContractTx {
		return
	}

	// get tx To and From
	to := p.To
	from := p.From

	// get tx calldata
	txData := p.Transaction.Data()
	// get tx func selector
	txFuncSig := txData[:4]
    ...
}

For ActionEventData:

  • EventFields contains event fields, where each field contains field name, type, and whether that field is indexed
  • DecodedTopics and DecodedData are decoded according to their event ABI, and map the event field name to the value. Topics are indexed fields, while Data are unindexed.
    • E.g. event Transfer(address indexed from, address indexed to, uint256 value); will have from and to in DecodedTopics and value in DecodedData. You will need to type assert them in the action function, such as to := p.DecodedTopics["to"].(common.Address).

For example, processing a ERC20 transfer event:

go
func ProcessERC20Transfer(p ActionEventData) {
	tokenAddress := p.EventLog.Address
	from := p.DecodedTopics["from"].(common.Address)
	to := p.DecodedTopics["to"].(common.Address)
	value := p.DecodedData["value"].(*big.Int)
    ...
}

Finished Functions

"Finished" functions are called when the trackooor ends, which only happens in historical tracking.

This can be useful for things like saving data to a file after tracking across a certain block range.

Defining a finished function is similar to init functions, where it must be a method of the action type, and function name must start with Finished. After Finished should be the action name, identical to the init function's action name.

For example, the TornadoCash action will have finisher function func (p action) FinishedTornadoCash() {}.

Since action functions are run in async, you should ensure any time-consuming action funcs have finished before proceeding.

Example for the TornadoCash action:

go
// function called after historical processor is finished
func (p action) FinishedTornadoCash() {
	// wait for async funcs to finish
	RpcW

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Go

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言