Skip to content

Generate a validation proof over bitcoin block headers using StarkWare's Cairo toolchain

License

Notifications You must be signed in to change notification settings

lucidLuckylee/LightSync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

The latest light version is currently integrated in ZeroSync itself

LightSync

LightSync is the light client version of ZeroSync that validates batches of Bitoin block headers and attests to their correct validation using a STARK proof. This allows anyone to simply verify the proof and use the resulting header chain as if they validated the blocks themselves.

The proof confirms the correct execution of:

  • A header chain structure (every encoded previous block is the actual previous block)
  • Proof of Work validation (every block hash is below the encoded target)
  • Correct retargeting (the target is correctly calculated from the epoch timestamps)
  • The validation of each block's minimum timestamp (median of previous eleven blocks)

Additionally the program output contains a Merkle root (from a Merkle tree over all block headers in the batch) that can be used to proof inclusion of block headers in the batch at a later point (e.g. for SPV).

All of this is experimental research code and CONTAINS CRITICAL SECURITY BUGS!

Current Status

See src/chain_proof/main.py for an example on how to call the program and receive a computation trace that can then be proven using e.g. giza.

Essentially creating a chain of batches only requires checking the input and output state of each batch validation run to be equal. Further, the batch size should be verified against the current block height.

There is no recursive verifier added yet, however, if you have access to StarkWare's proving systems you can add their recursive verifier and create a cairo program that verifies the LightSync main.cairo execution as stated above.

Requirements

Tests

Cairo

We provide tests using protostar.

protostar test --cairo-path=./src

About

Generate a validation proof over bitcoin block headers using StarkWare's Cairo toolchain

Resources

License

Stars

Watchers

Forks