Contract 94131a01d894797658615651bb7bf5a3fac4cc6032411b219bafaaafd77754fe

← Back to Index 📥 Download WASM

Meta

rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.94.1

Instances

  • CCPG7LQMS4W3WHLWQK4JNLNGGMC66MQFZ37PAIVCGUVRJXJQIL7JJLES

Interface

fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Read a wallet's attestation.

Multi-wallet resolution (Option A — shared group score): if the wallet's own attestation carries an identity_commitment and a WalletIdentity contract is configured, the shared group attestation is returned instead, so any wallet in the group surfaces the same group score. That group score is a holistic union re-score (the off-chain attestor's attest_group merges every member wallet's on-chain history and scores it as one economic actor), not a per-wallet "best score" cherry-pick — one bad wallet cannot be hidden behind a better-scoring one in the same group. The querying wallet's own record is never exposed when a group score is available.

fn get_attestation(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
) -> Option

Optimistic hash-anchored attestation path. Stores the attestation without on-chain proof verification. zk_verified is always false.

fn attest_with_hash(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
    data: AttestationData,
) -> Result<(), soroban_sdk::Error>

Full Groth16 on-chain verification path.

If a verification key for data.distilled_model_hash has been registered via register_verification_key, the proof is verified on-chain and zk_verified is set to true. Otherwise falls back to the hash-anchored path with zk_verified = false (DG1 fallback behaviour).

fn attest_with_proof(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
    data: AttestationData,
    proof_bytes: soroban_sdk::Bytes,
) -> Result<(), soroban_sdk::Error>

Attest a wallet's risk from a RISC Zero zkVM Groth16 receipt (the distilled-model guest). Verifies the receipt against the whitelisted image id, then binds the proven journal fields (risk_bucket, confidence, identity_commitment, distilled_model_hash) into the stored attestation with zk_verified = true.

seal is the Groth16 proof (a|b|c, 256 bytes; selector stripped); journal is the 72-byte guest journal. Caller supplies the non-proven metadata in data (attestor, timestamps, model hashes); the proven fields are overwritten from the journal so the stored record always reflects the proof. Attest — or re-attest — a wallet from a RISC Zero receipt.

Unlike the hash/proof paths, this is no longer write-once: a wallet can re-attest after further on-chain activity to refresh its score. The only guard is monotonicity — data.issued_at must be strictly newer than the stored attestation's — so an older (possibly better) signed attestation cannot be replayed to shed a worse, more recent score. On-cha

fn attest_with_risc0(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
    data: AttestationData,
    seal: soroban_sdk::Bytes,
    journal: soroban_sdk::Bytes,
) -> Result<(), soroban_sdk::Error>

Register the whitelisted RISC Zero guest image id (the distilled-model guest). Admin-only. Only receipts from this image verify in attest_with_risc0.

fn set_risc0_image_id(
    env: soroban_sdk::Env,
    image_id: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>

Set the WalletIdentity contract address. Admin-only. Optional: when set, get_attestation resolves a wallet's identity_commitment to the shared group attestation (multi-wallet reputation sharing).

fn set_wallet_identity(
    env: soroban_sdk::Env,
    contract_id: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Set the AttestorRegistry contract address. Admin-only.

fn set_attestor_registry(
    env: soroban_sdk::Env,
    contract_id: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Register a Groth16 verification key for a distilled model. Admin-only. Must be called before attest_with_proof can set zk_verified = true for attestations using that model.

fn register_verification_key(
    env: soroban_sdk::Env,
    model_hash: soroban_sdk::BytesN<32>,
    vk_bytes: soroban_sdk::Bytes,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶