Skip to content

M1.2 Headers-first sync to tip with full PoW + difficulty validation #8

Closed

Description

@melvincarvalho

Part of #1 (M1).

Goal

Using the engine's HeaderEngine, sync all mainnet headers to chaintip via the bridge (#? M1.1), validating prev-link, proof of work, timestamps, version rules, and the 2016-block retarget.

Benchmark / acceptance

  • Sync mainnet headers to tip; report total time and peak memory.
  • validateChain passes for the entire chain.
  • Tip hash matches a public block explorer.

Notes

No signatures here, so it is fast and honest: it is real consensus validation of the header chain. This is the Tier 0 backbone.

Activity

  1. melvincarvalho commented on Jun 18, 2026

    @melvincarvalho
    ContributorAuthor

    Done on testnet4 (the agreed first target; mainnet is a network-param flip).

    src/sync-testnet4.js connects to a live testnet4 peer over TCP, syncs the header chain from genesis with a per-batch connectivity check, and fully validates it via HeaderEngine.validateChain (PoW, difficulty, BIP 94 timewarp, the 20-minute min-difficulty walk-back).

    Measured: ~140k headers downloaded in ~3-9s, all valid, tip confirmed by 2/2 independent p2p peers (no third-party API). Validation runs ~15-21k headers/sec on the pure-JS engine, single core.

    Acceptance met: validateChain passes for the whole chain; tip cross-checked. Resume + reorg + most-work across peers continues in #9 (M1.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions