|
1 | | -[](https://systemslibrarian.github.io/crypto-lab/) |
2 | | -[](https://github.com/systemslibrarian/crypto-lab-pairing-gate/actions/workflows/pages.yml) |
3 | | - |
4 | 1 | # crypto-lab-pairing-gate |
5 | 2 |
|
6 | | -## 1. What It Is |
| 3 | +## What It Is |
7 | 4 |
|
8 | 5 | crypto-lab-pairing-gate implements BLS signatures and signature aggregation over BLS12-381, a pairing-friendly elliptic curve designed by Sean Bowe for Zcash and adopted by Ethereum 2.0. A bilinear pairing `e: G1 × G2 → GT` is a map satisfying `e(aP, bQ) = e(P, Q)^(ab)`, enabling verification of n aggregated signatures with only two pairing operations regardless of n. BLS signature unforgeability (EUF-CMA) is proven under the computational co-Diffie-Hellman assumption (co-CDH) in the random-oracle model. Note that the *decisional* Diffie-Hellman problem is **easy** in the source groups G1/G2 — given `(P, aP, bP, cP)` one simply checks `e(aP, bP) = e(P, cP)` — which is precisely the gap-Diffie-Hellman structure that pairings provide. BLS12-381 offers approximately 128-bit classical security and **no** post-quantum security: like every elliptic-curve and pairing-based scheme, it is broken outright by Shor's algorithm on a sufficiently large quantum computer. |
9 | 6 |
|
10 | | -## 2. When to Use It |
| 7 | +## When to Use It |
11 | 8 |
|
12 | 9 | - Use BLS signatures when you need to aggregate many signatures on the same message into one — consensus protocols, threshold schemes, and multi-party attestations. |
13 | 10 | - Use BLS12-381 specifically when your application requires pairing-based ZK-SNARK verification (Groth16) alongside signature operations. |
14 | 11 | - Do not use BLS when signature verification speed is critical for a single signer — Ed25519 is significantly faster for individual signatures. |
15 | 12 | - Do not use naive BLS aggregation without Proof of Possession or equivalent rogue key protection — the rogue key attack allows an attacker to forge aggregate signatures. |
16 | 13 | - Do not use BLS for post-quantum security — BLS12-381 has no post-quantum security. Shor's algorithm recovers the private key from any public key in polynomial time on a cryptographically relevant quantum computer (CRQC). |
| 14 | +- Do NOT use this implementation in production — it is a browser teaching demo; use a vetted BLS library (e.g. blst) for real deployments. |
17 | 15 |
|
18 | | -## 3. Live Demo |
| 16 | +## Live Demo |
19 | 17 |
|
20 | | -[https://systemslibrarian.github.io/crypto-lab-pairing-gate/](https://systemslibrarian.github.io/crypto-lab-pairing-gate/) |
| 18 | +**[systemslibrarian.github.io/crypto-lab-pairing-gate](https://systemslibrarian.github.io/crypto-lab-pairing-gate/)** |
21 | 19 |
|
22 | 20 | Generate BLS keypairs, sign messages, and verify signatures using real BLS12-381 arithmetic via `@noble/curves`. The sign/verify section lets you generate a keypair, sign an arbitrary message, verify the pairing equation, and tamper with the signature to observe verification failure. The aggregation visualizer has a signer-count slider (2–100), generates all keypairs and signatures, then animates them collapsing into a single 48-byte aggregate signature verified with two pairings. |
23 | 21 |
|
24 | | -## 4. What Can Go Wrong |
| 22 | +## What Can Go Wrong |
25 | 23 |
|
26 | 24 | - **Rogue key attack:** without Proof of Possession, an attacker who registers a maliciously computed public key can forge an aggregate signature that passes verification using only their own private key. |
27 | 25 | - **Subgroup membership checks:** points presented as G1 or G2 elements must be checked for subgroup membership before use — skipping this check can allow small-subgroup attacks. |
28 | 26 | - **Signing the same message across different contexts:** BLS aggregation assumes all signers sign the same message; mixing messages requires per-message pairing checks, losing the O(1) verification benefit. |
29 | 27 | - **Implementation bugs in hash-to-curve:** RFC 9380 specifies the hash-to-curve procedure; non-compliant implementations produce points that may not match across libraries. |
30 | 28 | - **Post-quantum exposure:** BLS12-381 has no quantum resistance. Once a CRQC exists, any deployed key becomes forgeable and previously recorded signatures lose non-repudiation; migrating to a post-quantum signature scheme is the only mitigation. |
31 | 29 |
|
32 | | -## 5. Real-World Usage |
| 30 | +## Real-World Usage |
33 | 31 |
|
34 | 32 | - **Ethereum 2.0 beacon chain:** aggregates validator attestations using BLS12-381 with Proof of Possession, enabling ~450,000 validators to attest per slot with a manageable verification cost. |
35 | 33 | - **Zcash Sapling:** BLS12-381 was designed for Zcash's Groth16 zk-SNARK verifier, where pairing equations check proof validity. |
36 | 34 | - **Internet Computer (DFINITY):** uses BLS threshold signatures for chain-key cryptography, enabling deterministic randomness beacons and cross-subnet message authentication. |
37 | 35 | - **Filecoin:** aggregates miner message signatures using BLS to reduce on-chain transaction size. |
38 | 36 | - **Ethereum EIP-2537:** adds BLS12-381 precompiles to the EVM, enabling smart contracts to verify BLS signatures and pairings on-chain. |
39 | 37 |
|
40 | | -## Cross-links |
| 38 | +## How to Run Locally |
| 39 | + |
| 40 | +```bash |
| 41 | +git clone https://github.com/systemslibrarian/crypto-lab-pairing-gate |
| 42 | +cd crypto-lab-pairing-gate |
| 43 | +npm install |
| 44 | +npm run dev |
| 45 | +``` |
41 | 46 |
|
42 | | -- [Hybrid Wire](https://systemslibrarian.github.io/crypto-lab-hybrid-wire/) — X25519 + ML-KEM key exchange |
43 | | -- [ZK Proof Lab](https://systemslibrarian.github.io/crypto-lab-zk-proof-lab/) — Groth16 and Schnorr ZK proofs |
44 | | -- [Curve Lens](https://systemslibrarian.github.io/crypto-lab-curve-lens/) — elliptic curve point arithmetic |
45 | | -- [FROST Threshold](https://systemslibrarian.github.io/crypto-lab-frost-threshold/) — threshold signatures |
46 | | -- [crypto-lab home](https://systemslibrarian.github.io/crypto-lab/) |
| 47 | +## Related Demos |
| 48 | + |
| 49 | +- [crypto-lab-ibe-gate](https://systemslibrarian.github.io/crypto-lab-ibe-gate/) — Boneh-Franklin identity-based encryption over the same BLS12-381 pairing. |
| 50 | +- [crypto-lab-frost-threshold](https://systemslibrarian.github.io/crypto-lab-frost-threshold/) — threshold signatures (FROST over Ed25519). |
| 51 | +- [crypto-lab-ed25519-forge](https://systemslibrarian.github.io/crypto-lab-ed25519-forge/) — Ed25519 EdDSA, the fast single-signer alternative to BLS. |
| 52 | +- [crypto-lab-zk-proof-lab](https://systemslibrarian.github.io/crypto-lab-zk-proof-lab/) — Groth16 and Schnorr ZK proofs. |
47 | 53 |
|
48 | 54 | --- |
49 | 55 |
|
50 | | -*"So whether you eat or drink or whatever you do, do it all for the glory of God." — 1 Corinthians 10:31* |
| 56 | +*One of 60+ browser demos in the [Crypto Lab](https://crypto-lab.systemslibrarian.dev/) suite.* |
| 57 | + |
| 58 | +*"So whether you eat or drink or whatever you do, do it all for the glory of God." — 1 Corinthians 10:31* |
0 commit comments