csv-adapter-aptos 0.1.1

Aptos adapter for CSV (Client-Side Validation) with resource-based seals
Documentation

CSV Adapter Aptos

Crates.io Documentation License

Aptos adapter for CSV (Client-Side Validation) with resource-based seals.

Overview

This crate implements the AnchorLayer trait for Aptos, using Move resources with key + delete as seals. Aptos provides L2 Type-Enforced single-use through the Move language's resource model — resources cannot be duplicated or dropped, only moved or destroyed.

Key Features

  • Resource Seals: Move resource lifecycle management (L2 Type-Enforced)
  • Event Proofs: Commitment publication via Aptos events
  • HotStuff Finality: Deterministic finality via 2f+1 certification
  • Ed25519 Signatures: Native Aptos signing scheme
  • Testnet Support: Full testnet RPC compatibility
  • Mock RPC: Built-in mock for offline testing

Installation

cargo add csv-adapter-aptos

Or in your Cargo.toml:

[dependencies]
csv-adapter-aptos = "0.1"

Features

Feature Description Default
rpc Enable real Aptos RPC client with aptos-sdk
aptos-sdk Enable full Aptos SDK integration

Quick Start

Creating an Aptos Anchor Layer

use csv_adapter_aptos::{AptosAnchorLayer, AptosConfig, AptosNetwork};

// Create adapter with mock RPC for testing
let adapter = AptosAnchorLayer::with_mock().unwrap();

// Or with configuration (requires `rpc` feature)
// let config = AptosConfig::new(AptosNetwork::Devnet);
// let rpc = ...;
// let adapter = AptosAnchorLayer::from_config(config, rpc).unwrap();

Working with Resource Seals

use csv_adapter_aptos::AptosAnchorLayer;
use csv_adapter_core::{Hash, AnchorLayer};

let adapter = AptosAnchorLayer::with_mock()?;

// Create a seal from a Move resource
let seal = adapter.create_seal(Some(resource_address))?;

// Publish a commitment
let commitment = Hash::new([0xAB; 32]);
let anchor = adapter.publish(commitment, seal)?;

Checkpoint Proof Verification

use csv_adapter_aptos::CheckpointVerifier;

// Verify HotStuff consensus certification
let verifier = CheckpointVerifier::new(ledger_info);
let is_final = verifier.verify_finality(&transaction)?;

Architecture

AptosAnchorLayer
├── Resource Seals     ← L2 Type-Enforced single-use (Move)
├── Event Proofs       ← Commitment publication via events
├── Ledger Info        ← HotStuff consensus finality
├── Seal Registry      ← Double-spend prevention
└── RPC Client         ← Aptos fullnode interaction (optional)

Seal Lifecycle

  1. Create: Derive a seal from a Move resource address
  2. Consume: Destroy the resource via move_from (seal is gone)
  3. Anchor: Emit event with commitment hash
  4. Verify: Ledger info proof confirms consensus finality

License

This project is dual-licensed under either:

at your option.

Contributing

We welcome contributions! Please see our GitHub repository for more information.