Skip to content

BN254_MUL

Elliptic curve

Scalar multiplication on the alt_bn128 (BN254) curve.

Address0x0000000000000000000000000000000000000007
NameBN254_MUL
Minimum gas6,000
Input96 bytes
Output64 bytes
Available sinceByzantium; repriced at Istanbul (EIP-1108)

Input

x32 B
y32 B
scalar32 B
OffsetLengthFieldDescription
032xX coordinate of the point.
3232yY coordinate of the point.
6432scalarThe scalar multiplier, big-endian.

Output

The product point as (x, y), 64 bytes.

Gas

6000

Failure behaviour

  • Reverts if the input point is not on the curve.
  • Input shorter than the expected length is right-padded with zero bytes rather than rejected.

Calling it

Precompiles have no ABI and no function selector: the input is raw bytes at the exact offsets above. Call with staticcall.

// BN254_MUL at 0x07
(bool ok, bytes memory out) = address(0x07).staticcall(input);
require(ok, "BN254_MUL reverted");

Specification

  • EIP-196: Precompiles for alt_bn128 addition and multiplication
  • EIP-1108: Reduce alt_bn128 precompile gas costs