Package Logo
sm_bridge_indexer
sm-bridge-indexer@v0.1.0
Total Downloads
6
Published
10 hours ago
Publisher
User Avatar dicksonoche

Readme

sm_bridge_indexer

A Substreams package that indexes Wormhole cross‑chain messages on Token Bridge and SPL‑Token mint/burn events on Solana, alongside block metadata. Designed as a reference implementation for real‑time bridge analytics and dashboards.

Initialized via substreams init on the sol‑minimal template, then scaled up for maximum complexity and usefulness.


Installation & Quick Start

# 1. Build your Substreams Wasm
substreams build
# 2. Authenticate (if you haven’t yet)
substreams auth
# 3. Launch the interactive GUI
substreams gui
# 4. (Optional) Publish to Substreams Registry
substreams registry login
substreams registry publish

Modules & Handlers

map_filter_wormhole

  • Kind: map
  • Input: solana:blocks_without_votes
  • Output: proto:wormhole.v1.Instructions

Descrription:

  • Iterates each transaction in every block
  • Filters by Wormhole program IDs:
    • worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth (Core)
    • wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb (Token Bridge)
  • Emits raw instruction data, account keys, and program IDs

map_decode_wormhole

  • Kind: map
  • Input: map_filter_wormhole
  • Output: proto:wormhole.v1.WormholeMessage

Description:

  • Scans the filtered instructions for the first PostMessage (instruction tag = 1) from the Core program
  • Parses:
    • Payload length (bytes 1–4)
    • Payload bytes
    • Sequence number (8 bytes immediately following the payload)
  • Emits a structured message with fields:
    • emitter (account that posted the message)
    • sequence (Verifiable Action Approval sequence)
    • payload (raw payload bytes)

map_spl_mint_burn

  • Kind: map
  • Input: solana:blocks_without_votes
  • Output: proto:spl.v1.MintOrBurnEvent

Description:

  • Filters instructions by the SPL Token program ID: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
  • Manually decodes MintTo (7) and Burn (8) instructions:
    • Reads the first byte of data to identify the instruction
    • Parses the next 8 bytes as a little‑endian u64 amount
    • Maps account indices to mint and owner fields
    • Emits { mint, owner, amount, is_mint }

map_my_data

  • Kind: map
  • Input: solana:blocks_without_votes
  • Output: proto:mydata.v1.MyData

Description:

  • Captures basic block metadata:
    • block_hash, block_slot, block_timestamp
    • transactions_len (number of txns)
    • instructions_len (total instructions)

Documentation

Modules

Maps icon
Maps

map
map_filter_wormhole

145b3f714a7f2f72a9475e2a18d4c90867d48afe
map map_filter_wormhole (
solana:blocks_without_votessf.solana.type.v1.Block
)  -> wormhole.v1.Instructions
substreams gui sm-bridge-indexer@v0.1.0 map_filter_wormhole

map
map_decode_wormhole

aa6213caa17a88ce0da999612ceccd3170b371dd
substreams gui sm-bridge-indexer@v0.1.0 map_decode_wormhole

map
map_spl_mint_burn

97f5c15015f9d5758b55661cb5f79e081284023c
substreams gui sm-bridge-indexer@v0.1.0 map_spl_mint_burn

map
map_my_data

a393149ffdc28ae04915b4c99813fab1fa87dbfa
substreams gui sm-bridge-indexer@v0.1.0 map_my_data

map
solana:blocks_without_votes

0be93a73c65aa8ec2de4b1a47209edeea493ff29
map solana:blocks_without_votes (
)  -> sf.solana.type.v1.Block
substreams gui sm-bridge-indexer@v0.1.0 solana:blocks_without_votes

map
solana:v020:blocks_without_votes

0be93a73c65aa8ec2de4b1a47209edeea493ff29
map solana:v020:blocks_without_votes (
)  -> sf.solana.type.v1.Block

blocks_without_votes allows you to consume a full Solana Block without Vote instructions (Vote111111111111111111111111111111111111111). If you consume it on HISTORICAL data (+1000 blocks from HEAD), you will be reading from the StreamingFast cache, thus saving costs on the amount of TB read.

substreams gui sm-bridge-indexer@v0.1.0 solana:v020:blocks_without_votes
Block Indexes icon
Block Indexes

blockIndex
solana:program_ids_without_votes

811466d12743a8b02be8ba6649cfa9a24aa1af62
substreams gui sm-bridge-indexer@v0.1.0 solana:program_ids_without_votes
Protobuf

Protobuf Docs Explorer

sf.solana.type.v1
sol.instructions.v1
sol.transactions.v1
mydata.v1
wormhole.v1
spl.v1