Pop Off
Removes recent blocks from the blockchain. Transactions from popped blocks can optionally be kept for reprocessing. Requires admin password. This is a POST-only endpoint.
Request
POST /nxt?requestType=popOff&adminPassword=<adminPassword>&numBlocks=<number>&height=<number>&keepTransactions=<boolean>
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
numBlocks | integer | Conditional* | Number of blocks to pop off from the current height. |
height | integer | Conditional* | Pop off to the specified height. |
keepTransactions | boolean | No | If true, transactions from popped blocks are re-processed. Defaults to false. |
adminPassword | string | Conditional | Admin password required if nxt.adminPassword is set. |
*Either numBlocks or height must be provided.
Response
{
"blocks": [
{
"block": "1234567890123456789",
"height": 1000,
"generator": "1234567890123456789",
"generatorPublicKey": "abc123...",
"timestamp": 1234567890,
"numberOfTransactions": 10,
"totalFeeFQT": "1000000",
"version": 3,
"baseTarget": "12345",
"cumulativeDifficulty": "1234567890",
"previousBlock": "1234567890123456788",
"nextBlock": "0",
"payloadHash": "abc123...",
"generationSignature": "abc123...",
"previousBlockHash": "abc123...",
"blockSignature": "abc123...",
"transactions": ["fullHash1", "fullHash2"],
"executedPhasedTransactions": []
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
blocks | array | Array of popped block objects. |
blocks[].block | string | Block string ID. |
blocks[].height | integer | Block height. |
blocks[].generator | string | Generator account ID. |
blocks[].generatorPublicKey | string | Generator public key. |
blocks[].timestamp | integer | Block timestamp. |
blocks[].numberOfTransactions | integer | Number of transactions in the block. |
blocks[].totalFeeFQT | string | Total fees in FQT. |
blocks[].transactions | array | Transaction full hashes or transaction objects. |
blocks[].executedPhasedTransactions | array | Executed phased transactions if included. |
Error Responses
| Condition | Response |
|---|---|
Neither numBlocks nor height provided | {"error": "numBlocks", "errorDescription": "numBlocks or height is required"} |
| Runtime exception during pop | 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). - Blocks are represented using
JSONData.block()which includes all block fields and optionally transactions.
Source: PopOff.java.
Example
curl -X POST "http://localhost:22024/nxt" \
-d "requestType=popOff" \
-d "adminPassword=mySecretPassword" \
-d "numBlocks=10" \
-d "keepTransactions=true"