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 Distribution
py-eth-pairing-0.1.2.tar.gz
(2.3 kB
view hashes)
Built Distributions
Close
Hashes for py_eth_pairing-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c357b3db389817dac378078a7d33d8dccfebdd868282fdcb94fea2c487b06924 |
|
MD5 | 32eaaf56258634fddfb36a2fe31c8af0 |
|
BLAKE2b-256 | e0ad85d9f00ad6551ade8e755c5aff332001b70f25c26cb8319ce50a18f517f2 |
Close
Hashes for py_eth_pairing-0.1.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27e78f6d4b2a06e3642e624126f3d645f6a0f43fdfa1d031a14ab8f17645125d |
|
MD5 | 7264f5afba59dceea40447f4ad93442b |
|
BLAKE2b-256 | 51c1d1393363ae9eb9c17dd52da7d84b092545b25c810eb4d56792613fb791d3 |