Scan
Scans the blockchain for validation, either from a specific height or by a number of blocks from the current tip. Requires admin password. This is a POST-only endpoint.
Request
POST /nxt?requestType=scan&adminPassword=<adminPassword>&numBlocks=<number>&height=<number>&validate=<boolean>
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
numBlocks | integer | Conditional* | Number of blocks to scan backwards from current height. |
height | integer | Conditional* | Height to scan to. |
validate | boolean | No | If true, validates blocks during scan. Defaults to false. |
adminPassword | string | Conditional | Admin password required if nxt.adminPassword is set. |
*Either numBlocks or height must be provided.
Response
{
"done": true,
"scanTime": 12.5
}
Response Fields
| Field | Type | Description |
|---|---|---|
done | boolean | true if the scan completed successfully. |
scanTime | number | Time taken for the scan in seconds. |
Error Responses
| Condition | Response |
|---|---|
Neither numBlocks nor height provided | {"error": "numBlocks", "errorDescription": "numBlocks or height is required"} |
| Runtime exception during scan | Error response from JSONData.putException() |
Notes
- This endpoint does not require the blockchain to be running (
requireBlockchain = false). - Not chain-specific.
- Requires admin password authentication (
requirePassword = true). - Requires POST method (
requirePost = true). - Uses
Nxt.getBlockchainProcessor().scan()internally.
Source: Scan.java.
Example
curl -X POST "http://localhost:22024/nxt" \
-d "requestType=scan" \
-d "adminPassword=mySecretPassword" \
-d "numBlocks=100" \
-d "validate=true"