Skip to main content

AQUA CLI Tool

The AQUA CLI tool (aqua-js-cli) is a command-line interface for interacting with the AQUA protocol. It provides functionality for notarizing, signing, witnessing, and verifying files in the AQUA system.

What is Notarization?

Notarization in AQUA is the process of creating an immutable record of a file or document on the blockchain. When you notarize a file:
  • A unique hash of the file is generated
  • The hash is recorded on the blockchain
  • A proof of existence is created
  • The file’s integrity can be verified at any time
This process ensures that the document existed at a specific point in time and hasn’t been modified since.

Getting Started

Clone the Repository

Requirements

  • Node.js 14.x+ (latest version recommended)
  • npm (Node Package Manager)

Installation

Install dependencies:
Build the project:

Usage

1. Notarizing, Signing, and Witnessing

Basic Notarization

Signing Files

Sign files using different methods (cli, metamask, or did):

Witnessing Files

Witness files using different methods (eth, nostr, or tsa):

Multiple Chain Witnessing

Witness multiple AQUA chains:
Witness specific revisions:

2. Verification

Basic Verification

Verification Options

Verbose output:
Skip merkle proof verification (faster):

3. Managing Revisions

Delete Last Revision

Link one AQUA chain to another:

4. Content Management

Generate Content Revision

Generate Scalar Revision

5. Forms Management

Create Genesis Form

For genesis, the filename must match the form name.

Create Form Revision

Update Forms

Delete a form entry:
Update/restore a form entry:
Form operations include:
  • File validation for .aqua.json files
  • Form key detection (exact and partial matches)
  • Handling deleted fields
  • Non-destructive updates preserving original structure

Use Cases

A Payment Infrastructure Prototype

This prototype implements a paper-cheque equivalent using the Aqua Protocol for offline data verification, WAVs as a gateway for distributed computation and on-chain triggers, and a smart contract to manage funds securely. It enables a sender to issue a “cheque” and a receiver to cash it out via cryptographic signatures and verification. GitHub: aqua-cheques
WAVs Gateway: wavs-demos

Core Workflow

The system mimics a traditional cheque:
  1. Sender creates a cheque with payment details.
  2. Sender signs it cryptographically.
  3. Receiver updates the cheque with their address and signs it.
  4. The signed cheque is verified offline via Aqua and executed on-chain via WAVs.

Step-by-Step Process

1. Create the Initial Aqua Form (Sender)
The sender defines the payment in an Aqua JSON object:
  • sender: Ethereum address of the payer.
  • receiver: Left blank initially (filled by the receiver later).
  • amount: Payment amount in the specified currency.
  • currency: Token or coin type (e.g., ETH).
2. Sender Signs the Form
The sender signs the JSON using an Ethereum EIP-191 signature. This is appended to the Aqua revision history.
3. Receiver Updates the Form
The receiver adds their address to the JSON:
4. Receiver Signs the Form
The receiver signs the updated JSON, also using EIP-191, completing the cheque.
5. Verification and Execution
The signed JSON is uploaded to the WAVs gateway. WAVs runs the Aqua library (Rust API) to verify:
  • Sender and receiver signatures.
  • Consistency of fields (e.g., amount and currency match between revisions).
If valid, WAVs triggers the on-chain smart contract to transfer funds from the sender to the receiver.

Interface Design

The system assumes two user-facing views interacting with the WAVs gateway:

Cheque Registration

Purpose: Sender uploads the initial signed JSON.Requirements:
  • Smart contract whitelists the sender’s address to accept the cheque.
  • Interface submits the JSON to the WAVs instance via an API call.

Cheque Cashout

Purpose: Receiver uploads the fully signed JSON for verification and payout.Requirements:
  • Interface submits the updated JSON to WAVs.
  • WAVs verifies signatures and triggers the smart contract.

API Integration

WAVs may provide a built-in interface (TBD—cheque wavs-demos). If not, your interface must:
  • Package the JSON with signatures.
  • Send it to the WAVs endpoint (e.g., POST /verify).
  • Handle the response (success triggers payout; failure returns an error).
Example API Call (hypothetical):

Aqua Revisions with Signatures

Aqua tracks changes and signatures in a revision tree. Below is an example of a fully signed cheque:

Verification Rules

  • forms_sender, forms_amount, and forms_currency must match between revisions.
  • Only forms_receiver can differ (updated by the receiver).
  • Signatures must validate against the respective wallet addresses.

Additional Milestones (Aqua-Dev-Team)

Aqua Library

Integrate the Rust-based Aqua API for offline verification (see aqua-cheques).

WAVs Setup

Deploy a WAVs instance or use an existing one. Ensure it can:
  • Accept JSON submissions.
  • Run Aqua verification.
  • Trigger the smart contract.

Smart Contract

Deploy an escrow contract with:
  • Whitelisting for sender addresses.
  • Locking cheque amount with revision hash and amount for possible revocation.
  • A cashout function triggered by WAVs.