Skip to content

A Go relayer that handles proof generation and relay for tickbit contracts

Notifications You must be signed in to change notification settings

crema-labs/TickBit

Repository files navigation

Logo

Verifiable Compression Block Proofs with Zero Knowledge and Signed Exchanges

Table of Contents

  1. About Project
  2. Screenshots
  3. Key Features
  4. Project Setup
  5. Deployments

About Project

TickBit introduces an engaging betting mechanism where users can wager on the precise interval in which a Bitcoin block will be mined. Here's how it works:

  1. User Bets: Participants place bets predicting the timestamp closest to the one hashed in the Bitcoin block header.
  2. Relayer Proofs: Relayers, acting as verifiable intermediaries, generate cryptographic proofs that a valid Bitcoin block has been indexed by the indexer (e.g., cryptoid.info).
  3. Determine the Winner: The bet closest to the actual mined timestamp wins, verified through provable inclusion of the block hash. TickBit showcases the power of verifiable data integrity and ZKP to make decentralized betting seamless, transparent, and trustless.

(back to top)

Screenshots

(back to top)

Key Features

Signed Exchanges (SXG)

TickBit leverages Google’s SXG protocol to ensure privacy-preserving prefetched content verification. SXG enables relayers to fetch critical resources (like HTML, JavaScript, or Bitcoin block hashes) from a website while ensuring authenticity through:

This guarantees the content retrieved from cryptoid.info is cryptographically verified off-chain before generating a proof.

Zero-Knowledge Proofs (ZKP)

TickBit implements zk-SNARKs (Groth16) for verifiable compression, reducing expensive on-chain operations to a single 160-byte proof. This makes on-chain verification both efficient and cost-effective, even when dealing with large datasets like web responses.

Applications of ZKP in TickBit:

  • Verifiable Compression: Ensures that the proof of a block's inclusion is constant-sized, regardless of the webpage’s data size.
  • Optional Privacy: ZKP circuits can be extended to enable private bets or private verification of transaction details within the Bitcoin block.

Integrity Hash Generation

For proof generation, the platform uses the mi-sha256 algorithm:

  • Integrity for all records (except the last) is generated as:
proof(r[i]) = SHA-256(r[i] || proof(r[i+1]) || 0x1)
  • For the last record:
proof(r[last]) = SHA-256(r[last] || 0x0)

This ensures that every element in the data stream is cryptographically linked to the final proof.

(back to top)

Project Setup

Frontend

  1. Install pnpm.
  2. Build the project with pnpm build

    Make sure to have the backend running before starting the frontend and correctly set in config.json.

  3. Start the frontend with pnpm serve.

Backend

  1. Install go.
  2. Run go mod tidy
  3. Add Priv_key with gas on the required chain and SP1_PRIVATE_KEY for prover net access in config.json
  4. Terminal 1 : go run ./cmd/server.go
  5. Terminal 2 : go run ./cmd/relay/relay.go

(back to top)

Deployments

       "44787": {
           "TB_ADDRESS": "0xfb8cf1e65b8d5a699ffa86235941319d44156701"
       },
       "23295": {
           "TB_ADDRESS": "0x07105F2BFf5297352F5d7012aD1D9D49a54BDE9E"
       },
       "48899": {
           "TB_ADDRESS": "0x6FD83f25F7DFe95e1e4d5f7cee9a85f1938e0E5D"
       },
       "84532": {
           "TB_ADDRESS": "0x6FD83f25F7DFe95e1e4d5f7cee9a85f1938e0E5D"
       },
       "2442": {
           "TB_ADDRESS": "0x6FD83f25F7DFe95e1e4d5f7cee9a85f1938e0E5D"
       },
       "534351": {
           "TB_ADDRESS": "0x6FD83f25F7DFe95e1e4d5f7cee9a85f1938e0E5D"
       },
       "30": {
           "TB_ADDRESS": "0x6FD83f25F7DFe95e1e4d5f7cee9a85f1938e0E5D"
       }

Made with ❤️ at ETH Bangkok

About

A Go relayer that handles proof generation and relay for tickbit contracts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages