DEVELOPER PLATFORM · CLIENT SDK & APIS

Build private onchain workflows.

Integrate deterministic client note generation, shielded commitments, and verifiable settlement routing on Robinhood Chain.

Client Library: ESM · TypeScript
Target Chain: Robinhood Chain (EVM)
Authentication: SIWE (EIP-4361)
Encryption: PBKDF2 + AES-256-GCM

INTEGRATION

Quickstart

v0.2.0
Installation
npm install @robtrade/sdk ethers

Client-Side Usage Example

Create client notes, shield assets, and attach encrypted recovery payloads to your authenticated wallet.

JavaScript / TypeScript (client.js)
import { makeNote, encryptNote, api, sendPreparedTx, signIn } from '/app/common.js';

// 1. Sign in with Ethereum (SIWE)
const address = await signIn();
console.log('Connected wallet:', address);

// 2. Generate a client-side note for 0.01 ETH (10^16 wei)
// Secrets are generated in the browser via Web Crypto API
const note = await makeNote('10000000000000000');
console.log('Deterministic Commitment:', note.commitment);

// 3. Encrypt note locally with user password before sending
const encryptedNote = await encryptNote(note, 'user-secret-passphrase-1234');

// 4. Prepare shield transaction on Robinhood Chain
const prep = await api('/vault/shield/prepare', {
  method: 'POST',
  body: JSON.stringify({ commitment: note.commitment, amountWei: note.amountWei })
});

// 5. Send transaction with wallet and attach encrypted payload
const txHash = await sendPreparedTx(prep.tx);
await api('/vault/notes/attach', {
  method: 'POST',
  body: JSON.stringify({ commitment: note.commitment, txHash, encryptedNote })
});
console.log('Successfully shielded assets! TX:', txHash);

REST ENDPOINTS

Backend API Surface

Implemented

All backend routes are validated, protected by rate limiting, and use EIP-4361 SIWE tokens for authenticated endpoints.

POST /auth/nonce

Issue an EIP-4361 SIWE challenge nonce bound to the requesting address.

{ "address": "0x123...abc" }
→ { "nonce": "a9f3b18c..." }
POST /auth/verify

Verify SIWE personal signature and issue authenticated JWT bearer token.

{ "message": "...", "signature": "0x..." }
→ { "token": "eyJhbG...", "address": "0x..." }
POST /vault/shield/prepare

Prepare transaction calldata to deposit assets into the commitment pool.

{ "commitment": "0x...", "amountWei": "1000000" }
→ { "tx": { "to": "0x...", "data": "0x...", "value": "1000000" } }
POST /vault/notes/attach

Store ciphertext note associated with your authenticated wallet.

{ "commitment": "0x...", "txHash": "0x...", "encryptedNote": "{...}" }
→ { "ok": true, "note": { "id": 1 } }
GET /vault/notes

Fetch all encrypted notes stored for the authenticated caller.

Header: Authorization: Bearer <token>
→ { "notes": [ { "id": 1, "commitment": "0x...", "encryptedNote": "..." } ] }
GET /vault/history

Get user's shielded and unshielded transaction ledger history.

Header: Authorization: Bearer <token>
→ { "history": [ { "type": "shield", "txHash": "0x...", "amountWei": "..." } ] }
POST /swap/quote

Query 0x protocol routing quote for token swaps on Robinhood Chain.

{ "tokenIn": "0x...", "tokenOut": "0x...", "amountIn": "1000" }
→ { "quoteId": "q_123", "price": "...", "buyAmount": "..." }
POST /swap/orders

Lock executable calldata and prepare swap transaction order.

{ "quoteId": "q_123" }
→ { "order": { "id": "ord_1", "expectedTo": "0x...", "expectedData": "0x..." } }
POST /swap/orders/:id/submit

Verify submitted swap hash onchain and mark transaction completed.

{ "txHash": "0x..." }
→ { "ok": true, "status": "CONFIRMED" }
GET /settlements

List confirmed settlement transactions with public proof receipts.

→ { "settlements": [ { "txHash": "0x...", "blockNumber": 149204 } ] }

SECURITY BOUNDARIES

Protocol Architecture

Cryptographic isolation

RobTrade uses strict cryptographic boundary separation. Secrets and private keys never leave client memory.

1
Client Generation

SHA-256 deterministic commitment is calculated locally. Plaintext note is encrypted using PBKDF2 (150,000 iterations) with AES-256-GCM.

2
API Preparation

Backend prepares non-custodial EVM transactions. The backend never holds custody of funds or private keys.

3
Onchain Settlement

Transactions settle on Robinhood Chain. Public explorer witnesses proof execution, without exposing trading size or account balance.

Next Protocol Upgrades

Full ZK-SNARK verifier circuit, viewing-key protocol for audited compliance, and private relayer execution network.

Groth16 Verifier Viewing Keys Private Relayers
Copied to clipboard