diff --git a/.github/workflows/hardhat.yml b/.github/workflows/hardhat.yml deleted file mode 100644 index 6557c65..0000000 --- a/.github/workflows/hardhat.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Hardhat CI/CD - -on: - push: - branches: [main] - pull_request: - branches: [main] - - workflow_dispatch: - -env: - # default hardhat key, do not use this for prod - PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" - FORK_URL: https://rpc.goerli.linea.build - ENCLAVE_IDENTITY_HELPER: "0x4DfeFC7d9b139D5DD5837075FFd7CB340994d6bc" - FMSPC_TCB_HELPER: "0xd7e1EE3d83baa20eA9ee5c42BcCCEDA411E2F02F" - X509_CRL_HELPER: "0x74a4A96787D23058A67d9799F4Ac62379a1a3136" - X509_HELPER: "0xaa27A6a77D6F23b0346863E732beF8D0DaF7c61E" - ENCLAVE_IDENTITY_DAO_PORTAL: "0xeAce48c11258Ec79c941Daee80343298dC084Be3" - FMSPC_TCB_DAO_PORTAL: "0x1930D878D4BAbb10b2C20F65D84a54fdf709959A" - PCS_DAO_PORTAL: "0xC4838158D29C7DB6D344dDB4C082dB0f30C8073e" - -jobs: - check: - strategy: - fail-fast: true - - name: Hardhat project - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.x' - cache: 'npm' - - - name: Install dependencies - run: npm install - - - name: Compile the contracts - run: npx hardhat compile - - - name: Run test(s) - run: npx hardhat test \ No newline at end of file diff --git a/README.md b/README.md index 7ac153f..b473879 100644 --- a/README.md +++ b/README.md @@ -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: