Crates.io | quartz-contract-core |
lib.rs | quartz-contract-core |
version | 0.1.0 |
source | src |
created_at | 2024-10-16 19:26:04.841792 |
updated_at | 2024-10-16 19:26:04.841792 |
description | A CosmWasm framework for securely interacting with Intel SGX enclaves. |
homepage | https://cycles.money |
repository | https://github.com/informalsystems/cycles-quartz |
max_upload_size | |
id | 1412236 |
size | 56,311 |
Quartz CosmWasm (quartz-contract-core) is a high-level framework for building attestation-aware smart contracts on CosmWasm. It provides a robust foundation for developing secure, Intel SGX-based contracts with built-in remote attestation support.
Attested<M, A>
wrapper for a message and its attestationdcap-verifier
and tcbinfo
contracts)See also the spec.md
Add quartz-contract-core
to your Cargo.toml
:
[dependencies]
quartz-contract-core = { path = "../packages/quartz-contract-core" }
Here's a basic example of how to use quartz-contract-core
in your CosmWasm contract:
use quartz_cw::prelude::*;
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response};
pub fn execute(
deps: DepsMut,
env: Env,
info: MessageInfo,
msg: QuartzExecuteMsg,
) -> Result<Response, ContractError> {
match msg {
QuartzExecuteMsg::Attested(attested_msg) => {
// Handle attested message
// Verification of the attestation is done automatically
let result = attested_msg.handle(deps, env, info)?;
Ok(result)
},
// Other message handlers...
}
}
Attested<M, A>
: A wrapper struct for holding a message and its attestation.Attestation
: A trait for attestation types (DCAP, Mock).HasUserData
: A trait for extracting user data from attestations.RawHandler
: A trait for handling raw messages.You can enable mock SGX support for testing by adding the mock-sgx
feature to your Cargo.toml
:
[dependencies]
quartz-contract-core = { path = "../packages/quartz-contract-core", features = ["mock-sgx"] }
To run the tests:
cargo test