Output
sf.substreams.index.v1.Keys
Inputs

Package ref
polymarket-trader-index@v0.12.0Run package
CLI
Run map_user_activity from the command line.
substreams run polymarket-trader-index@v0.12.0 map_user_activity -e polygon --start-block -1substreams auth or directly on thegraph.market (see docs).README
Foundational block index of Polymarket user activity. Emits a user:<address>
key for every wallet that took any action in a block — trades, position
splits/merges, redemptions, conversions, pUSD transfers, ERC-1155 transfers, and
wallet deployments — across all Polymarket contracts. Downstream packages import
this and add a blockFilter querying user:0x… to skip every block a wallet never
touched.
| Module | Kind | Description | Output Type |
|---|---|---|---|
map_user_keys | map | Warming gate — decodes Polymarket logs and emits a user:<address> key per active wallet | proto:sf.substreams.index.v1.Keys |
index_users | blockIndex | The block index consumers filter against (user:0x…) | proto:sf.substreams.index.v1.Keys |
map_user_activity | map | Given a user:0x… query, emits the watched wallets active in each surviving block | proto:sf.substreams.index.v1.Keys |
| Key | Meaning |
|---|---|
user:<address> | this wallet took any action on Polymarket in the block, across all contracts |
Keys are lowercase hex with a 0x prefix. A consumer filters with e.g.
query.string: "user:0xabc… || user:0xdef…" to process only the blocks those
wallets were active in.
make build-trader-index
# or
cd polymarket-trader-index && substreams build
cd polymarket-trader-index && substreams pack
map_user_activity takes a user:0x… param naming the wallet(s) to watch:
substreams run substreams.yaml map_user_activity \
-p map_user_activity="user:0xefe62ed1df3f4afcc8a2afe2e4e8fcde965c9520" \
--network polygon \
--start-block 4023686 \
--stop-block +1000000
Pass an || list to watch several wallets at once.
Warm the index first.
index_usersis versioned, so the first full-range--production-modepass computes the index (and returns nothing). Once warm, filtered runs skip straight to the wallet's active blocks. See thewarming-substreams-indexesworkflow.
Import this package and gate a map/store on index_users; the engine skips
every block none of the watched wallets touched, while the per-contract packages
supply the decoded events:
imports:
pmusers: ../polymarket-trader-index/polymarket-trader-index-v0.12.0.spkg
modules:
- name: map_wallet_activity
kind: map
blockFilter:
module: pmusers:index_users
query: { params: true } # e.g. "user:0xA || user:0xB"
substreams: ^0.7substreams-ethereum: ^0.11Build artifacts: target/wasm32-unknown-unknown/release/polymarket_trader_index.wasm
Modules
Output
sf.substreams.index.v1.Keys
Inputs
Per block, emits `user:<address>` for every wallet involved in any Polymarket action that block. Consumers filter with e.g. query.string: "user:0xabc… || user:0xdef…" to process only the blocks those wallets were active in. Pass-through of `map_user_keys`: inherits its foundational-index skipping (when the map is skipped its output is absent, so this index has no input and is skipped too).
Output
sf.substreams.index.v1.Keys
Inputs
Warming gate. Reuses the already-warm foundational `eth_common:index_events` to run only on blocks where one of the 8 Polymarket contracts emitted an event, then decodes those logs and emits a `user:<address>` key for every wallet involved. Segments with no Polymarket activity are skipped wholesale, so warming this package only touches blocks with Polymarket activity.
Output
sf.substreams.index.v1.Keys
Output
sf.substreams.ethereum.v1.Events
`index_events` sets the following keys on the block: * Event signatures evt_sig:0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef (signature in hex, prefixed by 0x) * Event address evt_addr:0x0123456789abcdef0123456789abcdef01234567 (address in hex, prefixed by 0x)
Output
sf.substreams.index.v1.Keys
Inputs