Bitcoin Forum
November 08, 2024, 09:10:14 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: ElectrumX JSON-RPC - get timestamp for block  (Read 80 times)
RoxxR (OP)
Full Member
***
Offline Offline

Activity: 209
Merit: 148


View Profile
April 26, 2022, 08:58:59 AM
Merited by hugeblack (3), NeuroticFish (1)
 #1

RPC wizards: How would you get the timestamp of a block (or series of blocks), given the block index(es)?
pooya87
Legendary
*
Offline Offline

Activity: 3626
Merit: 11020


Crypto Swap Exchange


View Profile
April 26, 2022, 10:21:06 AM
Merited by hugeblack (4), NeuroticFish (2), ABCbits (1)
 #2

The protocol allows you to call blockchain.block.header(height, cp_height=0) with a block height (index) and get the 80 byte header as bytes. The 4 bytes from 68 to 72 are the block's timestamp in little endian order.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
RoxxR (OP)
Full Member
***
Offline Offline

Activity: 209
Merit: 148


View Profile
April 26, 2022, 08:55:21 PM
 #3

The protocol allows you to call blockchain.block.header(height, cp_height=0) with a block height (index) and get the 80 byte header as bytes. The 4 bytes from 68 to 72 are the block's timestamp in little endian order.

Awesome! Thanks; I'll give this a try
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!