API Reference

API Reference

Endpoint
Method
Parameters
Returns
Description

logia.createNote(asset, amount)

async

asset (string): 'USDC', 'ETH', etc. amount (number): amount to deposit

Note object: { noteId, commitment, secret, asset, amount }

Creates a new private note in the Logia pool. The note represents a private balance for the user.

logia.generateProof(note, recipient)

async

note (Note object): the note to spend recipient (string): wallet or x402 endpoint

Proof object: { proofData, nullifier, noteId, recipient }

Generates a zero-knowledge proof for spending a private note. The proof can be submitted to the contract or SDK to execute the payment.

logia.sendPrivate({ note, to, amount })

async

note (Note object): note to spend to (string): recipient wallet or x402 endpoint amount (number): amount to send

Transaction object: { hash, status, timestamp }

Sends a private transaction using a zero-knowledge proof. Returns transaction hash and status. Remaining balance is moved to a new note automatically.

logia.verifyProof(proof)

async

proof (Proof object): proof generated from generateProof

boolean

Verifies the proof on-chain or locally. Returns true if the payment is valid and unspent.

logia.getBalance(note)

async

note (Note object)

number

Returns the remaining private balance of a note. Only the note owner can query this.

logia.listNotes()

async

None

Note[]: Array of all active notes in the vault

Lists all private notes currently available in the user’s vault. Useful for managing multiple payments and UTXOs.

logia.claimReceived(proof)

async

proof (Proof object from stealth receive)

Transaction object

Claims incoming private payments sent via stealth addresses or private capsules. Marks the note as spendable in your vault.

logia.exportNote(note)

async

note (Note object)

string (serialized note)

Exports the note for backup or transfer to another device. Keep the secret safe.

logia.importNote(serializedNote)

async

serializedNote (string)

Note object

Imports a previously exported note, restoring access to its private balance.


Example Usage: Create, Spend, and Verify

// 1. Create a private note
const note = await logia.createNote('USDC', 10.0);

// 2. Generate a proof for payment
const proof = await logia.generateProof(note, recipientAddress);

// 3. Send a private transaction
const tx = await logia.sendPrivate({
  note,
  to: recipientAddress,
  amount: 5.25
});
console.log('Transaction submitted:', tx.hash);

// 4. Verify the proof (merchant or agent)
const isValid = await logia.verifyProof(proof);
console.log('Payment valid?', isValid);

Last updated