Skip to main content

pybn254

Accelerated operations for BN254 using libff and libfqfft.

Supported operations:

  • Multi-exponentiation in G1
  • FFT
  • Multiply polynomials

Install for pip

  • pip install pybn254

Build

Install python dependencies

Dependencies:

  • py_ecc

Compile native dependencies

MacOS

  • Install Homebrew
  • Install dependencies - brew install gmp boost cmake openssl libomp
  • Go into libff and run make all

This should create libff.dylib in the root folder.

Ubuntu

  • Install dependencies - sudo apt-get install build-essential git libboost-all-dev cmake libgmp3-dev libssl-dev pkg-config
  • Go into libff and run make all

This should create libff.so in the root folder.

Test

You can use the following script to test things out:

import pybn254

from py_ecc.optimized_bn128 import add, multiply, pairing
from py_ecc.fields import optimized_bn128_FQ as FQ

p = [(FQ(1), FQ(2), FQ(1))]
e = [5]

p1 = [1, 2, 3]
p2 = [4, 5, 6]

print(pybn254.multiexp(p,e))

# run fft, not an inverse, not on a coset
print(pybn254.fft(p1, False, False))
print(pybn254.multiply_polynomials(p1, p2))

Release files for pybn254 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pybn254 1.0.5
File Interpreter ABI Platform
pybn254-1.0.5-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
pybn254-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64 Details
pybn254-1.0.5-cp36-cp36m-macosx_10_14_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64 Details

Total release size: 6.8 MB

Release files / pybn254-1.0.5-cp36-cp36m-manylinux1_x86_64.whl

Download URL pybn254-1.0.5-cp36-cp36m-manylinux1_x86_64.whl
Size 2.3 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
a0cb4c30630264ae14df6531418d120d23b66c218b9cc5f0512462ce620adec7
BLAKE2b-256 checksum
How to use checksums
f1654285f8d170e82838452e025216a7b65ec572b7d8f65af2e4d3b177cdd430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.0

Release files / pybn254-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl

Download URL pybn254-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl
Size 2.3 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
474f9edab085899112a69451384fb829092fc8ff744b9bb52d32ed7b92b201f8
BLAKE2b-256 checksum
How to use checksums
bcdd600c1ad68d245a56fdad4b585cd360a17f9734204b5b6b346e50ca5c35f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.0

Release files / pybn254-1.0.5-cp36-cp36m-macosx_10_14_x86_64.whl

Download URL pybn254-1.0.5-cp36-cp36m-macosx_10_14_x86_64.whl
Size 2.3 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
c983fed4b93afd9684d39ebf760810add683b6cf31d74a4a959f650c1d19cb3a
BLAKE2b-256 checksum
How to use checksums
c10c043d187cd9069ae5e690df44329227b3663f5ef8478bbca2d1f88a2ae94a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.0

Release history Release notifications | RSS feed

This release

1.0.5 This release

3 release files

1.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page