Overview
When requesting a proof, requestors need to upload both their program binary (ELF) and the associated inputs to a compatible storage provider. This allows the prover to download the required program and inputs to begin proving. For most use cases, storing these publicly is acceptable. However, in situations where the program inputs are sensitive, Boundless allows requestors to work with trusted provers. This allows requestors to effectively store inputs privately on Amazon S3 for storage. With an appropriate bucket policy (and optional KMS key policy for server-side encryption), only provers with the necessary IAM role can download the input file and begin proving. This guide walks through the setup necessary, for both the requestor and prover, to enable secure s3 inputs for a given proof request.Prerequisites
- The aws CLI installed and configured with the requestor’s AWS credentials.
- Requestor: An AWS account with S3 (and optionally KMS) access.
- Prover: A set of AWS credentials which map to a valid AWS account ID.
Requestor
Summary
The general workflow for the requestor is:- Create an S3 bucket
- Create an IAM role for the prover (using AWS account ID from the prover)
- Upload the inputs to that S3 bucket
- (Optional) Enable SSE-KMS for server-side encryption
- Gate access to the S3 bucket to only the prover IAM role
- Request a proof with the S3 url as the input URL
1. Create the S3 bucket
To continue, an AWS account is required. After that, you’ll need the AWS CLI to set up your S3 bucket, create roles and set the required policies.You can follow the official instructions at Step 1: Create your first S3 bucket.
123456789012-boundless-prover-prod-us-east-1
To find your account ID, you can use the CLI:
2. Create the required prover role
An IAM role is an AWS identity with its own permission policy that any trusted user, service, or account can temporarily assume to get short-lived credentials instead of keeping permanent keys.To learn more, please see IAM Roles.
- A JSON specifying the trust policy for the IAM role.
- The prover’s AWS 12-digit account ID.
prover-trust-policy.json
222222222222 with the AWS account ID of the prover.
Saving the above as prover-trust-policy.json, next:
3. Upload the Input file to S3
Replace<YOUR_BUCKET>, <PATH>, and optionally <KMS_KEY_ID>, with the correct paths:
3a. (Optional) KMS key policy
When using server-side encryption with AWS KMS keys (known as SSE-KMS), S3 will call kms Decrypt every time someone requests to download the object; if the prover role lackskms:Decrypt permission on that key, the download is blocked with an AccessDenied.
This server-side encryption adds another check on top of the IAM role requirement. For some use cases, at-rest encryption is necessary for compliance (HIPAA, SOC 2 etc.).
If you enabled --sse-kms in Upload the input file to S3, you can specify the key policy either way the KMS console or via the AWS CLI. For up to date information on how to do that, please refer to the official AWS Change a Key Policy documentation.
An example key policy would be:
4. Set Bucket Policy
From the requestor side, we need to limit access to the input file to provers with the right AWS credentials. In practice, this means S3 will only complete theGetObject call for provers with credentials matching the allowed IAM role. To enforce this, the requestor needs to set a bucket policy.
A bucket policy is a JSON document attached to an S3 bucket. This JSON specifies how to allow or deny requests based on:
- who is calling (the Principal)
- what the call asks for (the Action)
- which bucket/resource to give access to (the Resource)
prover_policy.json:
prover_policy.json
<PROVER_ROLE_ARN> can download the input file they need to start proving.
The <PROVER_ROLE_ARN> string refers to the full Amazon Resource Name (ARN) of the IAM role created for the prover. This was generated during Create the required prover role.
Make sure to replace <PROVER_ROLE_ARN> with the string we saved earlier, something like:
prover-policy.json, you can set the policy on your bucket with:
5. Submit a Request to the Boundless market
With your inputs now sitting privately in S3, you may now request a proof.Uploading your inputs using the Boundless SDK
If you have already uploaded your inputs using theaws CLI above, you can skip the information below. Otherwise, if you are interested in using the Boundless SDK to upload your inputs to your S3 bucket, you will need to:
- make sure your AWS credentials are set in environment variables, specifically:
AWS_ACCESS_KEY_IDfor the access key (optional if using the AWS default credential chain)AWS_SECRET_ACCESS_KEYfor the secret key (optional if using the AWS default credential chain)S3_BUCKETfor the bucket name of the bucket created in Create the S3 bucketS3_URLfor the bucket endpoint URL of the bucket created in Create the S3 bucketAWS_REGIONfor the bucket region- and last, but not least, make sure
S3_PRESIGNED=falseto use direct S3 URLs
Relevant Links:
StorageUploader, StorageUploaderConfig.
Prover
Summary
The general workflow for the prover is:- Export base AWS credentials to environment variables
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGION
- Export IAM role to assume to environment variable
AWS_ROLE_ARN
- Spin up the broker
- Test with aws cli:
assume-roleto verify credentials
1. Set AWS credentials in environment variables
The prover has to make sure that the Docker container that runs the broker starts with two kinds of AWS credentials in its environment:- base credentials (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandAWS_REGION) which will be used to call sts::AssumeRole. - the role to assume (e.g.
AWS_ROLE_ARN=arn:aws:iam::<PROVER_ACCOUNT_ID>:role/ProverInputDownloadRolewhich is generated when the requestor created the role during Create the required prover role).
2. Verify IAM role authentication
With the environment variables set:One-off test for prover to verify everything is working