BN254_ADD
Elliptic curve
Point addition on the alt_bn128 (BN254) curve.
| Address | 0x0000000000000000000000000000000000000006 |
|---|---|
| Name | BN254_ADD |
| Minimum gas | 150 |
| Input | 128 bytes |
| Output | 64 bytes |
| Available since | Byzantium; repriced at Istanbul (EIP-1108) |
Input
x132 B
y132 B
x232 B
y232 B
| Offset | Length | Field | Description |
|---|---|---|---|
| 0 | 32 | x1 | X coordinate of the first point. |
| 32 | 32 | y1 | Y coordinate of the first point. |
| 64 | 32 | x2 | X coordinate of the second point. |
| 96 | 32 | y2 | Y coordinate of the second point. |
Output
The sum point as (x, y), 64 bytes.
Gas
150
Failure behaviour
- Reverts if either input point is not on the curve or a coordinate is not a valid field element.
- (0, 0) is the point at infinity and is accepted.
- 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_ADD at 0x06(bool ok, bytes memory out) = address(0x06).staticcall(input);require(ok, "BN254_ADD reverted");