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

Murmel BIP-157/158 Gap Analysis #37

Open
notmandatory opened this issue Jul 27, 2020 · 0 comments
Open

Murmel BIP-157/158 Gap Analysis #37

notmandatory opened this issue Jul 27, 2020 · 0 comments

Comments

@notmandatory
Copy link
Contributor

notmandatory commented Jul 27, 2020

This is an overview issue for discussion about how to make murmel a fully functional BIP-157/158 client. I'd like to make PRs or additional issues for each missing feature once we have consensus on the right approach.

The below BIP-157/158 protocol features are based on the BIP-157 Client Operation section. Please suggest additions and corrections in the comments.

Missing protocol features for Murmel are indicated below with an unchecked box [ ], completed features with a checked box [x].

Terminology

  • peer: bitcoin full node peer
  • block header: bitcoin standard block header
  • filter header: BIP-157 compact block filter header
  • block filter: BIP-157/158 compact block filter

Peer Discovery

    • Allow user to specify peer addresses
    • Receive peer addresses via [addr] messages from connected peers
    • Store new peer addresses
    • If no provided or previously stored peers, find seed peer addresses via DNS

Connect to Peers

    • Allow user to specify number of peers to connect to
    • Allow user to specify minimum number of BIP-157 peers to connect to
    • Connect to peers and request signalling bits via [version] message
    • Keep track of peers signalling service bit NODE_COMPACT_FILTERS
    • Connect to specified number of peers
    • Connect to minimum number of BIP-157 peers

Request Block Headers

    • Request block headers via [getheaders] message to connected peers
    • Request block headers from genesis to most work block, 1 to 2000 blocks per request
    • Optional: Request block headers from stored checkpoint block instead of genesis block

Receive Block Headers

    • Receive block headers [headers] from peers
    • Build chain of block headers from stored and received new block headers
    • Store new block headers and new block header tip
    • Disconnect peers whos longest chain has significantly less work than known tip
    • Request block filter headers from all peers for any new block header received

Request Filter Headers

    • Allow user to specify start block height for block filter sync
    • Request filter headers via [getcfheaders] message to peers
    • Request from start block height to end block hash (1-1000 per request)
    • Request filter headers for the same block from more than one peer
    • Optional: First request filter headers at intervals of 1000 via [getcfcheckpt] message

Receive Filter Headers

    • Receive filter headers [cfheaders] from peers
    • Verify filter headers from multiple peers are the same
    • If any received filter headers for a block are different,
      • request full block and compute correct block filter and filter header
      • ban peers that provided incorrect filter header
    • Build chain of filter headers from stored and received new filter headers
    • Store verified filter headers, at least to depth of 100
    • Request block filter for any new verified filter header
    • Optional: store more than 100 verified filter headers

Request Block Filters

    • Request block filters after all filter headers are received and verified
    • Request block filters from start block via [getcfilters] message to peers
    • Request from start block height to end block hash (1-1000 per request)
    • Optional: Check if filter header is for empty block filter if so skip request
    • Optional: Request different block filters in parallel from multiple peers

Receive Block Filters

    • Receive block filter [cfilter] from peers
    • Verify block filters sequentially, must link to corresponding filter header
    • Ban any peer that sends an invalid block filter
    • Check block filters for relevance
      • Previous output scripts for transaction inputs
      • ScriptPubKey for transaction outputs

Fetch Full Blocks

    • If fetching full blocks, download from random peers
    • Fetch full blocks from peers even if they don’t support compact block filters
    • Fetch full blocks that correspond to relevant block filters

Other Required Enhancements

    • Make syscall free similar to LDK
      • Traits for storage of peers, block headers, filter headers, block filters, blocks
      • Traits for network socket IO
    • Use latest rust async/.await
      • Refactor and remove existing futures alpha lib
      • Create tests and example cli based on tokio futures executor lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant