Use Ethereum precompiled pairing operations (BN128, specified in EIP196) in Python
Project description
How to Install
pip install py_eth_pairing
How to Build from Source
- Install Cargo for Rust
curl https://sh.rustup.rs -sSf | sh
- Install Maturin
pip install Maturin
- Compile it
maturin develop --release
How to Use
Please check test.py
as an example
from py_eth_pairing import curve_add, curve_mul, pairing2, curve_negate
from py_ecc.bn128 import G1, G2
curve_add(G1, G1)
sk = 100
g1_pk = curve_mul(G1, sk)
actual = pairing2(curve_negate(G1), G2, G1, G2)
Performance
The unit of time is second.
curve_add
6.985664367675781e-05
curev_mul
0.00014019012451171875
pairing2
0.0034821033477783203
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for py_eth_pairing-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92e06a091d307c39b7201539cccada5a50eacba7fd0c6144be448569059e9454 |
|
MD5 | b5b5f588aec5fe1b2dfeda116f47824e |
|
BLAKE2b-256 | 47d9da5ce2e16c8216826c8e9939952897f041ed816992dfb9486060f52aeb6b |
Close
Hashes for py_eth_pairing-0.1.4-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7869299456d7f10a89625f0105457a83035fdb8e34935c5b5c11820d597e01d0 |
|
MD5 | 93da2a5645740462c653581c20fbda4f |
|
BLAKE2b-256 | 15718290bff3a7f8979077da801bf9f1034a5634c09933bc1cafc59f4f3b4aa0 |