This is the Prover Server for Zorkin. It's a REST API Wrapper for go-rapidsnark, with AWS CloudFormation based deployment config to deploy an ARM64 build of the prover to AWS Lambda with AWS ECR, exposed behind a Lambda function URL with IAM authorization. To make minimal changes to the server itself, so it can remain a standard HTTPs server, aws-lambda-web-adapter is leveraged.
List of implemented features:
- Generate proof
- Verify proof
- Edit config file
configs/prover.yaml
- Put compiled circuits into
<circuitsBasePath>/<circuitName>
directory. Where<circuitsBasePath>
is config option with default valuecircuits
, and<circuitName>
is name of the circuit that will be passed as a param to an API call. See SnarkJS Readme for instructions on how to compile circuits.
Assuming you're on linux or macos, the Docker image can be built and deployed to AWS ECR as follows with AWS CloudFormation as follows. It assumes you have the AWS CLI installed. Please provide your values for AWS_ACCOUNT_ID
and AWS_REGION
environment variables to a .env
file.
make deploy-ecr-image
Once the image is deployed to ECR, create the AWS Lambda stack using CloudFormation (see template.yaml) as follows. Set the ImageUri
parameter to the ECR image URI created in the previous step. Provide an ARN of a principal IAM identity, such as a user, for the ZorkinPrincipalUser
parameter. This IAM identity will receive permission to invoke the function via the function URL.
make deploy-sam
To remove a deployment, the following command can be used:
make delete-stack
Did you receive a pass init error? See https://docs.docker.com/desktop/get-started/#credentials-management-for-linux-users.
POST /api/v1/proof/generate
Content-Type: application/json
{
"inputs": {...}, // circuit specific inputs
"circuit_name": "..." // name of a directory containing circuit_final.zkey, verification_key.json and circuit.wasm files
}
Please check the LICENSE file for more details.