Skip to main content

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

NameTypeRequiredDescription
numBlocksintegerConditional*Number of blocks to pop off from the current height.
heightintegerConditional*Pop off to the specified height.
keepTransactionsbooleanNoIf true, transactions from popped blocks are re-processed. Defaults to false.
adminPasswordstringConditionalAdmin 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

FieldTypeDescription
blocksarrayArray of popped block objects.
blocks[].blockstringBlock string ID.
blocks[].heightintegerBlock height.
blocks[].generatorstringGenerator account ID.
blocks[].generatorPublicKeystringGenerator public key.
blocks[].timestampintegerBlock timestamp.
blocks[].numberOfTransactionsintegerNumber of transactions in the block.
blocks[].totalFeeFQTstringTotal fees in FQT.
blocks[].transactionsarrayTransaction full hashes or transaction objects.
blocks[].executedPhasedTransactionsarrayExecuted phased transactions if included.

Error Responses

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