The address 0x8 contains bn256Pairing pre-compiled contract on Byzantium release. I have the following questions :

  1. If I have G_1 = G_2, i.e., a symmetric pairing, is it possible to check e(a_1, b_1) ?= e(a_2, b_2) ? If yes, how do I pass the arguments because the specification uses a representation like ai+b.
  2. What is the exact encoding of the elements to be used? Is there a sample code or test case reference available? I'm trying to use assembly calls inside Solidity contracts.

In case it is not possible to use the pre-compiled contracts, can I edit the geth source code and test it on a private network? If yes, where can I add the relevant functions inside the source?

  • The pairing check only works over the particular groups defined by y^2=x^3+3 on the fields F_p, F_p^2 Mar 2 '18 at 22:50
  • In particular, the pairing is type-3, i.e. not symmetric Mar 2 '18 at 23:20
  • Thanks. If I want to write a function into geth source and test on a private network, any pointer as to how to do that? Mar 3 '18 at 3:56
  • This commit added a bunch, it might help you out github.com/ethereum/go-ethereum/commit/… Mar 3 '18 at 5:23

To whoever stumbled upon this question looking for a solution:

I edited core/vm/contracts.go to add relevant pre-compiled contracts. I used PBC package to implement the symmetric bilinear pairing. The structure of function same as other pre-compiled contract functions defined in that file.

Works well in a private network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.