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:
- User Bets: Participants place bets predicting the timestamp closest to the one hashed in the Bitcoin block header.
- 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).
- 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.
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:
- Verification of SXG Signatures: Using the server’s
secp256r1
TLS certificate. Contracts for verification can be found here : https://github.com/crema-labs/sxg-sp1/blob/feat-bitbet/contracts/src/Sxg.sol - Content Integrity Validation: Via the MICE (Merkle Integrity Content Encoding) standard and the
mi-sha256
hash function.
This guarantees the content retrieved from cryptoid.info is cryptographically verified off-chain before generating a proof.
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.
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.
- Install
pnpm
. - Build the project with
pnpm build
Make sure to have the backend running before starting the frontend and correctly set in config.json.
- Start the frontend with
pnpm serve
.
- Install
go
. - Run
go mod tidy
- Add Priv_key with gas on the required chain and
SP1_PRIVATE_KEY
for prover net access in config.json - Terminal 1 :
go run ./cmd/server.go
- Terminal 2 :
go run ./cmd/relay/relay.go
"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