You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/tools/emulator/index.md
+53Lines changed: 53 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ keywords:
25
25
- local blockchain
26
26
- E2E testing
27
27
- off-chain mocking
28
+
- precreate accounts
29
+
- num-accounts
28
30
---
29
31
30
32
The Flow Emulator is a lightweight tool that emulates the behavior of the real Flow network for local development and testing.
@@ -114,6 +116,7 @@ This starts a local Flow network with:
114
116
-`--service-sig-algo <ECDSA_P256|ECDSA_secp256k1>`: Service key signature algo (default `ECDSA_P256`)
115
117
-`--service-hash-algo <SHA3_256|SHA2_256>`: Service key hash algo (default `SHA3_256`)
116
118
-`--min-account-balance <decimal>`: Minimum account balance or account creation cost
119
+
-`--num-accounts <int>`: Number of accounts to precreate and fund at startup (default `0`)
117
120
-`--contracts`: Deploy common contracts on start
118
121
-`--contract-removal`: Allow contract removal for development (default true)
119
122
-`--init`: Initialize a new account profile
@@ -125,6 +128,50 @@ This starts a local Flow network with:
125
128
-**Snapshots**
126
129
-`--snapshot`: Enable snapshots in the emulator
127
130
131
+
## Precreated Accounts
132
+
133
+
The Flow Emulator supports precreating and funding multiple accounts automatically when the emulator starts up. This feature streamlines development workflows by eliminating the need to manually create test accounts for each emulator session.
134
+
135
+
### Usage
136
+
137
+
Use the `--num-accounts` flag to specify the number of accounts to precreate:
138
+
139
+
```bash
140
+
flow emulator --num-accounts 5
141
+
```
142
+
143
+
Or via environment variable:
144
+
145
+
```bash
146
+
FLOW_NUMACCOUNTS=5 flow emulator
147
+
```
148
+
149
+
### Account Details
150
+
151
+
**Funding**: Each precreated account is automatically funded with **1000.0 FLOW tokens**. The funding amount is currently fixed and not configurable.
152
+
153
+
**Keys**: All precreated accounts use the **same public key as the service account**. This simplifies development by allowing you to use the same private key across all accounts. The service account private key (displayed at startup) can be used to sign transactions for any precreated account.
154
+
155
+
**Account Addresses**: Accounts are created sequentially at emulator startup. Account addresses and the shared private key are displayed in the console when the emulator starts.
156
+
157
+
### Example Output
158
+
159
+
When starting the emulator with `--num-accounts 3`:
0 commit comments