Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve starting emulator docs #1038

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 47 additions & 24 deletions docs/tools/flow-cli/deployment/start-emulator.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,70 @@
---
title: Start Emulator
description: How to start Flow emulator from the command line
description: How to start the Flow Emulator from the command line
sidebar_position: 1
---

The Flow CLI provides a command to start an emulator.
The Flow Emulator is a lightweight tool that emulates the behaviour of the real Flow network.
The Flow Emulator is a lightweight development tool that mimics the behavior of the real Flow network. It is bundled with the [Flow CLI](https://docs.onflow.org/flow-cli/), which makes starting and configuring the emulator straightforward.

```shell
flow emulator
## Initial Configuration

The emulator requires a configuration file (`flow.json`). If you don’t already have one, create it using the `flow init` command:

```bash
flow init
```

⚠️ The emulator command expects configuration to be initialized. See [flow init](../flow.json/initialize-configuration.md) command.
This initializes a default configuration file that the emulator will use.

## Starting the Emulator

To start the emulator with default settings, use the following command:

```bash
flow emulator
```

This will start the emulator with the configuration defined in `flow.json`.

## Example Usage
### Example Output

```shell
> flow emulator
When you run the `flow emulator` command, you will see output similar to the following:

```bash
INFO[0000] ⚙️ Using service account 0xf8d6e0586b0a20c7 serviceAddress=f8d6e0586b0a20c7 ...
...
INFO[0000] 🌱 Starting Flow Emulator
INFO[0000] 🛠 GRPC server started on 127.0.0.1:3569
INFO[0000] 📡 HTTP server started on 127.0.0.1:8080
```

To learn more about using the Emulator, have a look at the [README of the repository](https://github.com/onflow/flow-emulator).
## Customizing the Emulator

## Flags
You can customize the emulator behavior by using flags. Here are some examples:

### Emulator Flags
You can specify any [emulator flags found here](https://github.com/onflow/flow-emulator#configuration) and they will be applied to the emulator service.
Change the gRPC and REST API ports:

### Configuration
```bash
flow emulator --port 9000 --rest-port 9001
```

Enable persistence of state across restarts:

- Flag: `--config-path`
- Short Flag: `-f`
- Valid inputs: valid filename
```bash
flow emulator --persist
```

Specify a filename for the configuration files, you can provide multiple configuration
files by using `-f` flag multiple times.
Enable detailed logs for debugging:

### Version Check
```bash
flow emulator --verbose
```

For a complete list of available flags, run:

```bash
flow emulator --help
```

- Flag: `--skip-version-check`
- Default: `false`
## Learn More

Skip version check during start up to speed up process for slow connections.
To explore advanced features like snapshots, rollbacks, and debugging, visit the [Flow Emulator README](https://github.com/onflow/flow-emulator).
Loading