EIPs/EIPS/eip-1108.md

2.1 KiB

eip title author status type category created requires
1108 Reduce alt_bn128 precompile gas costs Antonio Salazar Cardozo (@shadowfiend) Draft Standards Track Core 2018-05-21 196, 197

Short Description

Recent changes to the underlying library used by the official Go reference implementation led to significant performance gains for the ECADD, ECMUL, and pairing check precompiled contracts on the alt_bn128 elliptic curve, which should be reflected in reduced gas costs.

Motivation

Recently, the underlying library used by the official Go reference implementation to implement the ECADD (at address 0x06), ECMUL (at address 0x07), and pairing check (at address 0x08) precompiled contracts was shifted to Cloudflare's bn256 library. Based on the initial PR that introduced this change, and corroborated in a later note, the computational cost of ECADD, ECMUL, and pairing checks (excepting the constant) has dropped roughly an order of magnitude across the board.

Specification

Following is a table with the current gas cost and new gas cost:

Contract Address Current Gas Cost Updated Gas Cost
ECADD 0x06 500[1] 50
ECMUL 0x07 40 000[1] 2 000
Pairing check 0x08 80 000k + 100 000[2] 5 500k + 80 000

The gas costs for ECADD and ECMUL are updates to the costs listed in EIP-196, while the gas costs for the pairing check are updates to the cost listed in EIP-197.

[1]- Per EIP-196.

[2]- Per EIP-197.