|
1 | 1 | --- |
2 | 2 | title: Flow Emulator |
3 | | -description: A development tool that looks, acts and talks like Flow |
| 3 | +description: Local Flow network for development and testing |
4 | 4 | sidebar_position: 3 |
5 | 5 | --- |
6 | 6 |
|
7 | | -The Flow Emulator is a lightweight tool that emulates the behaviour of the real Flow network. |
| 7 | +The Flow Emulator is a lightweight tool that emulates the behavior of the real Flow network for local development and testing. |
8 | 8 |
|
9 | | -The emulator exposes a gRPC server that implements the Flow Access API, |
10 | | -which is designed to have near feature parity with the real network API. |
| 9 | +## Installation |
11 | 10 |
|
12 | | -## Running the emulator with the Flow CLI |
| 11 | +The emulator is included with the [Flow CLI](../flow-cli/index.md). Follow the [installation guide](../flow-cli/install.md) to get started. |
13 | 12 |
|
14 | | -The emulator is bundled with the [Flow CLI](../flow-cli/index.md), a command-line interface for working with Flow. |
| 13 | +## Quick Start |
15 | 14 |
|
16 | | -### Installation |
| 15 | +First, create a `flow.json` configuration file: |
17 | 16 |
|
18 | | -Follow [these steps](../flow-cli/install.md) to install the Flow CLI on macOS, Linux, and Windows. |
| 17 | +```bash |
| 18 | +flow init --config-only |
| 19 | +``` |
19 | 20 |
|
20 | | -## Usage |
| 21 | +Then start the Flow Emulator: |
21 | 22 |
|
22 | | -To learn more about using the Emulator, |
23 | | -have a look at [the README of the repository](https://github.com/onflow/flow-emulator/#starting-the-server). |
| 23 | +```bash |
| 24 | +flow emulator |
| 25 | +``` |
| 26 | + |
| 27 | +This starts a local Flow network with: |
| 28 | +- gRPC server on port `3569` |
| 29 | +- REST API on `http://localhost:8888` |
| 30 | +- Admin API on port `8080` |
| 31 | + |
| 32 | +## Common Options |
| 33 | + |
| 34 | +```bash |
| 35 | +# Start with verbose logging |
| 36 | +flow emulator --verbose |
| 37 | + |
| 38 | +# Set custom block time (e.g., 1 second between blocks) |
| 39 | +flow emulator --block-time 1s |
| 40 | + |
| 41 | +# Persist state between restarts |
| 42 | +flow emulator --persist |
| 43 | +``` |
| 44 | + |
| 45 | +For all available options, see the [CLI commands overview](../flow-cli/index.md). |
| 46 | + |
| 47 | +## Debugging & Testing |
| 48 | + |
| 49 | +- **Code Coverage**: Add `--coverage-reporting` flag and visit `http://localhost:8080/emulator/codeCoverage` |
| 50 | +- **Debugging**: Use `#debugger()` pragma in Cadence code for breakpoints |
| 51 | + |
| 52 | +## Additional Resources |
| 53 | + |
| 54 | +For advanced configuration options, see the [Flow Emulator repository](https://github.com/onflow/flow-emulator/). |
0 commit comments