Skip to main content

ConfirmedBlockHeightExists

Assertion whether a block with the specified blockNumber is confirmed with additional data to compute the block production rate within a given time window.

Supported chains

Network TypeSupported Chains
MainnetBTC (Bitcoin), DOGE (Dogecoin), XRP (XRP Ledger)
TestnettestBTC (Bitcoin Testnet v3), testDOGE, testXRP

Request

FieldSolidity TypeDescription
blockNumberuint64The block number to confirm.
queryWindowuint64The time period (in seconds) to calculate the block production rate.

Response

FieldSolidity TypeDescription
blockTimestampuint64The timestamp of the block at blockNumber.
numberOfConfirmationsuint64The required number of confirmations for the block to be considered confirmed (chain-specific).
lowestQueryWindowBlockNumberuint64The block number of the latest block with a timestamp strictly less than blockTimestamp - queryWindow.
lowestQueryWindowBlockTimestampuint64The timestamp of the block at lowestQueryWindowBlockNumber.

Verification process

  1. The function checks if the block with blockNumber is confirmed by at least the required numberOfConfirmations for the specified chain.
    • If the block does not meet this requirement, the request is rejected.
    • A block at the tip of the chain has exactly 1 confirmation.
  2. The lowestQueryWindowBlock` is identified, and its block number and timestamp are extracted.
  3. The required confirmations are defined based on chain-specific finality.
  4. The returned timestamp is:
    • mediantime for Bitcoin and Dogecoin.
    • close_time for XRPL.
Lowest used timestamp

For the lowestUsedTimestamp parameter, the value of lowestQueryWindowBlockTimestamp is used.

Finality

Blockchains have varying confirmation depths to consider blocks as final.

ChainchainIdConfirmations requiredConfirmation time
Bitcoin06≈60 mins
Dogecoin260≈60 mins
XRPL33≈12 seconds

Contract Interface

For the complete interface definition, see IConfirmedBlockHeightExists.