File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -220,6 +220,29 @@ Print the Tor hostname:
220220 ./scripts/print_tor_hostname
221221 ```
222222
223+ ### Importing events from JSON Lines
224+
225+ You can import NIP-01 events from a `.jsonl` file directly into the relay database.
226+
227+ Basic import:
228+ ```
229+ npm run import -- ./events.jsonl
230+ ```
231+
232+ Set a custom batch size (default: `1000`):
233+ ```
234+ npm run import -- ./events.jsonl --batch-size 500
235+ ```
236+
237+ The importer:
238+
239+ - Processes the file line-by-line to keep memory usage bounded.
240+ - Validates NIP-01 schema, event id hash, and Schnorr signature before insertion.
241+ - Inserts in database transactions per batch.
242+ - Skips duplicates without failing the whole import.
243+ - Prints progress in the format:
244+ `[Processed: 50,000 | Inserted: 45,000 | Skipped: 5,000 | Errors: 0]`
245+
223246### Running as a Service
224247
225248By default this server will run continuously until you stop it with Ctrl+C or until the system restarts.
You can’t perform that action at this time.
0 commit comments