- Install from git
pip install git+http://github.com/apollozkp/fourier.git
- Import client
from fourier import Client
- Start client
client = Client(port=1337)
Start the Rust RPC server and ping it to check if it is running.
client.start()
Stop the Rust RPC server.
client.stop()
Ping the Rust RPC server.
client.ping()
# {'jsonrpc': '2.0', 'result': 'pong', 'id': 1}
Compute a commitment to a polynomial.
# base64 encoded coefficients of polynomial
poly = ["AQB...", ..., "AQB..."]
client.commit(poly=poly)
# {'jsonrpc': '2.0', 'result': {'commitment': '123...efg'}, 'id': 1}
Open a polynomial at a point.
# base64 encoded coefficients of polynomial
poly = ["AQB...", ..., "AQB..."]
# base64 encoded point
x = "AQB..."
client.open(poly=poly, x=x)
# {'jsonrpc': '2.0', 'result': {'proof': '123...efg'}, 'id': 1}
Verify a proof of polynomial at a point.
# base64 encoded proof
proof = "AQB..."
# base64 encoded point
x = "AQB..."
# base64 encoded value of polynomial at x
y = "AQB..."
# base64 encoded commitment
commitment = "AQB..."
client.verify(proof=proof, x=x, y=y, commitment=commitment)
# {'jsonrpc': '2.0', {'valid': True}, 'id': 1}
Generate a random polynomial.
# degree of polynomial
degree = 10
client.random_poly(degree=degree)
# {'jsonrpc': '2.0', 'result': {'poly': ['123...efg', ..., '123...efg']}, 'id': 1}