Ceaser send

From LeoYeAI/openclaw-master-skills · View interactive version

Ceaser send is an AI agent skill from the GitHub repository LeoYeAI/openclaw-master-skills. Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp <subcommand>). WARNING -- creates observable on-chain links between user w

How to use this skill

Skill file

Ceaser Private Send

You are a skill that executes a complete private ETH transfer on Base L2 (chain ID 8453) using the Ceaser privacy protocol. You orchestrate the full flow: generate an ephemeral hot wallet with a BIP-39 mnemonic (shown to the user once for recovery), wait for user funding, Shield (deposit) into the privacy pool with automatic TX signing, extract the on-chain leafIndex, update the local note, Unshield (withdraw) to the recipient address, and refund remaining ETH to the user.

Network: Base L2 (chain ID 8453)

Contract: 0x278652aA8383cBa29b68165926d0534e52BcD368

Facilitator: https://ceaser.org

Protocol Fee: 0.25% (25 bps) per operation

Valid Denominations: 0.001, 0.01, 0.1, 1, 10, 100 ETH

Proof System: Noir circuits compiled to UltraHonk proofs (no trusted setup)

This skill uses the ceaser-mcp npm package for shield, unshield, and note management operations. All ceaser tool calls use CLI subcommands:

npx -y ceaser-mcp <subcommand> [args]

Alternatively, if mcporter is installed with the ceaser MCP server configured (see {baseDir}/mcporter.json), you may use mcporter call ceaser.TOOL_NAME as an equivalent method. CLI is the primary and recommended approach.

Exactly ONE manual step is required: the user must send ETH to a generated hot wallet address. All other steps (proof generation, TX signing, broadcasting, leafIndex extraction, unshield, refund) are fully automated.


PRIVACY WARNING

Auto-signing mode creates observable on-chain links that reduce privacy compared to manual signing (the /ceaser skill). Specifically:

  1. Funding link: The user's main wallet (A) sends ETH to the hot wallet (H). This transfer is publicly visible on-chain, linking A to H.
  2. Shield link: The hot wallet (H) calls shieldETH() on the contract. H is now linked to the shield deposit.
  3. Refund link: After the operation, remaining ETH is refunded from H back to A (or another address). This creates another public link.
  4. Timing correlation: Funding, shield, unshield, and refund happen in rapid succession (minutes apart), making them easy to correlate.
  5. Wallet fingerprint: The hot wallet performs exactly 2-3 transactions (fund receive, shield, refund) and is never reused -- this pattern is distinctive.

Recommendation: For maximum privacy, use the /ceaser skill (manual signing via MetaMask). The user signs the shield transaction directly from their wallet, with no intermediate hot wallet, no funding link, and no refund link. Use /ceaser-send (this skill) only when the user explicitly requests automated signing or cannot interact with a wallet UI.


Prerequisites

Before executing this skill, verify:

  1. node and npx are installed (for ceaser-mcp CLI and wallet-ops helper)
  2. curl and jq are installed (for TX receipt parsing and notes.json manipulation)
  3. node_modules are installed in the skill directory (test: node {baseDir}/helpers/wallet-ops.js --help)
  4. User has a wallet capable of sending ETH on Base Mainnet (for funding the hot wallet)
  5. Wallet has enough ETH for the desired amount + 0.25% protocol fee + ~0.0005 ETH gas reserve

Pre-Flight Checks

Execute ALL of these checks BEFORE starting the flow. Abort if any check fails.

Check 1: Facilitator Status

Run:

curl -s "https://ceaser.org/status" | jq .

Verify:

If the facilitator is down or circuit breaker is tripped, inform the user and abort.

Check 2: Denomination Validation

Run:

curl -s "https://ceaser.org/api/ceaser/denominations" | jq .

Verify:

If the amount is not a valid denomination, show the user the valid options and ask them to choose.

Check 3: Fee Calculation

Run:

curl -s "https://ceaser.org/api/ceaser/fees/AMOUNT_WEI" | jq .

Replace AMOUNT_WEI with the amount in wei (e.g., 1000000000000000 for 0.001 ETH).

Present to the user:

Store internally: amountWei and feeWei from the response (needed for funding calculation in Wallet Generation Phase).

Ask the user to confirm they want to proceed.

Check 4: Recipient Address Validation

Validate the recipient address format: must match /^0x[0-9a-fA-F]{40}$/.

If invalid, inform the user and ask for a correct Ethereum address.

Check 5: Existing Notes

Run:

npx -y ceaser-mcp notes

Check for existing unspent notes:

Check 6: Helper Script Availability

Run:

node {baseDir}/helpers/wallet-ops.js --help

Verify: valid JSON output listing available commands (generate, balance, sign-and-send, refund).

If this check fails: inform the user and abort. Message: "Helper script not available. Please run npm install in the skill directory."


Flow Decision

Based on Pre-Flight Check 5:

Path A -- Use Existing Note:

If the user wants to use an existing unspent note with a valid leafIndex, skip directly to the Unshield Phase.

Path B -- Update Existing Note:

If a note has leafIndex=null and the user has the TX hash, skip to the TX Confirmation and leafIndex Extraction phase.

Path C -- Full Shield Flow:

No suitable note exists. Execute the complete Wallet -> Fund -> Shield -> Auto-Sign -> Confirm -> Update -> Unshield -> Refund flow.


Wallet Generation Phase

Only execute for Path C (Full Shield Flow).

Step 1: Generate Hot Wallet

Run:

node {baseDir}/helpers/wallet-ops.js generate

Store internally (in your working context):

Step 1.5: Show Mnemonic to User

IMPORTANT: Show the mnemonic to the user EXACTLY ONCE with a clear security warning:

RECOVERY MNEMONIC (save this securely):

word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12

SAVE THIS MNEMONIC SECURELY. It controls the hot wallet funds.

If this session breaks after funding, import these 12 words into MetaMask (or any BIP-39 wallet) to recover your ETH.

Do NOT share this mnemonic. Anyone with these words can access the hot wallet.

After showing the mnemonic once, do NOT repeat it in summaries, follow-up responses, or any subsequent messages.

Step 2: Calculate Funding Amount

Use the fee data from Pre-Flight Check 3:

Convert total funding to ETH for display. Round UP to a human-friendly value if needed.

Step 3: Ask for Refund Address

Before showing the funding instructions, ask the user:

"Where should I send any remaining ETH after the operation? Please provide your wallet address for the refund."

Store the refund address internally. If the user does not provide one, attempt to detect it from the incoming funding transaction later. If detection fails, ask again after the shield completes.

Note: If the session breaks after funding, the user can also recover hot wallet funds by importing the mnemonic into MetaMask.

Step 4: Show Funding Instructions

Present to the user:

Hot Wallet Address: HOT_WALLET_ADDRESS

Send exactly: FUNDING_AMOUNT ETH (or slightly more)

Network: Base Mainnet (Chain ID 8453)

Send EXACTLY the specified amount or slightly more. Sending less will cause the shield to fail. Any excess ETH will be automatically refunded after completion.

If you lose the mnemonic, you cannot recover funds from this wallet. The mnemonic will NOT be shown again.

In case of session interruption, use the mnemonic to recover funds via MetaMask.


Balance Monitoring Phase

Only execute for Path C, after showing funding instructions.

Polling Logic

Repeatedly execute:

node {baseDir}/helpers/wallet-ops.js balance --address HOT_WALLET_ADDRESS

Cancel Handling

The user can say "cancel" or "abbrechen" at any time during the funding wait.

To refund on cancel:

CEASER_HOT_MNEMONIC="MNEMONIC_PHRASE" node {baseDir}/helpers/wallet-ops.js refund --recipient REFUND_ADDRESS --rpc https://mainnet.base.org

Timeout Handling

Partial Funding

If balance > 0 but less than required:

"Received: X ETH. Required: Y ETH. Please send an additional Z ETH."

Continue polling.

Funding Confirmed

When balance >= required amount:

"Funding received. Proceeding with Shield operation."

If the user provided excess ETH:

"Received more ETH than required. Excess will be refunded after completion."


Shield Phase

Run:

npx -y ceaser-mcp shield USER_AMOUNT

Replace USER_AMOUNT with the ETH denomination (e.g., 0.1).

Expected Response Fields

Validation

Verify after receiving the response:

Backup String Handling

SECURITY CRITICAL:

> SAVE THIS BACKUP STRING SECURELY. It contains your private ZK secrets (secret + nullifier). Anyone with this string can withdraw your shielded ETH. Store it offline. Do not share it.

Internal State

Remember these values for later steps (keep in your working context, do not output again):

Shield Error After Funding (Edge Case)

If ceaser_shield_eth fails (proof error, facilitator down, etc.):


Automatic TX Signing Phase

This replaces the previous manual signing phase. The agent signs and broadcasts the Shield TX automatically using the mnemonic-derived hot wallet.

Execute Sign-and-Send

The ceaser-mcp shield command automatically saves the unsigned transaction to ~/.ceaser-mcp/pending-tx.json. The sign-and-send helper auto-detects this file, so you do NOT need to pass the transaction data as a CLI argument.

Run:

CEASER_HOT_MNEMONIC="MNEMONIC_PHRASE" node {baseDir}/helpers/wallet-ops.js sign-and-send --rpc https://mainnet.base.org

The helper automatically reads the unsigned TX from ~/.ceaser-mcp/pending-tx.json and deletes the file after a successful send.

Where:

Alternative: You can also specify the file explicitly or pass the JSON directly:

# Explicit file path
CEASER_HOT_MNEMONIC="..." node {baseDir}/helpers/wallet-ops.js sign-and-send --unsigned-tx-file ~/.ceaser-mcp/pending-tx.json --rpc https://mainnet.base.org

# Legacy: pass JSON directly (NOT recommended -- the data field is 4000-9000 chars)
CEASER_HOT_MNEMONIC="..." node {baseDir}/helpers/wallet-ops.js sign-and-send --unsigned-tx 'JSON_STRING' --rpc https://mainnet.base.org

IMPORTANT: Do NOT pass the unsignedTx JSON as a CLI argument unless absolutely necessary. The data field contains 4000-9000 characters of hex-encoded ZK proof, which can cause issues with shell argument handling. Always prefer the automatic file-based approach.

Security notes:

Set exec timeout: 60 seconds (covers gas estimation + signing + broadcasting + 1 block confirmation).

Process TX Result


TX Confirmation and leafIndex Extraction

Using the txHash from the automatic sign-and-send operation, extract the leafIndex from the on-chain Shield event.

Note: The helper script already waits for 1 block confirmation. In most cases, the receipt is already available. The steps below serve as verification and leafIndex extraction.

Step 1: Fetch TX Receipt

Use Bash to query the Base Mainnet RPC:

curl -s -X POST https://mainnet.base.org \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["TX_HASH"],"id":1}' | jq '.result'

Replace TX_HASH with the actual hash.

Step 2: Check TX Status

Step 3: Find Shield Event in Logs

Search the logs array for an entry matching:

If no matching log found: "No Shield event found in this transaction. This may not be a Shield transaction. Please verify the TX hash." Abort.

Step 4: Extract leafIndex

The Shield event structure:

Extract leafIndex from data:

# data is hex string like 0x000000000000000000000000000000000000000000000000000000000000000600000000...
# First 32 bytes (64 hex chars after 0x) = leafIndex (uint32 zero-padded)
LEAF_INDEX_HEX=$(echo "DATA_FIELD" | cut -c3-66)
LEAF_INDEX=$(node -e "console.log(parseInt('0x$LEAF_INDEX_HEX', 16))")

Step 5: Validate Commitment

Extract topics[1] from the log and compare against the stored note.commitment.

CRITICAL: If the commitment does not match, WARN the user: "The Shield event commitment does not match the generated note. This TX hash may belong to a different shield operation. Aborting leafIndex extraction to prevent data corruption."

Step 6: Validate leafIndex

The extracted leafIndex must be a non-negative integer. If it is NaN or negative, abort with an error.

Edge Case: Multiple Shield Events

If the TX contains multiple Shield events (unusual but possible in batch operations), use the commitment match from Step 5 to identify the correct event.


Note Update (notes.json Workaround)

The shield tool stores the note with leafIndex=null. The unshield tool requires leafIndex != null. No MCP tool exists for updating the leafIndex directly. This workaround uses Bash to manipulate the backup string and notes.json.

Why This Is Necessary

Step 1: Decode Backup String

echo "BACKUP_STRING" | base64 -d

This yields a JSON object with fields: s (secret), n (nullifier), a (amount), am (amountWei), c (commitment), i (leafIndex -- currently null), ai (assetId), as (assetSym), ad (contractAddress).

Step 2: Update leafIndex in Backup

UPDATED_JSON=$(echo "BACKUP_STRING" | base64 -d | jq --argjson idx LEAF_INDEX '.i = $idx')

Replace LEAF_INDEX with the extracted decimal value. This sets the i field from null to the actual leafIndex.

Step 3: Re-encode to Base64

UPDATED_BACKUP=$(echo "$UPDATED_JSON" | base64 -w 0)

Step 4: Remove Old Note from notes.json

CRITICAL: Only remove the specific entry matching the commitment. Do NOT modify other notes.

COMMITMENT="NOTE_COMMITMENT_VALUE"
jq --arg c "$COMMITMENT" '[.[] | select(.commitment != $c)]' ~/.ceaser-mcp/notes.json > ~/.ceaser-mcp/notes.json.tmp && mv ~/.ceaser-mcp/notes.json.tmp ~/.ceaser-mcp/notes.json && chmod 600 ~/.ceaser-mcp/notes.json

IMPORTANT: Always restore file permissions to 0600 after modification.

Step 5: Import Updated Note

Run:

npx -y ceaser-mcp import "$UPDATED_BACKUP"

Step 6: Verify Import

Run:

npx -y ceaser-mcp notes

Verify:

Edge Cases


Unshield Phase

Pre-Checks

Before calling unshield, verify:

Execute Unshield

Inform the user: "Generating burn proof and submitting to facilitator. This may take 15-60 seconds depending on tree size and hardware."

Run:

npx -y ceaser-mcp unshield NOTE_ID RECIPIENT_ADDRESS

Replace NOTE_ID and RECIPIENT_ADDRESS with actual values.

Expected Success Response

Expected Error Responses

The unshield is GASLESS -- the facilitator pays all gas costs.


Gas Refund Phase

Only execute for Path C, after successful Unshield. Refunds remaining ETH from the hot wallet to the user.

Execute Refund

Run:

CEASER_HOT_MNEMONIC="MNEMONIC_PHRASE" node {baseDir}/helpers/wallet-ops.js refund --recipient REFUND_ADDRESS --rpc https://mainnet.base.org

Where:

Process Refund Result

The refund is a best-effort operation. Refund failure does NOT affect the main operation (Shield + Unshield already completed successfully).


Result Presentation

On Success

Present to the user:

On Shield Success but Unshield Failure

Present:

On Complete Flow Abort

Present:


Error Handling Reference

| Error | Cause | Data Loss? | Action |

|-------|-------|-----------|--------|

| Hot wallet generation fails | Node.js crypto issue | None | Retry |

| Insufficient funding | User sent too little ETH | ETH in hot wallet | Inform user, wait for more ETH |

| Funding timeout (10 min) | User did not fund | None (no ETH sent) | Retry flow |

| Funding timeout with balance | User sent partial amount | ETH in hot wallet | Auto-refund, retry flow |

| User cancels funding | User choice | None or ETH in hot wallet | Auto-refund if balance > 0 |

| Shield proof fails after funding | Facilitator down, circuit error | ETH in hot wallet | Retry (2x), then auto-refund |

| Sign-and-send fails | Gas, nonce, RPC issue | ETH in hot wallet | Retry or auto-refund |

| TX reverts (status=0x0) | Insufficient funds, gas, revert | ETH partially in hot wallet | Auto-refund remainder |

| TX pending too long | Network congestion | ETH spent on TX | Provide TX hash, check later |

| No Shield event in TX | Wrong TX hash | None | Verify TX hash |

| Commitment mismatch | Wrong TX for this note | None | Verify TX hash matches shield operation |

| notes.json manipulation fails | Permissions, syntax | Note still in backup | Manual recovery with backup string |

| Unshield proof fails | Facilitator down, indexer desync | None (note unspent) | Retry later |

| ceaser.org unreachable | Server down | None | Check status, retry later |

| Invalid mnemonic in env var | Env var corrupted or wrong format | None | Re-run generate, use fresh mnemonic |

| Refund fails | Gas too high for remainder | Small dust in hot wallet | Inform user |

Recovery guarantee: The backup string is ALWAYS the ultimate fallback. As long as the user has it, shielded ETH can be recovered.


Session Interruption

If the session aborts during the flow:

| Phase | State | Loss Risk | Recovery |

|-------|-------|-----------|----------|

| Before funding | No ETH sent | None | Restart flow |

| After funding, before Shield TX | ETH in hot wallet | Recoverable via mnemonic | User imports mnemonic into MetaMask to access hot wallet |

| After Shield TX, before Unshield | Note in notes.json, backup with user | None | Resume with Path A or B using backup |

| After Unshield, before refund | Main operation complete | Small dust in hot wallet | User can recover dust via mnemonic if desired |

Risk minimization: The agent executes the Shield TX as quickly as possible after funding is confirmed. The window between funding and Shield TX is minimized. Additionally, the user has the mnemonic phrase as a safety net. Even if the session breaks after funding, the user can recover funds by importing the mnemonic into any BIP-39 compatible wallet (e.g., MetaMask).


Security Warnings

Backup String

Hot Wallet Security

Privacy Notice

Recipient Verification

Fee Transparency

Concurrent Execution

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.