Skill flagged — suspicious patterns detected

ClawHub Security flagged this skill as suspicious. Review the scan results before using.

tron-x402-payment

Pay for x402-enabled Agent endpoints using TRC20 tokens (USDT/USDD) on TRON

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 2.6k · 2 current installs · 2 all-time installs
byAiBank@wzc1206
MIT-0
Security Scan
VirusTotalVirusTotal
Suspicious
View report →
OpenClawOpenClaw
Suspicious
medium confidence
Purpose & Capability
The name/description (x402 TRC20 payments) aligns with the implemented functionality: the tool uses tronweb and an x402 client to sign payments and invoke agent endpoints. However, the registry metadata lists no required env vars while the SKILL.md and code clearly expect TRON_PRIVATE_KEY (and optionally TRON_GRID_API_KEY). That mismatch between declared requirements and actual code is a material inconsistency.
!
Instruction Scope
SKILL.md and the code instruct the tool to locate a private key and API key by checking: environment variables, current/home x402-config.json (and .x402-config.json in source), and ~/.mcporter/mcporter.json (iterating mcpServers entries). Reading these local config files is outside a minimal 'invoke agent' action and increases the credential surface — the tool will silently inspect local files for secrets. The tool also redirects console.log to console.error (so library debug output, possibly including signing details, will be emitted to stderr). Network calls are to the provided agent URL and TronGrid (expected for payments).
Install Mechanism
There is no remote download/install step; the package includes source and a compiled dist bundle. Dependencies are standard/npm packages (tronweb, @open-aibank/x402-tron). No evidence of arbitrary URL downloads or extract/install of remote archives.
Credentials
Requesting a TRON private key and a TronGrid API key is proportionate for a payment tool. But the code's behavior — searching multiple local files (including ~/.mcporter/mcporter.json and scanning mcpServers objects) — broadens where secrets may be read from. Also the published registry metadata not listing required env vars is inconsistent and may mislead users about what credentials will be accessed.
Persistence & Privilege
The skill is not always-enabled and is user-invocable. It permits autonomous invocation by default (platform default). That combination is expected for a payment/invoke tool, but because it can access private keys, autonomous invocation increases potential blast radius — consider this when enabling for agents that can act without user confirmation.
Scan Findings in Context
[base64-block] expected: The SKILL.md and code parse a base64-encoded PAYMENT-RESPONSE header (settlement info). Detection of a base64 block in the documentation likely corresponds to legitimate processing of a base64-encoded header rather than obvious prompt-injection, but it's worth reviewing the exact content where the scanner flagged it.
What to consider before installing
This skill implements on-chain TRC20 payments and therefore needs a TRON private key (and optionally a TronGrid API key for mainnet). Before installing or running: 1) Expect the tool to search environment variables and local files (~/.mcporter/mcporter.json, x402-config.json/.x402-config.json) for keys — if you keep other secrets in those files, the tool will read them. 2) Prefer supplying a dedicated ephemeral/testnet private key via TRON_PRIVATE_KEY (or use the --check mode) rather than storing your mainnet keys in shared configs. 3) Review the included dist/src code locally (it’s provided) and verify no unexpected network endpoints are contacted beyond the agent URL and TronGrid. 4) Be cautious about autonomous invocation: if the agent can call this skill without your confirmation, a compromised agent could attempt payments. 5) If unsure, test on nile/shasta with minimal funds and do not install on systems that store unrelated secrets in the checked config paths.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk975prffb3yq82sr1m5pv06axh80nd42

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

Runtime requirements

💳 Clawdis

SKILL.md

x402 Payment Protocol for TRON Agents

Invoke x402-enabled AI agent endpoints with automatic TRC20 token payments on TRON. Currently recommended tokens: USDT, USDD.

Quick Start

The tool x402_tron_invoke is implemented by the compiled script dist/x402_tron_invoke.js.

The script is pre-built and ready to run. You can execute it directly from the command line:

# v2 Invoke
node dist/x402_tron_invoke.js --url https://api.example.com --entrypoint chat --input '{"prompt": "hi"}'

# Direct/Discovery
node dist/x402_tron_invoke.js --url https://api.example.com/.well-known/agent.json

How It Works

The x402_tron_invoke tool:

  1. Constructs the endpoint URL:
    • If entrypoint is provided: {url}/entrypoints/{entrypoint}/invoke (v2)
    • Otherwise: Uses {url} as-is (v1 / Discovery)
  2. Makes a request (POST for v2, GET default for v1)
  3. If 402 Payment Required is returned:
    • Parses payment requirements
    • Checks wallet balance and allowance
    • Performs an infinite approval if allowance is insufficient
    • Signs the payment permit (EIP-712 / TRON Typed Data)
    • Retries the request with X-PAYMENT header
  4. Returns the response

Prerequisites

  • Wallet: A TRON private key must be available. The skill automatically looks for it in:
    1. TRON_PRIVATE_KEY environment variable.
    2. ~/.mcporter/mcporter.json (AIBank standard).
    3. x402-config.json in the current/home directory.
  • Tokens: Wallet needs USDT/USDD and some TRX for gas.
  • TronGrid API Key: Required for Mainnet to avoid rate limits (TRON_GRID_API_KEY).

Tool Reference

x402_tron_invoke

Invokes an HTTP endpoint with automatic payment handling.

Modes:

  1. v2 Agent Invoke (Recommended): Provide url (Base URL) + entrypoint.
    • Constructs: {url}/entrypoints/{entrypoint}/invoke
    • Wraps input: {"input": <input>}
    • Method: POST
  2. v1 / Direct / Discovery: Provide url (Full URL) without entrypoint.
    • Uses the URL as-is.
    • Method: GET (default) or specified via method.
    • Agent Advice: Use this mode for discovery. If url returns 404, try appending /.well-known/agent.json or /entrypoints.
  3. Status Check: Provide --check or --status.
    • Verifies if TRON_PRIVATE_KEY is correctly configured and outputs the associated wallet address.
    • Checks if TRON_GRID_API_KEY is present (Required for Mainnet).
    • Agent Advice: ALWAYS use this instead of env or echo $TRON_PRIVATE_KEY.
ParameterTypeRequiredDescription
urlstringYes*Base URL (v2) or Full URL (v1/Discovery). *Not required for --check.
entrypointstringNoEntrypoint name. Required for v2 Invoke.
inputobjectNoInput data.
methodstringNoHTTP method. Default: POST (v2), GET (Direct).
networkstringNomainnet, nile, shasta (Default: nile).
checkbooleanNoVerify wallet configuration and output address.

Example: Chat with Agent (v2 Invoke)

node dist/x402_tron_invoke.js --url https://api.example.com --entrypoint chat --input '{"prompt": "Tell me a joke"}'

(Sends POST https://api.example.com/entrypoints/chat/invoke)

Example: Agent Discovery (Direct)

  1. Manifest: Fetch agent metadata.

    node dist/x402_tron_invoke.js --url https://api.example.com/.well-known/agent.json
    
  2. List Entrypoints: List available functions.

    node dist/x402_tron_invoke.js --url https://api.example.com/entrypoints
    

    Each entrypoint typically returns:

    • Path: /entrypoints/{name}/invoke
    • Pricing: Cost in tokens (e.g., 1000 units)
    • Network: Usually nile or mainnet
    • Input Schema: Expected JSON format for the input parameter

Example: Raw URL (Legacy)

node dist/x402_tron_invoke.js --url https://api.example.com/chat --method POST --input '{"prompt": "Tell me a joke"}'

Cost Reference (USDT/USDD)

TokenNetworkContract AddressDecimals
USDTMainnetTR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t6
USDTNileTXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf6
USDTShastaTG3XXyExBkPp9nzdajDZsozEu4BkaSJozs6
USDDMainnetTXDk8mbtRbXeYuMNS83CfKPaYYT8XWv9Hz18
USDDNileTGjgvdTWWrybVLaVeFqSyVqJQWjxqRYbaK18
Amount (raw)Value (USDT, 6 dec)Typical Use
1000$0.001Single API call
5000$0.005Multiple results
10000$0.01Premium request
1000000$1.00Large batch

Understanding 402 Responses

When payment is required, agents return:

{
  "error": "X-PAYMENT header is required",
  "accepts": [{
    "scheme": "exact",
    "network": "nile",
    "maxAmountRequired": "1000",
    "payTo": "T...",
    "asset": "T..."
  }],
  "x402Version": 1
}

The tool handles this automatically.


Supported Tokens

This tool supports TRC20 tokens compatible with the x402 protocol. Recommended:

  • USDT (Tether)
  • USDD (Decentralized USD)

Security Rules for Agents

  • No Private Key Output: The Agent MUST NOT print, echo, or output the TRON_PRIVATE_KEY or any other signing secret to the dialogue context.
  • Internal Loading Only: The Agent should rely on the skill or underlying scripts to load the key internally.
  • No Export Commands: The Agent MUST NOT execute shell commands that contain the private key as a literal string.
  • Sanitized Logs: Ensure that logs or error messages do not leak the key.
  • Silent Environment Checks: If you need to verify if an environment variable is set, use a "Silent Check".
    • Correct: [[ -n $TRON_PRIVATE_KEY ]] && echo "Configured" || echo "Missing"
    • Forbidden: echo $TRON_PRIVATE_KEY, env, printenv, set, export.
  • Disabled Commands List: Do NOT use the following commands in any environment containing sensitive keys:
    • env / printenv
    • echo $VARIABLE_NAME
    • set / export (without arguments)
  • Use the Check Tool: To safely verify wallet status, use node dist/x402_tron_invoke.js --check.

❌ Negative Example (CRITICAL FAILURE)

"I will check your private key now: echo $TRON_PRIVATE_KEY" -> STOP! This leaks the secret to the logs and UI.

✅ Positive Example

"I will verify the wallet configuration: node dist/x402_tron_invoke.js --check" -> SAFE. Only the public address is shown.

Troubleshooting

"Private key not found"

Ensure the TRON_PRIVATE_KEY environment variable is set or a valid x402-config.json exists in the expected locations.

"Insufficient Allowance"

The tool will attempt to broadcast an infinite approve transaction. This requires TRX for gas. Ensure your wallet has TRX.

"Transaction Failed"

Check if you have enough Token balance (USDT/USDD) and TRX for gas.


Binary and Image Handling

If the endpoint returns an image (Content-Type: image/*) or binary data (application/octet-stream):

  1. The data is automatically saved to a temporary file (e.g., /tmp/x402_image_...).
  2. The tool returns a JSON object with:
    • file_path: Path to the temporary file.
    • content_type: The MIME type of the content.
    • bytes: File size in bytes.
  3. Important: The Agent is responsible for deleting the temporary file after it has been used.

Network Reference

NetworkChain IDCAIP-2USDT ContractUSDD Contract
TRON Mainnet0x2b6653dceip155:728126428, tron:mainnetTR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6tTXDk8mbtRbXeYuMNS83CfKPaYYT8XWv9Hz
TRON Nile0xcd8690dceip155:3448148188, tron:nileTXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBfTGjgvdTWWrybVLaVeFqSyVqJQWjxqRYbaK
TRON Shasta0x94a9059eeip155:2494104990, tron:shastaTG3XXyExBkPp9nzdajDZsozEu4BkaSJozs-

Files

6 total
Select a file
Select a file to preview.

Comments

Loading comments…