For AI Agents

API Documentation

REST endpoints for AI agents to interact with DeadVault without a browser wallet. All read operations are free. Write operations return transaction calldata for the agent to sign and broadcast.

GET/api/fees

Returns the current fee schedule, ETH/USD price, and contract info.

Query Parameters

chainIdChain ID (default: 84532 = Base Sepolia)

Example Response

curl https://your-domain.com/api/fees?chainId=8453

{
  "chainId": 8453,
  "ethUsdPrice": "$2150.00",
  "nativeWriteFee": {
    "usd": "$0.0500",
    "wei": "23255813953488",
    "formatted": "0.000023255813953488 ETH"
  },
  "tokenWriteFee": {
    "usd": "$0.0200",
    "units": "51546391752577319587",
    "formatted": "51.546391752577319587 DEAD"
  },
  ...
}
GET/api/secret

Reads an agent's stored encrypted secret. Returns raw ciphertext hex — you must decrypt locally.

Query Parameters

addressWallet address to look up (required)
chainIdChain ID (default: 84532)

Example Response

curl "https://your-domain.com/api/secret?address=0x1234...&chainId=8453"

{
  "address": "0x1234...",
  "chainId": 8453,
  "hasSecret": true,
  "ciphertext": "0xabcdef..."
}
POST/api/store

Generates transaction calldata for storing a secret. The agent must sign and broadcast this transaction. Does NOT submit the transaction — it returns the to, data, and value fields.

Request Body (JSON)

{
  "ciphertext": "0xabc123...",   // Pre-encrypted hex payload
  "chainId": 84532,              // Optional (default: Base Sepolia)
  "payMethod": "native"          // "native" or "token" (default: "native")
}

Response

{
  "to": "0x...",         // DeadVault proxy address
  "data": "0x...",       // ABI-encoded calldata
  "value": "23255...",   // Wei to send (native) or "0" (token)
  "chainId": 84532,
  "method": "storeSecret"
}

// Agent signs & sends:
// await wallet.sendTransaction({ to, data, value })

Direct Contract Interaction

AI agents with a wallet provider (ethers.js, viem, web3.py) can also call the contract directly without the REST API. The contract ABI is available at src/lib/abi.json.

// viem example
import { createPublicClient, createWalletClient, http } from 'viem';
import { baseSepolia } from 'viem/chains';
import { deadVaultAbi } from './abi.json';

const VAULT = '0x33939ede1A19A64EE755F1B5B3284A8E71F68484';

// Read (free)
const secret = await publicClient.readContract({
  address: VAULT, abi: deadVaultAbi,
  functionName: 'getSecret',
  args: ['0xAgentAddress...'],
});

// Write (requires fee)
const fee = await publicClient.readContract({
  address: VAULT, abi: deadVaultAbi,
  functionName: 'getNativeWriteFee',
});

await walletClient.writeContract({
  address: VAULT, abi: deadVaultAbi,
  functionName: 'storeSecret',
  args: ['0xEncryptedPayload...'],
  value: fee,
});

Encryption Standard

The contract stores opaque bytes — all encryption happens client-side. DeadVault uses AES-256-GCM with PBKDF2 key derivation:

01

Key derivation: PBKDF2(password, salt, 600k iterations, SHA-256)

02

Cipher: AES-256-GCM with 12-byte random IV

03

Format: salt(16 bytes) || iv(12 bytes) || ciphertext

04

Output: 0x-prefixed hex string

AI agents can implement this in any language. The reference implementation is in src/lib/crypto.ts.