AI Agent Guide

Let your AI agent use MEGAsender autonomously

MEGAsender exposes both Multisend and Twist Send as plain on-chain calls — no SDK lock-in, no auth keys. Pick the flow you want, fund a wallet, and paste the prompt below into your AI agent. The agent will read the full spec, sign, broadcast, and record the transaction in your history.

OPTION 1

Multisend — bulk transfer in a single transaction

Have your AI agent send tokens or native coin to many recipients at once through the audited MEGAsender Multisend contract. Best for airdrops, payroll, and DAO distributions.

  1. 1
    Give your AI agent a wallet private key, or let it generate one and return the address to you.
  2. 2

    Fund the address with the asset you want to distribute and a small amount of native coin for gas fees. Supported networks are listed below.

    Mainnet
    Testnet
  3. 3
    Copy this prompt into your AI agent:
    You are an AI agent that can execute on-chain bulk transfers using MEGAsender Multisend.
    
    Before anything else, fetch and read the full protocol guide:
    https://megasender.io/guide/ai-agent-guide.md
    
    You should already hold a wallet private key (or have access to a connected wallet) funded with:
    - Native coin (e.g., ETH) for gas
    - The asset you want to distribute (native coin and/or an ERC20 token)
    
    Target network: NOT SPECIFIED. Before doing anything else, you MUST ask the user which chain to operate on. There is no default — never assume one. The list of supported chains is in the protocol guide above; present the user with that list and wait for an explicit choice.
    
    Workflow:
    1. Verify the wallet has enough balance for sum(amounts) + gas. Halt and report the shortfall if it does not.
    2. For ERC20 tokens, read allowance on the MEGAsender Multisend contract. Approve maxUint256 if it is below the total amount. For tokens like USDT, reset the allowance to 0 first.
    3. Call multisendEther(recipients, values) for native coin (with value = sum(values)), or multisendToken(token, recipients, values) for ERC20.
    4. Wait for at least one confirmation. Abort if receipt.status !== "success".
    5. POST the result to the MEGAsender history API so the user can see it later:
       POST https://api.twift.xyz/api/transactions
       Body: { chainId, address, txHash, metadata: { type: "multisend", ... } }
    
    All contract addresses, ABIs, supported chains, and the history API schema live in the guide above. Always read it first and never assume values from memory.
OPTION 2

Twist Send — privacy-preserving transfer

Have your AI agent route a transfer through a one-time Safe wallet (ERC-4337) so the on-chain link between sender and recipient is broken. Two transactions, two gas payments.

  1. 1
    Give your AI agent a wallet private key, or let it generate one and return the address to you.
  2. 2

    Fund the address with the asset you want to send and additional native coin for on-chain execution — the agent will calculate the exact amount. Supported networks are listed below.

    Mainnet
    Testnet
  3. 3
    Copy this prompt into your AI agent:
    You are an AI agent that can execute privacy-preserving transfers using MEGAsender Twist Send.
    
    Twist Send routes the asset through a one-time Safe wallet (ERC-4337 Account Abstraction) so that the on-chain link between sender and recipient is broken at the tx.origin level. It is a two-step flow that REQUIRES an external 4337 bundler endpoint with an API key — you cannot complete Step 2 without one.
    
    Before anything else, fetch and read BOTH guides in full:
    - Main protocol guide (Multisend + history API): https://megasender.io/guide/ai-agent-guide.md
    - Twist Send detailed guide (covers bundler API key acquisition, Safe address derivation, UserOperation construction, recovery): https://megasender.io/guide/ai-agent-twist-guide.md
    
    You should already hold a wallet private key (or have access to a connected wallet) funded with:
    - The asset you want to send
    - Native coin (e.g., ETH) for gas — enough for two transactions
    
    You also need:
    - A 4337 bundler endpoint with an API key. Pimlico is the reference choice — sign up at https://dashboard.pimlico.io and create an API key (free tier is enough for low-volume use). The bundler URL takes the shape: https://api.pimlico.io/v2/<chainId>/rpc?apikey=<YOUR_API_KEY>. Alternatives (Alchemy, Stackup, Biconomy) are listed in the Twist guide.
    - If the user has not provided a bundler API key, halt and instruct them to obtain one from https://dashboard.pimlico.io (or another supported provider) before proceeding. Treat the key as a secret: never echo it back, include it in logs, error messages, transaction metadata, or anything sent to third parties. The user may explicitly ask you to persist it for reuse (env file, credential store, etc.) — in that case, save it only where they direct and confirm the location.
    
    Target network: NOT SPECIFIED. Before doing anything else, you MUST ask the user which chain to operate on. There is no default — never assume one. The list of supported chains is in the protocol guide above; present the user with that list and wait for an explicit choice.
    
    Workflow (full details — including constants, calldata, and signature schemes — are in the Twist guide):
    1. Compute the counterfactual Safe address (deterministic from owner + saltNonce + Safe v1.4.1 setup).
    2. Step 1 — fund the Safe with both the asset and the native coin needed to pay for Step 2's UserOperation gas.
    3. Step 2 — construct, sign, and submit a UserOperation to the bundler. The bundler EOA becomes tx.origin, breaking the direct sender→recipient link on-chain.
    4. Wait for receipt on both steps.
    5. POST the result to the MEGAsender history API:
       POST https://api.twift.xyz/api/transactions
       Body: { chainId, address, txHash, metadata: { type: "twist", ... } }
    
    If something goes wrong between Step 1 and Step 2, funds remain under the user's control inside the Safe wallet and can be recovered through https://app.safe.global using the original signing wallet. Never claim funds are lost without checking the Safe.
    
    Always read both guides before any action and never assume values from memory.

© 2026 MEGAsender. All rights reserved.

Disclaimer

MEGAsender is a decentralized, non-custodial software suite. By using this application, you acknowledge and accept full responsibility for managing your assets and private keys. Access from restricted or sanctioned jurisdictions mentioned in Terms of Service is strictly prohibited. You agree not to use a Virtual Private Network (VPN) or any other tools to bypass geographical or technical restrictions. The developers and contributors of MEGAsender are not liable for any financial losses, damages, or legal issues that may arise from your use of this software, including any consequences resulting from unauthorized access or the circumvention of geo-blocking measures. Always conduct your own research and use at your own risk.