Skip to main content

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

NameTypeRequiredDescription
numBlocksintegerConditional*Number of blocks to scan backwards from current height.
heightintegerConditional*Height to scan to.
validatebooleanNoIf true, validates blocks during scan. Defaults to false.
adminPasswordstringConditionalAdmin password required if nxt.adminPassword is set.

*Either numBlocks or height must be provided.

Response

{
"done": true,
"scanTime": 12.5
}

Response Fields

FieldTypeDescription
donebooleantrue if the scan completed successfully.
scanTimenumberTime taken for the scan in seconds.

Error Responses

ConditionResponse
Neither numBlocks nor height provided{"error": "numBlocks", "errorDescription": "numBlocks or height is required"}
Runtime exception during scanError 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"