paritytech / json-rpc-interface-spec

30 stars 3 forks source link

block number to hash #113

Open gilescope opened 1 year ago

gilescope commented 1 year ago

It's not uncommon for people to want to query from a particular block number rather than hash. Currently this is possible with the 'legacy' rpc mechanism in subxt to get a block hash for a particular block number, but is there a non-legacy mechanism?

(I saw on the subxt lounge element room that it's not uncommon to want to do such a thing and currently it's not as easy as it ought to be.)

lexnv commented 1 year ago

Hey Giles,

Soon, the archive methods will expose the archive_unstable_hashByHeight; which will handle most use-case I believe going back to genesis.

It might be worth adding a chainHead_hashByHeight as well that only works in the context of pinned blocks (@tomaka what do you think?)

tomaka commented 1 year ago

I don't see a reason why you would want to refer to blocks by their number except in an archive context.

Yes, people with limited technical knowledge want to do all sort of things, but that doesn't make it correct.