Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
preston4896 committed Sep 6, 2024
1 parent 0a3ac49 commit 5fe583c
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 48 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/hardhat.yml

This file was deleted.

76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,82 @@ Automata DCAP Attestation consists of three parts:

- Quote Verifier(s): This contract provides the full implementation on verifying a given quote specific to its version. This contract is intended to be called only from the Automata DCAP Attestation contract.

## On-Chain vs RiscZero Attestations

Automata DCAP Attestation contract implements two attestation methods available to users. Here is a quick comparison:

| | On-Chain | SNARK Proof with RiscZero |
| --- | --- | --- |
| Quote Verification Time | Instant | Proving takes 2 - 5 minutes, instant verification |
| Gas Cost | ~4M gas | 300k gas |
| Execution | Runs fully on-chain | The execution runs in a Guest program on Bonsai, which is then issued with a [Receipt](https://dev.risczero.com/api/zkvm/receipts). Verifiers should make sure the Receipt contains the expected Image ID, which can be generated directly from the Guest source code. After a successful execution of the Guest program, the proof is sent on-chain to be verified. |

## Integration

To integrate your contract with Automata DCAP Attestation, you need to first install [Foundry](https://book.getfoundry.sh/getting-started/installation).

Add to your dependency, by running:

```bash
forge install automata-network/automata-dcap-attestation
```

Then, add the following to your `remappings.txt`

```
@automata-network/dcap-attestation/=lib/automata-dcap-attestation/contracts/
```

### Example

```solidity
import "@automata-network/dcap-attestation/AutomataDcapAttestation.sol";
contract ExampleDcapContract {
AutomataDcapAttestation attest;
constructor(address _attest) {
attest = AutomataDcapAttestation(_attest);
}
// On-Chain Attestation example
function attestOnChain(bytes calldata quote) public {
(bool success, bytes memory output) = attest.verifyAndAttestOnChain(quote);
if (success) {
// ... implementation to handle successful attestations
} else {
string memory errorMessage = string(output);
// ... implementation to handle failed attestations
}
}
// RiscZero Attestation example
function attestWithRiscZero(bytes calldata journal, bytes calldata seal) public
{
(bool success, bytes memory output) = attest.verifyAndAttestWithZKProof(
journal,
seal
);
if (success) {
// ... implementation to handle successful attestations
} else {
string memory errorMessage = string(output);
// ... implementation to handle failed attestations
}
}
}
```

To execute the DCAP RiscZero Guest Program and fetch proofs from Bonsai, we recommend checking out the [DCAP Bonsai Demo CLI](https://github.com/automata-network/dcap-bonsai-cli).

---

# BUIDL 🛠️

## Getting Started

Clone this repo, by running the following command:
Expand Down

0 comments on commit 5fe583c

Please sign in to comment.