This package was initialized via substreams init
, using the evm-minimal
template.
This substream monitors blockchain transactions in real-time, specifically designed to track incoming transactions to specified addresses. It supports both native ETH transfers and ERC20 token transfers.
from
and to
addressesFor live monitoring of incoming transactions:
# Make the script executable (first time only)
chmod +x run_live.sh
# Start live monitoring
./run_live.sh
Note: When no start block is specified, the substream automatically starts from the current head of the blockchain and continues monitoring new blocks as they arrive. This ensures you're always monitoring the latest transactions without processing historical data.
# Build the project
cargo build --target wasm32-unknown-unknown --release
# Authenticate with Substreams
substreams auth
# Run in live mode (starts from current head and continues monitoring new blocks)
substreams run substreams.yaml filter_transactions --log-level=info
To process historical blocks:
# Process from a specific block number
substreams run substreams.yaml filter_transactions --start-block 1000000
# Process a range of blocks
substreams run substreams.yaml filter_transactions --start-block 1000000 --stop-block 1000100
You can configure the addresses to monitor in two ways:
substreams.yaml
)Configure the addresses to monitor in substreams.yaml
:
params:
filter_transactions: 'to=0xcccd218a58b53c67fc17d8c87cb90d83614e35fd'
You can also filter by multiple addresses:
params:
filter_transactions: 'to=0xcccd218a58b53c67fc17d8c87cb90d83614e35fd&from=0x1234567890123456789012345678901234567890'
The run_live.sh
script supports command line parameters for flexible configuration:
# Monitor transactions to a specific address
./run_live.sh --to 0x1234567890123456789012345678901234567890
# Monitor transactions from a specific address
./run_live.sh --from 0xabcdefabcdefabcdefabcdefabcdefabcdefabcd
# Monitor transactions between two addresses
./run_live.sh --to 0x1234567890123456789012345678901234567890 --from 0xabcdefabcdefabcdefabcdefabcdefabcdefabcd
# Use custom parameters string
./run_live.sh --params 'to=0x1234567890123456789012345678901234567890&from=0xabcdefabcdefabcdefabcdefabcdefabcdefabcd'
# Monitor on different networks
./run_live.sh --network mainnet.streamingfast.io:443 --to 0x1234567890123456789012345678901234567890
./run_live.sh --network polygon-mainnet.streamingfast.io:443 --to 0x1234567890123456789012345678901234567890
# Use default parameters from substreams.yaml
./run_live.sh
You can also pass parameters directly to the substreams command:
# Build the project first
cargo build --target wasm32-unknown-unknown --release
# Run with custom parameters
substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml filter_transactions \
--params filter_transactions='to=0x1234567890123456789012345678901234567890' \
--start-block 1000000 \
--limit-processed-blocks 0
# Run on different networks
substreams run -e mainnet.streamingfast.io:443 substreams.yaml filter_transactions \
--params filter_transactions='to=0x1234567890123456789012345678901234567890' \
--start-block 1000000 \
--limit-processed-blocks 0
to
: Monitor incoming transactions to this address (supports both direct transfers and ERC20 transfers)from
: Monitor outgoing transactions from this addressbase-mainnet.streamingfast.io:443
(default) - Base networkmainnet.streamingfast.io:443
- Ethereum mainnetpolygon-mainnet.streamingfast.io:443
- Polygon networkParameters use URL query string format:
to=0x1234567890123456789012345678901234567890
to=0x1234567890123456789012345678901234567890&from=0xabcdefabcdefabcdefabcdefabcdefabcdefabcd
to=0x1234567890123456789012345678901234567890,0xabcdefabcdefabcdefabcdefabcdefabcdefabcd
See ./examples.sh
for a comprehensive list of usage examples.
The substream outputs transaction data in the following format:
{
"transactions": [
{
"from": "0x...",
"to": "0x...",
"hash": "0x...",
"value": "1000000000000000000",
"token_id": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
}
]
}
token_id
will be 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
token_id
will be the contract address of the tokenOptionally, you can publish your Substreams to the Substreams Registry.
substreams registry login # Login to substreams.dev
substreams registry publish # Publish your Substreams to substreams.dev
filter_transactions
This module filters and processes blockchain transactions based on specified address filters. It:
Key dependencies:
substreams
: Core Substreams frameworksubstreams-ethereum
: Ethereum-specific functionalitynum-bigint
: Big integer arithmetic for token amountsserde
: Serialization/deserializationanyhow
: Error handlingfilter_transactions
returns full transaction data from the block with comprehensive logging.
This module continuously processes all blocks to monitor for incoming transactions to specified addresses.
substreams gui cypher-substreams@v0.1.3 filter_transactions