Skip to main content

qn_getBlockFromTimestamp RPC Method

Retrieves the most recent block on the blockchain that was generated at or before the specified Unix timestamp (in seconds).

Updated on
Nov 6, 2024

qn_getBlockFromTimestamp RPC Method

Please note that this RPC method requires the Block Timestamp Lookup add-on enabled on your QuickNode endpoint. This method is available for mainnet only.

Parameters

timestamp
integer
REQUIRED
A Unix timestamp (in seconds) representing the time at or before which the desired block should be retrieved

Returns

result
object
The result object which contains the following fields:
network
string
The blockchain network on which the block exists
blockNumber
integer
The most recent block on the blockchain that was generated at or before the specified Unix timestamp
timestamp
integer
The actual timestamp of the returned block in seconds
Request
1
curl --location 'https://docs-demo.base-mainnet.quiknode.pro/' \
2
--header 'Content-Type: application/json' \
3
--data '{
4
"method": "qn_getBlockFromTimestamp",
5
"params": {
6
"timestamp": 1730000000
7
}
8
}'
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free