Package Logo
wormhole_indexer
wormhole_indexer@v0.2.0
Total Downloads
43
Published
3 weeks ago
Publisher
User Avatar Hamhunter23

Readme

Wormhole Solana Indexer

A comprehensive Substreams-based indexer for Wormhole cross-chain messaging and asset transfers on Solana.

Overview

This project indexes Wormhole's ecosystem on Solana, tracking:

  • Core Bridge message publications
  • Token Bridge transfers (with real data parsing)
  • NFT Bridge transfers
  • Wormhole Program activities

The indexer provides rich analytics about cross-chain activity, chain pair interactions, and token metrics.

Programs Indexed

Program Address Description
Core Bridge worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth Handles message publications and verifications
Token Bridge wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb Manages token transfers between chains
NFT Bridge WnFt12ZrnzZrFZkt2xsNsaNWoQribnuQ5B5FrDbwDhD Manages NFT transfers between chains
Wormhole Program HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ Main Wormhole program

Key Features

  • Real Anchor IDL Data Parsing: Uses proper Anchor deserialization for TransferOut, TransferIn, and TransferNative events
  • Cross-Chain Address Formatting: Formats addresses according to chain standards (hex for EVM, base58 for Solana)
  • Token Metadata Resolution: Includes symbol, name, and decimals for major tokens (SOL, USDC, USDT, WBTC, WETH)
  • Chain ID Mapping: Maps numeric chain IDs (1, 2, etc.) to human-readable names (Solana, Ethereum, etc.)
  • Advanced Analytics: Calculates TVL (Total Value Locked), DAU (Daily Active Users), and token volume metrics

Modules

Module Description
map_core_bridge_data Extracts MessagePublication events from the Core Bridge
map_token_bridge_data Extracts token transfer events from the Token Bridge
map_nft_bridge_data Extracts NFT transfer events from the NFT Bridge
map_wormhole_program_data Extracts message events from the main Wormhole program
combine_wormhole_activity Combines data from all bridges to provide rich analytics

Data Model

Core Messages

Track cross-chain messages with:

  • Transaction and block information
  • Emitter account and sequence number
  • Consistency level and payload data

Token Transfers

Track token movements with:

  • Source and destination chain information
  • Token details (address, symbol, name, decimals)
  • Transfer amount and fees
  • Sender and recipient addresses
  • Properly formatted addresses for each blockchain

NFT Transfers

Track NFT movements with:

  • Source and destination chain information
  • NFT details (address, token ID, URI, name, symbol)
  • Sender and recipient addresses

Combined Analytics

Provides aggregated insights:

  • Cross-chain value flows and volume
  • Chain pair interaction statistics
  • Top tokens and most active pairs
  • User activity metrics
  • Total Value Locked (TVL) calculations
  • Daily Active Users (DAU) tracking

Supported Chains

The indexer supports all chains in the Wormhole ecosystem, including:

Chain ID Name
1 Solana
2 Ethereum
4 BSC
5 Polygon
6 Avalanche
10 Fantom
22 Arbitrum
23 Optimism
30 Base

... and many more!

Token Bridge Event Types

The indexer handles three main event types from the Token Bridge:

  1. TransferOut: Tokens leaving Solana to another chain
  2. TransferIn: Tokens arriving to Solana from another chain
  3. TransferNative: Native SOL transfers to other chains

Each event type is properly deserialized using Anchor's IDL definitions.

Usage with GraphQL

Example queries to extract insights from the indexed data:

# Get recent token transfers
query {
  tokenTransfers(limit: 10, orderBy: BLOCK_TIMESTAMP_DESC) {
    txId
    blockTimestamp
    fromAddress
    toAddress
    tokenSymbol
    amount
    toChain
  }
}

# Get chain pair activity
query {
  chainPairs(orderBy: TOKEN_TRANSFER_COUNT_DESC, limit: 5) {
    sourceChain
    destinationChain
    messageCount
    tokenTransferCount
    nftTransferCount
    tokenVolumeUsd
  }
}

Building and Running

Build the Substreams:

cargo build --target wasm32-unknown-unknown --release
substreams pack

Deploy the package to Substreams.dev:

substreams deploy ./wormhole-indexer-v0.1.0.spkg

Run the Substreams:

substreams run -e <ENDPOINT> map_token_bridge_data -s <START_BLOCK> -t <STOP_BLOCK>
substreams run -e <ENDPOINT> combine_wormhole_activity -s <START_BLOCK> -t <STOP_BLOCK>

License

MIT

Documentation

Modules

Maps icon
Maps

map
map_core_bridge_data

1a40ad64bea3751f032018468ff718e436fe82f4
map map_core_bridge_data (
solana:blocks_without_votessf.solana.type.v1.Block
)  -> wormhole.output.v1.MessagePublications
substreams gui wormhole-indexer@v0.2.0 map_core_bridge_data

map
map_token_bridge_data

63865fddf6b13a3204fe178e5c206a4e78b151e6
substreams gui wormhole-indexer@v0.2.0 map_token_bridge_data

map
map_nft_bridge_data

8e00a32b1e1a65ab556f0433b2544326eee2dee3
substreams gui wormhole-indexer@v0.2.0 map_nft_bridge_data

map
map_wormhole_program_data

f4cceb3fd6f5af456eaa4991e17b71d3ed68ff81
substreams gui wormhole-indexer@v0.2.0 map_wormhole_program_data

map
solana:blocks_without_votes

0be93a73c65aa8ec2de4b1a47209edeea493ff29
map solana:blocks_without_votes (
)  -> sf.solana.type.v1.Block
substreams gui wormhole-indexer@v0.2.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 wormhole-indexer@v0.2.0 solana:v020:blocks_without_votes
Block Indexes icon
Block Indexes

blockIndex
solana:program_ids_without_votes

811466d12743a8b02be8ba6649cfa9a24aa1af62
substreams gui wormhole-indexer@v0.2.0 solana:program_ids_without_votes
Protobuf

Protobuf Docs Explorer

substreams.v1.program
wormhole.output.v1
sf.solana.type.v1
wormhole.combined.v1
sol.instructions.v1
sol.transactions.v1
wormhole.token_bridge.v1
wormhole.nft_bridge.v1