Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the /headers[/:from_hash[/:count]] endpoint #41

Draft
wants to merge 1 commit into
base: new-index
Choose a base branch
from

Commits on Dec 10, 2021

  1. Add the /headers[/:from_hash[/:count]] endpoint

    Add a new endpoint to download headers in bulk, up to 2000 with a single
    request.
    
    Headers are returned in binary form, with the VarInt-encoded number of
    items in the body preceeding them.
    
    By default `from_hash` is the current best hash, but a different
    starting block can be specified.
    
    The returned list goes "backwards" returning the `count - 1` blocks
    *before* `from_hash` plus the header of `from_hash` itself. This allows
    caching the response indefinitely, since it's guaranteed that the
    headers that come before a given block will never change.
    
    Returns an error if `from_hash` is not a valid block or it isn't found
    in the blockchain.
    
    If `count` is greater than the limit of `2000` it will be silently
    capped to said value.
    afilini committed Dec 10, 2021
    Configuration menu
    Copy the full SHA
    bf26302 View commit details
    Browse the repository at this point in the history