Skip to main content

Crate solana_bls12_381_syscall

Crate solana_bls12_381_syscall 

Source
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:

  1. Big-Endian (BE): Follows the Zcash BLS12-381 specification and IETF draft.
  2. Little-Endian (LE): This mirrors the Zcash structure but utilizes little-endian byte ordering for base field elements.

Structs§

PodG1Compressed
G1 compressed point (48 bytes).
PodG1Point
G1 affine point (96 bytes). Represents x (48 bytes) and y (48 bytes).
PodG2Compressed
G2 compressed point (96 bytes).
PodG2Point
G2 affine point (192 bytes). Represents x (96 bytes) and y (96 bytes).
PodGtElement
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.