Overview
Address:0x000000000000000000000000000000000000000f
Introduced: Prague (EIP-2537)
EIP: EIP-2537
The BLS12-381 G2 Mul precompile performs scalar multiplication on the BLS12-381 curve’s G2 group. It multiplies a G2 point by a scalar, computing scalar * point. This operation is fundamental for BLS signature schemes, zero-knowledge proofs, and cryptographic protocols requiring operations over extension fields.
BLS12-381 provides 128 bits of security and is the foundation of Ethereum 2.0’s consensus layer signature scheme.
Gas Cost
Fixed:45000 gas
G2 vs G1
G2 scalar multiplication operates on points over the Fp2 extension field:- G1 points: 128 bytes (2 Fp coordinates)
- G2 points: 256 bytes (2 Fp2 coordinates)
- G1 mul gas: 12,000
- G2 mul gas: 45,000 (3.75x more expensive)
- Cost driver: Extension field arithmetic is significantly more complex
Input Format
y^2 = x^3 + 4(1 + u) over Fp2.
Scalar can be any 256-bit value (automatically reduced modulo curve order).
Output Format
Usage Example
TypeScript
Zig
Error Conditions
- Out of gas: gasLimit < 45,000
- Invalid input length: input.len != 288
- Point not on curve: coordinates don’t satisfy G2 curve equation
- Invalid field element: coordinate component >= field modulus
- Invalid point: point not in correct subgroup
Use Cases
- BLS signature verification: Key derivation and signature operations
- Threshold signatures: Generate signature shares
- Key generation: Derive public keys from private scalars
- Commitment schemes: Pedersen-like commitments over G2
- Zero-knowledge proofs: zkSNARKs and zkSTARKs on BLS12-381
- Ethereum 2.0: Validator key operations
Implementation Details
- Zig: Uses BLST library optimized for BLS12-381
- TypeScript: Wraps @noble/curves bls12-381 G2 operations
- Algorithm: Windowed scalar multiplication for efficiency
- Security: Constant-time execution prevents timing attacks
- Optimization: Double-and-add with precomputed tables
Special Cases
- Scalar = 0: Returns point at infinity (256 bytes of zeros)
- Scalar = 1: Returns input point unchanged
- Scalar = group order: Returns point at infinity (r*P = O)
- Point at infinity input: Returns point at infinity regardless of scalar
- Scalar > group order: Automatically reduced modulo group order
Scalar Arithmetic
Scalars are elements of F_r where r is the curve order:- Group order (r): Same as BLS12-381 scalar field order
- Modular reduction: Scalars wrap around modulo r
- Zero scalar: Always produces point at infinity
- Negative scalars: Equivalent to positive via modular arithmetic
Extension Field Operations
G2 scalar multiplication involves Fp2 arithmetic:- Field elements:
a = a.c0 + a.c1*uwhere u^2 + 1 = 0 - Point doubling: Requires Fp2 squaring and multiplication
- Point addition: Complex formula over extension field
- Cost: Each Fp2 operation is ~3-4x more expensive than Fp
Gas Comparison
| Operation | G1 Gas | G2 Gas | Ratio |
|---|---|---|---|
| Addition | 500 | 800 | 1.6x |
| Multiplication | 12,000 | 45,000 | 3.75x |
| MSM (base) | 12,000 | 45,000 | 3.75x |
Performance Considerations
- Expensive operation: 45,000 gas is substantial
- Batch with MSM: For multiple scalar muls, use G2 MSM with discount
- Precomputation: Cache commonly used multiples when possible
- G1 vs G2 choice: Use G1 operations when either group works
- Signature verification: Typically requires 1-2 G2 muls
Test Vectors
BLS Signature Context
In BLS signature schemes:- Public keys: Often G2 points derived via scalar multiplication
- Signature verification: Requires G2 scalar operations
- Key aggregation: Combine public keys via G2 addition
- Threshold schemes: Generate key shares with G2 mul
Security Considerations
- 128-bit security: BLS12-381 provides quantum-resistant classical security
- Side-channel resistance: Constant-time implementation prevents timing attacks
- Subgroup checks: Implementation validates points are in correct subgroup
- Field validation: Coordinates must be valid field elements
Gas Cost Justification
The 45,000 gas cost reflects:- Extension field arithmetic: Fp2 operations are computationally intensive
- Security overhead: Subgroup and validity checks
- Scalar multiplication: Requires ~255 point operations on average
- Memory operations: 256-byte point representation

