Expand description
Implementation of the BLS12-381 Elliptic Curve operations for Solana syscalls.
This crate provides the native implementations for the syscalls defined in SIMD-0388.
§Supported Operations
- Group Operations (G1 & G2): Addition, Subtraction, Scalar Multiplication.
- Pairing: Product of pairings over G1/G2 point pairs (multi-Miller loop + final exponentiation).
- Validation: Subgroup and on-curve checks.
- Decompression: Converting compressed byte representations to affine points.
§Encoding and Endianness
The operations support two encoding formats defined in Endianness:
- Big-Endian (BE): Follows the Zcash BLS12-381 specification and IETF draft.
- Little-Endian (LE): This mirrors the Zcash structure but utilizes little-endian byte ordering for base field elements.
Structs§
- PodG1
Compressed - G1 compressed point (48 bytes).
- PodG1
Point - G1 affine point (96 bytes).
Represents
x(48 bytes) andy(48 bytes). - PodG2
Compressed - G2 compressed point (96 bytes).
- PodG2
Point - G2 affine point (192 bytes).
Represents
x(96 bytes) andy(96 bytes). - PodGt
Element - Target group element (Gt). Represents an element in the extension field Fq12 (576 bytes).
- PodScalar
- Scalar value (32 bytes).
Enums§
- Endianness
- Specifies the byte ordering for BLS12-381 field elements.
- Version
- Version identifier for the syscall interface.
Functions§
- bls12_
381_ g1_ addition_ unchecked - Performs point addition on G1:
P1 + P2. Does not check if points are in the correct subgroup for efficiency. - bls12_
381_ g1_ decompress - Decompresses a compressed G1 point.
- bls12_
381_ g1_ multiplication - Performs scalar multiplication on G1:
P * s. - bls12_
381_ g1_ point_ validation - Validates that a G1 point is on the curve and in the correct subgroup.
- bls12_
381_ g1_ subtraction_ unchecked - Performs point subtraction on G1:
P1 - P2. Does not check if points are in the correct subgroup for efficiency. - bls12_
381_ g2_ addition_ unchecked - Performs point addition on G2:
P1 + P2. - bls12_
381_ g2_ decompress - Decompresses a compressed G2 point.
- bls12_
381_ g2_ multiplication - Performs scalar multiplication on G2:
P * s. - bls12_
381_ g2_ point_ validation - Validates that a G2 point is on the curve and in the correct subgroup.
- bls12_
381_ g2_ subtraction_ unchecked - Performs point subtraction on G2:
P1 - P2. Does not check if points are in the correct subgroup for efficiency. - bls12_
381_ pairing_ map - Computes the product of pairings for a batch of G1 and G2 points.