EIP-2539 BLS12-377 curve operations

No call decision · EVM & execution · EIP status Stagnant · created 2020-02-26

Adds nine precompiles for BLS12-377 elliptic curve operations to the EVM, enabling safer and more efficient BLS signature verification and SNARK verification.

Why it is needed

Ethereum already has a pairing precompile using the BN254 curve, but this curve only offers 80-bit security. Cryptographically important operations like BLS signature verification or SNARK proof verification require a curve with a higher security level to be handled more safely. In addition, batching multiple signatures or public keys through repeated CALLs is gas-expensive because of the overhead of the calls themselves, and there was no way to exploit the properties of the BLS12-377 curve proposed in the Zexe paper, which is favorable for recursive proof aggregation, within the EVM. This EIP solves this problem by adding BLS12-377 curve operations as precompiles, providing security of 120 bits or more.

What changes

Today

After EIP-2539

Who is affected

In depth

The nine precompiles and their addresses

Once the block number reaches X, this EIP introduces a total of nine precompiles: BLS12_377_G1ADD (0x15), G1MUL (0x16), G1MULTIEXP (0x17), G2ADD (0x18), G2MUL (0x19), G2MULTIEXP (0x1a), PAIRING (0x1b), MAP_FP_TO_G1 (0x1c), and MAP_FP2_TO_G2 (0x1d). G1 deals with the curve over the base field, and G2 deals with the twist over its quadratic extension field.

Curve parameters and security level

BLS12-377 is a curve proposed in the Zexe paper, defined by its base field modulus, B coefficient (A=0), order of the main subgroup, Fp2/Fp6/Fp12 extension tower constants, D-type twist parameters, G1/G2 generators, and the Miller loop scalar |x|=0x8508c00000000001 (x is non-negative). Whereas the existing BN254 precompile provides only 80-bit security, this curve targets 120 bits or more.

Field element and point encoding

Base field elements (Fp) are encoded as big-endian integers in 64 bytes (the upper 16 bytes are always zero), aligned this way for 32-byte-unit ABI alignment. Extension field elements (Fp2) are 128 bytes, formed by concatenating c0 and c1 each encoded separately. A G1 point is 128 bytes, concatenating x and y, and a G2 point is 256 bytes. Coordinates of (0,0) are used by convention to represent the point of infinity.

ABI for each operation

G1ADD takes a 256-byte input (two G1 points) and outputs 128 bytes; G1MUL takes 160 bytes (a point plus a scalar) and outputs 128 bytes. G1MULTIEXP takes a 160*k-byte input and outputs 128 bytes. G2ADD goes from 512 to 256 bytes, G2MUL from 288 to 256 bytes, and G2MULTIEXP from 288*k to 256 bytes. PAIRING takes 384*k bytes and outputs 32 bytes, with the last byte indicating the result. MAP_FP_TO_G1 goes from 64 to 128 bytes, and MAP_FP2_TO_G2 goes from 128 to 256 bytes. Any point not on the curve or input of invalid length triggers an error.

Gas schedule and multi-exponentiation discount

G1 addition costs 600 gas, G1 multiplication 12000 gas, G2 addition 4500 gas, and G2 multiplication 55000 gas. Multi-exponentiation assumes use of the Pippenger algorithm and applies a discount table up to k<=128, with cost calculated as k * multiplication_cost * discount / 1000; if k>128, the max_discount of 174 is applied. Pairing operations cost 55000*k + 65000 gas, mapping Fp to G1 costs 5500 gas, and mapping Fp2 to G2 costs 75000 gas.

Error handling and subgroup checks

If an error occurs during an operation, all gas allocated to that call must be consumed to prevent DDoS. Pairing calls require a subgroup check to confirm that G1/G2 points belong to the correct subgroup, and the spec notes that using a fast method such as wNAF can handle the combined G1 and G2 checks for about 35000 gas. However, this precompile does not require a constant-time implementation.

Current status and fork inclusion

This EIP is currently in Stagnant status, and the available call records contain no decision to include it in any specific fork. Accordingly, the addresses, gas figures, and block number condition (block.number >= X) stated in the body have not yet had their actual deployment timing finalized, and may change in the future.

Original EIP · ← EIPs