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

SPV checklist #1000

43 tasks done
jrick opened this issue Nov 17, 2017 · 2 comments
43 tasks done

SPV checklist #1000

jrick opened this issue Nov 17, 2017 · 2 comments


Copy link

jrick commented Nov 17, 2017


  • return headers starting at the fork point for a getheaders request (getheaders does not handle sidechains correctly at all dcrd#427)
  • add gcs and gcs/builder packages
  • advertise cf support with a service flag when enabled
  • bump protocol version for the new service flag and new messages
  • support new cf messages in the serverPeer: getcfheaders, getcfilter, getcftypes, cfheaders, cfilter, cftypes
  • add json-rpc support for cfilters so wallet can continue to save cfilters to the database when not running in spv mode
  • add json-rpc client support for the new RPCs


  • Basic header verification
    • Check reported difficulty in header is valid
    • Check proof of work against the header's reported difficulty
    • Validate sdiff when DCP0001 deployment is active
    • Validate merkle roots of fetched blocks
    • Validate cfilters of matched and fetched blocks
  • Validate that fetched full blocks' transaction merkle trees match the merkle roots in the header
  • Save compact filters to DB
    • filter headers will not be saved nor checked at this time, but will need to be handled later for multipeer
    • all filters will be saved so that the client can more quickly perform an "exists address" check, and then only pull blocks which may contain the address
    • database upgrade will be a two step process
      • upgrade schema to add fields for the filters
      • on first start after upgrade, download all missing cfilters
        • this is extremely slow currently and we need a batched request a la getheaders
  • Fetch and save cfilters even when running with the JSON-RPC backend
  • implement the wallet.NetworkBackend interface using the wire protocol
    • GetHeaders
    • LoadTxFilter
    • Rescan
    • AddressesUsed (removing, address usage scanning will get new algorithm)
    • GetBlock (new addition to the interface)
    • GetBlocks (also new)
    • PublishTransaction
    • StakeDifficulty (when DCP0001 is active, sdiff will be calculated by the wallet. this is a fallback when not active, and is only queryable with dcrd RPC)
  • GetBlockHash (being removed when the dcrd getheaders bug is fixed)
  • Implement new DiscoverActiveAddresses algorithm that scans saved cfilters and fetches full blocks
    • new implementation is significantly slower on a lightly used testnet wallet. many places to apply optimization still. fixed
  • Implement account restores during DiscoverActiveAddresses
  • Add DNS peer discovery
  • Add P2P peer discovery
  • Implement multipeer syncing
  • Disconnect from peers behind our main chain
  • Disconnect peers that aren't announcing new blocks announced by other peers within some time limit ignoring for now, dcrd has same issue currently
  • Remove reorg handling as it is currently performed through dcrd notifications and replace with determining locally which is the best fork
    • Implement sidechain and orphan block management
    • Choose best sidechain based on total work, not height
  • Listen for transaction invs and save unmined transactions which are relevant to the wallet
    • May need some protection and additional data in the unmined transaction records in the database to prevent announcing invalid transactions to other peers
  • Write a new ticketbuyer that doesn't rely on dcrd RPC.
  • Disable certain functionality when operating in SPV mode
    • Voting (winning tickets are not in the header nor is there anything anchoring them with a merkleroot)
    • Revoking missed tickets before their expiry period (unknown whether the ticket is live or missed)
Copy link

vctt94 commented May 9, 2018

Can I work on Disable certain functionality when operating in SPV mode ?

Copy link
Member Author

jrick commented Jul 16, 2018

All items have been completed. See #1213 for implementation.

@jrick jrick closed this as completed Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants