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
Subscribe to peers, fetch announced txs, and track unconfirmed UTXOs and
spends for watched addresses. Surface them via /v1/utxos (height 0),
/v1/utxo spend overlay, /v1/tx, and /v1/status. Toggle with
MEMPOOL_ENABLED (default true). Bumps the neutrino fork to 0d5f911.
Copy file name to clipboardExpand all lines: README.md
+71-2Lines changed: 71 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,7 @@ Anyone can reproduce and verify a release locally with one command:
112
112
|`CFILTER_CDN_URL`|| Override block-dn base URL for compact filter CDN downloads |
113
113
|`AUTO_SYNC_WATCHED`|`true`| Continuously scan new blocks for watched addresses in the background, keeping the UTXO set up-to-date so `/v1/utxos` is instant. Reacts to block-connected notifications from the chain service in real time |
114
114
|`AUTO_SYNC_INTERVAL_SEC`|`30`| Fallback poll interval (in seconds) used while waiting for initial header sync, and as a safety net if block-notification subscription is unavailable. Only used when `AUTO_SYNC_WATCHED=true`|
115
+
|`MEMPOOL_ENABLED`|`true`| Enable the watched-only mempool tracker. The daemon subscribes to every connected peer's incoming `inv` messages, fetches each announced tx, and records the ones that pay or spend a watched address. Unconfirmed UTXOs are surfaced in `/v1/utxos` (with `height: 0`) and unconfirmed spends are overlaid on `/v1/utxo/{txid}/{vout}`. Disable with `MEMPOOL_ENABLED=false` to keep the chain-only behaviour |
115
116
|`MAX_PEERS`|`8`| Maximum number of peers to connect to |
116
117
|`NO_AUTH`|`false`| Disable TLS and token authentication (for development/regtest) |
117
118
@@ -128,6 +129,7 @@ Anyone can reproduce and verify a release locally with one command:
128
129
--clearnet-initial-sync=true \
129
130
--cfilter-cdn-auto=true \
130
131
--maxpeers=8 \
132
+
--mempool=true \
131
133
--no-auth # Disable TLS + auth (dev/regtest only)
132
134
# --reset-auth # Regenerate TLS cert and auth token, then exit
133
135
```
@@ -238,10 +240,19 @@ Response:
238
240
"synced": true,
239
241
"block_height": 820000,
240
242
"filter_height": 820000,
241
-
"peers": 8
243
+
"peers": 8,
244
+
"mempool_enabled": true,
245
+
"mempool": {
246
+
"entries": 4,
247
+
"utxos": 3,
248
+
"spends": 1,
249
+
"peers": 8
250
+
}
242
251
}
243
252
```
244
253
254
+
The `mempool` object is omitted when `MEMPOOL_ENABLED=false`. `entries` counts watched mempool txs, `utxos` counts unconfirmed outputs paying watched addresses, `spends` counts unconfirmed spends of watched outpoints, and `peers` reflects how many connected peers the tracker is subscribed to.
255
+
245
256
### Block Header
246
257
247
258
Get block header by height:
@@ -305,10 +316,15 @@ curl -X POST http://localhost:8334/v1/rescan \
Append `?include_mempool=false` to suppress the mempool overlay and receive
412
+
only the on-chain status. A confirmed spend always takes precedence over
413
+
any tracked mempool spend.
414
+
367
415
**Important Notes**:
368
416
- The `address` parameter is **required**. Compact block filters (BIP158) work by matching on scripts, not transaction IDs. Without the address, filter matching cannot work correctly.
369
417
- Specifying a `start_height` parameter is **highly recommended** for performance. Set it to the block height where the UTXO was created (or slightly before). Without it, the scan could take a very long time as it scans from the provided height to the current chain tip.
370
418
- The `start_height` means "start scanning FROM this height going FORWARD to the chain tip", not backwards.
371
419
- Performance scales with the scan range: scanning 1 block takes ~0.01s, scanning 100 blocks takes ~0.5s, scanning 10,000+ blocks can take minutes.
372
420
421
+
### Get Transaction (mempool only)
422
+
423
+
Fetch a serialized transaction by txid. With `MEMPOOL_ENABLED=true` (default)
424
+
the daemon returns the watched mempool tx if it has been observed; for any
425
+
other txid it responds with `501 Not Implemented` because compact block
426
+
filters do not allow looking up arbitrary historical transactions without a
427
+
full block download.
428
+
429
+
```bash
430
+
curl http://localhost:8334/v1/tx/<txid>
431
+
```
432
+
433
+
Response when the tx is in the watched mempool:
434
+
```json
435
+
{
436
+
"txid": "ccccdddd...",
437
+
"hex": "0200000001...",
438
+
"mempool": true
439
+
}
440
+
```
441
+
373
442
### Rescan
374
443
375
444
Trigger a blockchain rescan from a specific height:
Copy file name to clipboardExpand all lines: neutrino_server/cmd/neutrinod/main.go
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,7 @@ func main() {
46
46
cfilterCDNURL:=flag.String("cfilter-cdn-url", getEnv("CFILTER_CDN_URL", ""), "Override block-dn base URL for compact filter CDN downloads")
47
47
autoSyncWatched:=flag.Bool("auto-sync-watched", getEnvBool("AUTO_SYNC_WATCHED", true), "Continuously scan new blocks for watched addresses in the background, keeping the UTXO set up-to-date so /v1/utxos is instant")
48
48
autoSyncIntervalSec:=flag.Int("auto-sync-interval", getEnvInt("AUTO_SYNC_INTERVAL_SEC", 30), "Seconds between auto-sync polling passes for new blocks (only used when --auto-sync-watched is enabled)")
49
+
mempoolEnabled:=flag.Bool("mempool", getEnvBool("MEMPOOL_ENABLED", true), "Enable watched-only mempool tracking: relay tx invs from peers and track unconfirmed transactions matching watched addresses")
49
50
noAuth:=flag.Bool("no-auth", getEnvBool("NO_AUTH", false), "Disable TLS and token authentication (for development/regtest)")
50
51
resetAuth:=flag.Bool("reset-auth", false, "Regenerate TLS cert and auth token, clear watched addresses, then exit")
51
52
showVersion:=flag.Bool("version", false, "Show version and exit")
0 commit comments