BUIP058: Dynamic checkpoints

Discussion in 'Bitcoin Unlimited' started by freetrader, May 19, 2017.

  1. freetrader

    freetrader
    Expand Collapse
    Moderator
    Staff Member

    Joined:
    Dec 16, 2015
    Messages:
    1,812
    Likes:
    4,457
    Summary

    Add a feature which allows dynamic addition and removal of non-hardcoded checkpoints.

    Checkpoints denote blocks that must be present in a valid chain. A checkpoint is a tuple (chain_height, block_hash) indicating that the block at that height must always have the given hash.

    Currently, there are only some hardcoded checkpoints in src/chainparams.cpp (not frequently updated).

    Motivation

    To allow more flexible, persistent protection of a chain against re-organization [1], at the discretion of the operator.

    This could be particularly useful in a hard fork scenario such as the very contentious "breaking of the 1MB barrier".

    Having an advanced user option to add checkpoints saves the operator from having to use 'invalidateblock' as a way of fighting attacker re-org blocks, essentially saving effort and reducing chance of costly mistake.

    Since additional checkpoints may act to block re-organizations to a longer valid chain with more proof-of-work, this feature should be considered as an expert tool, probably only to be used by operators of mining nodes.

    Implementation

    An RPC call interface shall be added to add and remove dynamic checkpoints.

    Whenever a dynamic checkpoint is added or removed, the active chain shall be re-evaluated for compliance and if necessary, a re-organization performed in an attempt to achieve compliance with the stipulated checkpoints.

    The dynamic checkpoints shall be recorded in a human-readable checkpoint data file (e.g. checkpoints.csv) whenever the list changes.

    At startup, the client shall read this file, if present, and add any checkpoints from there to its list of built-in checkpoints used for chain processing.

    The client shall abort startup if the checkpoint data file is malformed (see Notes). If the file is not present, it shall proceed using only the built-in (hardcoded) checkpoints.

    The RPC interface does not need to be specially exposed through the GUI - it would be available through the Debug Console anyway.

    It shall not be possible to dynamically remove built-in checkpoints.

    Notes

    A checkpoint data file is malformed if it is syntactically invalid, or if it contains the following semantic problems:
    • duplicate entries
    • entries with conflicting hashes for identical height
    • entries with conflicting height for identical hashes
    There have been a number of suggestions for potential names of the RPC calls.

    Adding: 'mandateblock', 'requireblock', 'addcheckpoint'

    The removal call names could be formed by pre-prending 'un-', or substituting 'remove' for 'add'.

    I have intentionally not included some form of automatic addition of checkpoints in the form discussed in [2], to keep this BUIP functionally simple.

    References

    [1] https://bitcointalk.org/index.php?topic=437
    [2] https://bitco.in/forum/threads/buip...by-a-support-threshold.2111/page-2#post-39031
     
    #1 freetrader, May 19, 2017
    Last edited: May 21, 2017
    HostFat and Bloomie like this.
  2. freetrader

    freetrader
    Expand Collapse
    Moderator
    Staff Member

    Joined:
    Dec 16, 2015
    Messages:
    1,812
    Likes:
    4,457
    @solex : can I provisionally grab the number 58 for this one, and add it to the upcoming vote?
     
    solex likes this.
  3. freetrader

    freetrader
    Expand Collapse
    Moderator
    Staff Member

    Joined:
    Dec 16, 2015
    Messages:
    1,812
    Likes:
    4,457
    I have provisionally renamed this to BUIP058. If there is a conflict please let me know.

    I request this BUIP to be included in upcoming vote, as I believe from a user requirement POV it is very simple to understand what this feature must deliver.

    There may be some implementation complexity since dynamic addition/removal of checkpoints must be processed correctly w.r.t. the active chain, but I think those challenges are resolvable. The dynamic checkpoint removal will not be allowed to remove the built-in checkpoints.
     
  4. solex

    solex
    Expand Collapse
    Moderator
    Staff Member

    Joined:
    Aug 22, 2015
    Messages:
    959
    Likes:
    3,050
    @freetrader certainly, It's added to the index as 58.
    As far as voting is concerned there needs to be a 14 day window for public consultation after the Developer has finished discussing and revising the BUIP with the proposer.
     
    Collapse Signature Expand Signature
  5. freetrader

    freetrader
    Expand Collapse
    Moderator
    Staff Member

    Joined:
    Dec 16, 2015
    Messages:
    1,812
    Likes:
    4,457
    @solex - Got it, thanks for reminding me of the 2 week windows (one for the Developer, and a subsequent one for public). Next voting round it is then for BUIPs 58 & 59.