|
1 | 1 | ---
|
2 | 2 | title: Start Emulator
|
3 |
| -description: How to start Flow emulator from the command line |
| 3 | +description: How to start the Flow Emulator from the command line |
4 | 4 | sidebar_position: 1
|
5 | 5 | ---
|
6 | 6 |
|
7 |
| -The Flow CLI provides a command to start an emulator. |
8 |
| -The Flow Emulator is a lightweight tool that emulates the behaviour of the real Flow network. |
| 7 | +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. |
9 | 8 |
|
10 |
| -```shell |
11 |
| -flow emulator |
| 9 | +## Initial Configuration |
| 10 | + |
| 11 | +The emulator requires a configuration file (`flow.json`). If you don’t already have one, create it using the `flow init` command: |
| 12 | + |
| 13 | +```bash |
| 14 | +flow init |
12 | 15 | ```
|
13 | 16 |
|
14 |
| -⚠️ The emulator command expects configuration to be initialized. See [flow init](../flow.json/initialize-configuration.md) command. |
| 17 | +This initializes a default configuration file that the emulator will use. |
| 18 | + |
| 19 | +## Starting the Emulator |
| 20 | + |
| 21 | +To start the emulator with default settings, use the following command: |
| 22 | + |
| 23 | +```bash |
| 24 | +flow emulator |
| 25 | +``` |
15 | 26 |
|
| 27 | +This will start the emulator with the configuration defined in `flow.json`. |
16 | 28 |
|
17 |
| -## Example Usage |
| 29 | +### Example Output |
18 | 30 |
|
19 |
| -```shell |
20 |
| -> flow emulator |
| 31 | +When you run the `flow emulator` command, you will see output similar to the following: |
21 | 32 |
|
| 33 | +```bash |
22 | 34 | INFO[0000] ⚙️ Using service account 0xf8d6e0586b0a20c7 serviceAddress=f8d6e0586b0a20c7 ...
|
23 |
| -... |
| 35 | +INFO[0000] 🌱 Starting Flow Emulator |
| 36 | +INFO[0000] 🛠 GRPC server started on 127.0.0.1:3569 |
| 37 | +INFO[0000] 📡 HTTP server started on 127.0.0.1:8080 |
24 | 38 | ```
|
25 | 39 |
|
26 |
| -To learn more about using the Emulator, have a look at the [README of the repository](https://github.com/onflow/flow-emulator). |
| 40 | +## Customizing the Emulator |
27 | 41 |
|
28 |
| -## Flags |
| 42 | +You can customize the emulator behavior by using flags. Here are some examples: |
29 | 43 |
|
30 |
| -### Emulator Flags |
31 |
| -You can specify any [emulator flags found here](https://github.com/onflow/flow-emulator#configuration) and they will be applied to the emulator service. |
| 44 | +Change the gRPC and REST API ports: |
32 | 45 |
|
33 |
| -### Configuration |
| 46 | +```bash |
| 47 | +flow emulator --port 9000 --rest-port 9001 |
| 48 | +``` |
| 49 | + |
| 50 | +Enable persistence of state across restarts: |
34 | 51 |
|
35 |
| -- Flag: `--config-path` |
36 |
| -- Short Flag: `-f` |
37 |
| -- Valid inputs: valid filename |
| 52 | +```bash |
| 53 | +flow emulator --persist |
| 54 | +``` |
38 | 55 |
|
39 |
| -Specify a filename for the configuration files, you can provide multiple configuration |
40 |
| -files by using `-f` flag multiple times. |
| 56 | +Enable detailed logs for debugging: |
41 | 57 |
|
42 |
| -### Version Check |
| 58 | +```bash |
| 59 | +flow emulator --verbose |
| 60 | +``` |
| 61 | + |
| 62 | +For a complete list of available flags, run: |
| 63 | + |
| 64 | +```bash |
| 65 | +flow emulator --help |
| 66 | +``` |
43 | 67 |
|
44 |
| -- Flag: `--skip-version-check` |
45 |
| -- Default: `false` |
| 68 | +## Learn More |
46 | 69 |
|
47 |
| -Skip version check during start up to speed up process for slow connections. |
| 70 | +To explore advanced features like snapshots, rollbacks, and debugging, visit the [Flow Emulator README](https://github.com/onflow/flow-emulator). |
0 commit comments