Skip to main content

Flow Emulator

The Flow Emulator is a lightweight tool that emulates the behavior of the real Flow network for local development and testing.

Installation

The emulator is included with the Flow CLI. Follow the installation guide to get started.

Quick Start

First, create a flow.json configuration file:


_10
flow init --config-only

Then start the Flow Emulator:


_10
flow emulator

This starts a local Flow network with:

  • gRPC server on port 3569
  • REST API on http://localhost:8888
  • Admin API on port 8080

Common Options


_10
# Start with verbose logging
_10
flow emulator --verbose
_10
_10
# Set custom block time (e.g., 1 second between blocks)
_10
flow emulator --block-time 1s
_10
_10
# Persist state between restarts
_10
flow emulator --persist

For all available options, see the CLI commands overview.

Debugging & Testing

  • Code Coverage: Add --coverage-reporting flag and visit http://localhost:8080/emulator/codeCoverage
  • Debugging: Use #debugger() pragma in Cadence code for breakpoints

Additional Resources

For advanced configuration options, see the Flow Emulator repository.