get_epoch_by_number - Nervos

Returns the epoch in the canonical chain with the specific epoch number.

Parameters

  • epoch_number - Epoch number.

Returns

The RPC returns the epoch when epoch_number is less than or equal to the current epoch number returned by get_current_epoch and returns null otherwise.

Because of chain reorganization, for the same epoch_number, this RPC may return null or different epochs in different invocations.

Example

Request

curl --location --request POST 'https://ckb-mirana.unifra.io/v1/4fb36720a57340d39aee4cf68511064a' \
--header 'Content-Type: application/json' \
--data-raw '{
  "id": 42,
  "jsonrpc": "2.0",
  "method": "get_epoch_by_number",
  "params": [
    "0x0"
  ]
}'

Result

{
    "jsonrpc": "2.0",
    "result": {
        "compact_target": "0x1a08a97e",
        "length": "0x6cf",
        "number": "0x0",
        "start_number": "0x0"
    },
    "id": 42
}
Language
Click Try It! to start a request and see the response here!