Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Miden transaction prover
A service for generating Miden transaction proofs on-demand. The binary enables spawning workers and a proxy for Miden's remote transaction prover service.
The worker is a gRPC service that can receive transaction witnesses and returns the proof. It can only handle one request at a time and returns an error if is already in use.
The proxy uses Cloudflare's Pingora crate, which provides features to create a modular proxy. It is meant to handle multiple workers with a queue for each one, load balancing incoming requests in a round-robin manner. Further information about Pingora and its features can be found in the official GitHub repository.
Additionally, the library can be imported to utilize RemoteTransactionProver
, a client struct that can be used to interact with the prover service from a Rust codebase.
Installation
To build the service from a local version, from the root of the workspace you can run:
The CLI can be installed from the source code using specific git revisions with cargo install
. Note that since these aren't official releases we cannot provide much support for any issues you run into, so consider this for advanced users only.
Note that for the prover worker you might need to enable the testing
feature in case the transactions were executed with reduced proof-of-work requirements (or otherwise, the proving process will fail). This step will also generate the necessary protobuf-related files. You can achieve that by generating the binary with:
Worker
To start the worker service you will need to run:
This will spawn a worker using the hosts and ports defined in the command options. In case that one of the values is not present, it will default to 0.0.0.0
for the host and 50051
for the port.
Proxy
First, you need to create a configuration file for the proxy with:
This will create the miden-tx-prover.toml
file in your current directory. This file will hold the configuration for the proxy. You can modify the configuration by changing the host and ports of the services, and add workers. An example of a valid configuration is:
# Host of the proxy server
= "0.0.0.0"
# Port of the proxy server
= 8082
# Timeout for a new request to be completed
= 100
# Timeout for establishing a connection to the worker
= 10
# Maximum amount of items that a queue can handle
= 10
# Maximum amount of retries that a request can take
= 1
# Maximum amount of requests that a given IP address can make per second
= 5
[[]]
= "0.0.0.0"
= 8083
[[]]
= "0.0.0.0"
= 8084
To add more workers, you will need to add more items with the [[workers]]
tags.
Then, to start the proxy service, you will need to run:
This command will start the proxy using the workers defined in the configuration file to send transaction witness to prove.
At the moment, when a worker added to the proxy stops working and can not connect to it for a request, the connection is marked as retriable meaning that the proxy will try reaching the following worker in a round-robin fashion. The amount of retries is configurable changing the max_retries_per_request
value in the configuration file.
Both the worker and the proxy will use the info
log level by default, but it can be changed by setting the RUST_LOG
environment variable.
Features
Description of this crate's feature:
Features | Description |
---|---|
std |
Enable usage of Rust's std , use --no-default-features for no-std support. |
concurrent |
Enables concurrent code to speed up runtime execution. |
async |
Enables the RemoteTransactionProver struct, that implements an async version of TransactionProver trait. |
testing |
Enables testing utilities and reduces proof-of-work requirements to speed up tests' runtimes. |
Using RemoteTransactionProver
To use the RemoteTransactionProver
struct, enable async
. Additionally, when compiling for wasm32-unknown-unknown
, disable default features.
[dependencies]
miden-tx-prover = { version = "0.6", features = ["async"], default-features = false } # Uses tonic-web-wasm-client transport
miden-tx-prover = { version = "0.6", features = ["async"] } # Uses tonic's Channel transport