Skip to content

A Simple CLI Tool To Generate SNARK Proof For DCAP Quote Verification

License

Notifications You must be signed in to change notification settings

automata-network/dcap-bonsai-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automata DCAP with Bonsai CLI Guide

Automata DCAP Bonsai CLI

Summary

This CLI tool is used to fetch SNARK proofs of execution on the DCAP Guest Application via Bonsai, and optionally submit them on-chain. The DCAP Guest Application proves that an Intel SGX DCAP quote has been successfully verified and the enclave which originated the quote is legitimate.

Follow these steps to get started with this tool:

  1. Install Rust

  2. Export BONSAI_API_KEY and BONSAI_API_URL values into the shell. If you don't have a Bonsai API key, send a request for one.

export BONSAI_API_KEY="" # see form linked above
export BONSAI_API_URL="" # provided with your api key
  1. Build the program.
cargo build --release

CLI Commands

You may run the following command to see available commands.

./target/release/app --help

Outputs:

Gets Bonsai Proof for DCAP QuoteV3 Verification and submits on-chain

Usage: app <COMMAND>

Commands:
  prove        Fetches proof from Bonsai and sends them on-chain to verify DCAP quote
  image-id     Computes the Image ID of the Guest application
  deserialize  De-serializes and prints information about the Output
  help         Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

To get help on individual commands (e.g. prove), do the following:

./target/release/app prove --help

Output:

Fetches proof from Bonsai and sends them on-chain to verify DCAP quote

Usage: app prove [OPTIONS]

Options:
  -q, --quote-hex <QUOTE_HEX>
          The input quote provided as a hex string, this overwrites the --quote-path argument
  -p, --quote-path <QUOTE_PATH>
          Optional: The path to a quote.hex file. Default: /data/quote.hex or overwritten by the --quote-hex argument if provided
  -k, --wallet-key <WALLET_PRIVATE_KEY>
          Optional: A transaction will not be sent if left blank
  -h, --help
          Print help

Get Started

You may either pass your quote as a hexstring with the --quote-hex flag, or as a stored hexfile in /data/quote.hex. If you store your quote elsewhere, you may pass the path with the --quote-path flag.

Note

Beware that passing quotes with the --quote-hex flag overwrites passing quotes with the --quote-path flag.

It is also recommended to set the environment value RUST_LOG=info to view logs.

To begin, run the command below:

RUST_LOG=info ./target/release/app prove

About

A Simple CLI Tool To Generate SNARK Proof For DCAP Quote Verification

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages