Skip to main content

L2PS SDK

The L2PS module in the WebSDK provides a complete toolkit for private transactions on the Demos Network. Transactions are encrypted client-side using AES-256 before being sent to L2PS-participating nodes.

Key Features

Client-Side Encryption

Transactions encrypted in your browser with AES-256-CBC before transmission.

Authenticated History

Only address owners can access their transaction history via signatures.

Transaction Lifecycle

Track transactions through Executed → Batched → Confirmed stages.

Simple Integration

Drop-in replacement for standard L1 transactions with privacy.

How It Works

1

Generate Keys

Initialize L2PS module with shared AES key and IV matching the L2PS network.
2

Encrypt Transaction

SDK encrypts your transaction data client-side before sending.
3

Send to Network

Encrypted blob sent to L2PS node which decrypts and validates.
4

Track Status

Monitor transaction through executed → batched → confirmed lifecycle.

Transaction Lifecycle

StatusDescriptionTiming
ExecutedNode validated, balance reservedInstant
BatchedIncluded in L1 batch with ZK proofPer L1 block
ConfirmedL1 block finalizedFinal

Quick Reference

import { L2PSEncryption, L2PSService } from '@kynesyslabs/demosdk/l2ps'

// Initialize with L2PS network keys
const l2ps = new L2PSEncryption(aesKey, iv)

// Encrypt and send transaction
const encrypted = l2ps.encrypt({
  type: "native",
  from: "0xSender...",
  to: "0xRecipient...",
  amount: 10
})

// Send to L2PS network
const result = await L2PSService.sendTransaction(
  nodeUrl,
  l2psUid,
  encrypted,
  signature
)

Getting Started

For backend implementation details, see the L2PS Subnet Framework.