Cayman
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Consensus Light Client Server Implementation Notes > How we tweaked our Lodestar beacon node to serve light clients ## API endpoints ### `GET /eth/lightclient/init_proof/:epoch` > Get an "init proof" required to bootstrap a light client from a trusted checkpoint We assume that a light client may need to be bootstrapped from a trusted checkpoint, similar to beacon nodes during a checkpoint sync from a weak subjectivity checkpoint. The end result of the bootstrapping is that the light client has a trusted `LightClientSnapshot`, and can begin syncing. The requested `epoch` is expected to be finalized (and is why the checkpoint root is not passed in the request). This endpoint returns a beacon state multiproof containing `current_sync_committee`, `next_sync_committee`, `genesis_time`, and `genesis_validators_root`. The multiproof should be created/verified against the `BeaconBlockHeader.state_root` at the trusted checkpoint root. ### `GET /eth/lightclient/best_updates?from=from_period&to=to_period` Once the light client is bootstrapped with a `LightClientSnapshot`, its next task is to sync to the finalized state. This is accomplished by processing `LightClientUpdate`s, one after another, one per sync committee period. The consensus specs detail how to apply `LightClientUpdate`s to update a `LightClientSnapshot`. This endpoint returns the 'best', ie the most voted and latest, `LightClientUpdate` for every sync committee period between `from_period` and `to_period`. With this response, a light client should be able to sync through sync committee `to_period`. ### `GET /eth/lightclient/latest_update_finalized` Once a light client is synced to the most recent sync committee period, it may want to sync further to the latest finalized state. This can be triggered every epoch to remain synced to the finalized state. This endpoint returns the latest `LightClientUpdate` that contains a finality proof. ### `GET /eth/lightclient/latest_update_unfinalized` A light client may be able to navigate the unfinalized chain, and want to sync to the head (head - 1) of the chain. This endpoint returns the latest `LightClientUpdate` that doesn't contain a finality proof. ## Producing init proofs We want to provide init proofs for every recent finalized checkpoint. We store the following information to disk: - sync committee, indexed by period - To avoid excessive disk usage, the sync committees are stored separately so they may be deduplicated - init proof w/o sync committees, indexed by epoch We add a script that runs on each new finalized checkpoint. The steps look as follows: ``` on_finalized(checkpoint): # return early for any checkpoint that occurs before altair # fetch the block header at checkpoint.root # fetch the state at the block header state_root # this state will be used to create the init proof # create a multiproof with: # - current_sync_committee # - next_sync_committee # - genesis_time # - genesis_validators_root # splice the sync committee sections from the rest of the multiproof # store the multiproof, key by epoch # store the sync committees, key by period ``` On init proof request (requested by epoch), the multiproof and relevant committees are stitched back together. ## Producing `LightClientUpdate`s We want to provide a good update per sync committee period. We also want to provide recent updates (most recent finalized and unfinalized). A `LightClientUpdate` can be created / consumed in two different modes: with and without a finality header / branch. ### With a finality header / branch When a `LightClientUpdate` contains a finality header / branch, the interpretation of the update is as follows: - The `header` is the header corresponding to the finalized state - The `next_sync_committee` is the committee from the finalized state - The `next_sync_committee_branch` is a single proof from finalized state to its `next_sync_committee` - The `finality_header` corresponds to a more recent state that contains the finalized state in its `finalized_checkpoint`. - The `finality_branch` is a single proof from the more recent state to its its `finalized_checkpoint`. - The `sync_committee_bits` and `sync_committee_signature` attest to the `finality_header` ### Without a finality header / branch When a `LightClientUpdate` contains a zeroed finality header / branch, the interpretation of the update is as follows: - The `header` corresponds to a recent state - The `next_sync_committee` is the committee from the recent state - The `next_sync_committee_branch` is a single proof from recent state to its `next_sync_committee` - The `sync_committee_bits` and `sync_committee_signature` attest to the `header` We store the following information to disk: - sync committee, indexed by period - used to populate the `next_sync_committee` - `header` and `next_sync_committee_branch`, indexed by epoch - used to populate the update in the finalized case - `LightClientUpdate`, indexed by period - best update per committee period - a single latest finalized `LightClientUpdate` - a single latest unfinalized `LightClientUpdate` On every finalized checkpoint, we store the `header` and `next_sync_committee_branch` of that finalized checkpoint. On every new head, we run the following steps: ``` on_head(block, post_state): # return early for any block that occurs before altair # store (in cache), indexed by block root: # - the block header, finalized checkpoint, finality branch and next committee branch # these items are not used until the next block is processed # get the prior block root # this is the block that the current block's sync aggregate attests to # get (from cache): # - last block's block header, finalized checkpoint, finality branch and next committee branch # these items are used for further steps # create/store a finalized update: # fetch the finalized header and next committee branch from disk # assemble the update # if the update is better than the pre-existing best # overwrite the update to disk - the best update per committee period # if the update is later than the pre-existing latest finalized update # overwrite the update to disk - the latest finalized update # create/store an unfinalized update: # assemble the unfinalized update # if the update is later than the pre-existing latest unfinalized update # overwrite the update to disk - the latest unfinalized update ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully