For AI agents: the documentation index is at /llms.txt. Markdown versions of pages are available by appending .md to the URL.
Skip to main content

Indexing on Fuel Network

Introduction​

Envio supports the Fuel Network on mainnet and testnet. This page shows how to use HyperIndex with Fuel’s architecture and features.

Fuel offers several advantages as a modular execution layer including:

  • Parallel transaction execution
  • State-minimized design
  • UTXO-based architecture
  • Advanced FuelVM capabilities

HyperIndex for Fuel​

HyperIndex enables developers to easily index and query real-time and historical data on Fuel Network with the same powerful features available for EVM chains.

Getting Started with Fuel Indexing​

You can start indexing Fuel contracts in two ways:

  1. Quick Start (5-minute tutorial): Follow our step-by-step tutorial to create your first Fuel indexer quickly.

  2. No-Code Contract Import: Use our Contract Import tool to automatically generate configuration and schema files for your Fuel contracts.

Example Fuel Indexers​

Looking for inspiration? Check out these indexers built by projects in the Fuel ecosystem:

ProjectTypeGitHub Repository
SparkOrderbook DEXgithub
MiraAMM DEXgithub
ThunderNFT Marketplacegithub
SwaylendLending Protocolgithub
GreeterTutorialgithub
These repositories use older HyperIndex versions

Each indexer above pins an envio version from v1 or v2, so its handler code uses the pre-v3 API and won't run as-is on current HyperIndex. Use them for schema and config ideas, and this page for the v3 handler API. For a current starting point, run pnpx envio init fuel template --template greeter.

Features Supported on Fuel​

HyperIndex for Fuel supports all the core features available in the EVM version:

Fuel-Specific Event Types​

Understanding Fuel's Event Model​

Fuel's event model differs significantly from EVM. Instead of predefined events, Fuel uses a more flexible approach with various receipt types that can be indexed.

LOG_DATA Receipts (Primary Event Type)​

The most common event type in Fuel is the LOG_DATA receipt, created by the log instruction in Sway contracts.

Unlike Solidity's emit which requires predefined event structures, Sway's log function allows passing any data, providing greater flexibility.

Configuration Example:​

ecosystem: fuel
chains:
- id: 0 # Fuel testnet
start_block: 1
contracts:
- name: SwayContract
abi_file_path: "./abis/SwayContract.json"
address: "0x123..."
events:
- name: NewGreeting
logId: "8500535089865083573"

The logId is a unique identifier for the logged struct, which you can find in your contract's ABI file.

chains[].id is 0 for Fuel testnet and 9889 for Fuel mainnet. HyperIndex picks the HyperFuel endpoint from the id (https://fuel-testnet.hypersync.xyz or https://fuel.hypersync.xyz); any other id fails with Fuel network id <id> is not supported unless you set hyperfuel_config.url. Add # yaml-language-server: $schema=./node_modules/envio/fuel.schema.json at the top of config.yaml for editor validation.

Auto-detection of logId:​

If your event name matches the logged struct name in Sway, you can omit the logId:

events:
- name: NewGreeting # Will automatically detect logId if it matches the struct name

Tip: Instead of manually configuring events, use the Contract Import tool which automatically detects events and generates the proper configuration.

Additional Fuel Event Types​

Fuel allows indexing several additional receipt types not available in EVM:

Event TypeDescriptionExample Configuration
MintTriggered when a contract mints tokens- name: Mint
BurnTriggered when a contract burns tokens- name: Burn
TransferCombines TRANSFER and TRANSFER_OUT receipts- name: Transfer
CallTriggered when a contract calls another contract- name: Call

Using Custom Names:​

You can rename these events while maintaining their type:

events:
- name: MintMyNft # Custom name
type: mint # Actual event type

type accepts logData, mint, burn, transfer and call. Without it, the type is derived from the event name and falls back to logData.

Note: All event types can be used with Wildcard Indexing.

Transfer Event Specifics​

The Transfer event type combines two Fuel receipt types:

  • TRANSFER: Emitted when a contract transfers tokens to another contract
  • TRANSFER_OUT: Emitted when a contract transfers tokens to a wallet

Important: Transfers between wallets are not included in the Transfer event type.

Event Object Structure in Handlers​

When handling Fuel events, the event object structure differs from EVM:

// Example Fuel event handler
import { indexer } from "envio";

indexer.onEvent(
{ contract: "SwayContract", event: "NewGreeting" },
async ({ event, context }) => {
// Access event parameters
const message = event.params.message;

// Access block information
const blockHeight = event.block.height;
const blockTime = event.block.time;
const blockId = event.block.id;

// Access transaction information
const txId = event.transaction.id;

// Access source contract address
const sourceContract = event.srcAddress;

// Access log position
const logIndex = event.logIndex;

// Store data
context.Greeting.set({
id: event.transaction.id,
message: message,
timestamp: blockTime,
});
},
);

Compared with EVM:

  • event.block carries id, height and time, and event.transaction carries id.
  • Block ranges key on block.height, not block.number: a handler's where takes { block: { height: { _gte: 1_000_000 } } }, and an indexer.onBlock handler receives { block: { height }, context } and filters with block.height._gte / _lte / _every.

HyperFuel​

HyperFuel is Envio's low-level data API for the Fuel Network (equivalent to HyperSync for EVM chains).

HyperFuel provides:

  • High-performance data access
  • Flexible query capabilities
  • Multiple data formats (Parquet, Arrow, typed data)
  • Complete historical data

Available Clients​

Access HyperFuel data using any of these clients:

HyperFuel Endpoints​

For detailed information, see the HyperFuel documentation.

About Fuel Network​

Fuel is an operating system purpose-built for Ethereum rollups with unique architecture focused on:

  • Parallelization: Execute transactions concurrently for higher throughput
  • State-minimized execution: Efficient storage and computation model
  • Interoperability: Seamless integration with other blockchain systems

Powered by the FuelVM, Fuel expands Ethereum's capabilities without compromising security or decentralization.

Resources​

Need Help?​

If you encounter any issues with Fuel indexing, please:

  1. Check our Troubleshooting guides
  2. Join our Discord for community support
  3. Create an issue in our GitHub repository