Precompiles

The precompiles in zytron kit.

Precompiles

Currently zytron provides the following precompilers, which are placed at different addresses:

  • anemoi

  • ed_on_bn254

  • shuffle

  • matchmaking

  • shuffle

anemoi

Contract Name
Address

AnemoiJive254

0x00000000000000000000000000000000000000014

Input parameters are encoded in the following form:

bytes32[] memory data = /* .. */
bytes memory input = abi.encode(data)

address precompile = 0x00000000000000000000000000000000000000014;
precompile.staticcall(input);

ed_on_bn254

Contract Name
Address

EdOnBN254PointAdd

0x00000000000000000000000000000000000000015

EdOnBN254ScalarMul

0x00000000000000000000000000000000000000016

EdOnBN254PointAdd:

uint256 x1 = /* */;
uint256 y1 = /* */;
uint256 x2 = /* */;
uint256 y2 = /* */;

address precompile = 0x00000000000000000000000000000000000000015;
bytes memory output = precompile.staticcall(abi.encode(x1, y1, x2, y2));
(uint256 x, uint256 y) = abi.decode(output, (uint256 ,uint256));

EdOnBN254PointMul:

uint256 x = /* */;
uint256 y = /* */;
uint256 s = /* */;

address precompile = 0x00000000000000000000000000000000000000016;
bytes memory output = precompile.staticcall(abi.encode(x, y, s));
(uint256 x, uint256 y) = abi.decode(output, (uint256 ,uint256));

matchmaking

Contract Name
Address

VerifyMatchmaking

0x00000000000000000000000000000000000000017

Input parameters are encoded in the following form:

bytes memory verifier_params = /*  */;
bytes[] memory inputs = /*  */;
bytes[] memory outputs = /*  */;
bytes memory commitment = /*  */;
bytes memory random_number = /*  */;
bytes memory proof = /*  */;

address precompile = 0x00000000000000000000000000000000000000017;

require(precompile.staticcall(abi.encode(verifier_params, inputs, outputs, commitment, random_number, proof)));

shuffle

Contract Name
Address

Shuffle

0x00000000000000000000000000000000000000018

Input parameters are encoded in the following form:

bytes memory verifier_params = /*  */;
bytes[] memory input_cards = /*  */;
bytes[] memory output_cards = /*  */;
bytes memory proof = /*  */;

address precompile = 0x00000000000000000000000000000000000000018;

require(precompile.staticcall(abi.encode(verifier_params, input_cards, output_cards, proof)));

Last updated

Was this helpful?