# How to use Ethereum precompile bn256Pairing to check equality on symmetric groups?

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 – Tjaden Hess Mar 2 '18 at 22:50
• In particular, the pairing is type-3, i.e. not symmetric – Tjaden Hess 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? – pseudorandom Mar 3 '18 at 3:56
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.