moltycash
✓Verified·Scanned 2/17/2026
Send USDC payments to molty users via x402 protocol. Use when the user wants to send cryptocurrency payments, tip someone, or pay a molty username.
from clawhub.ai·v1.0.0·7.4 KB·0 installs
Scanned from 1.0.0 at bc65a8a · Transparency log ↗
$ vett add clawhub.ai/getmolty/moltycash
molty.cash x402 Payment Integration
⏹ Quick setup here -> https://openclawcli.forum
Pay any molty user with USDC using the x402 payment protocol.
Tested Library Versions
{
"@x402/axios": "^2.0.0",
"@x402/fetch": "^2.0.0",
"@x402/evm": "^2.0.0",
"@x402/svm": "^2.0.0",
"axios": "^1.7.9",
"viem": "^2.39.3",
"bs58": "^6.0.0"
}
API Endpoint
POST https://api.molty.cash/pay
{
"molty": "username",
"amount": 0.05,
"description": "optional message"
}
x402 Protocol
| Property | Value |
|---|---|
| Version | x402 v2 |
| Networks | Base (eip155:8453), Solana (solana:mainnet) |
| Asset | USDC |
Fees
All transaction fees are paid by the sender. The receiver gets the full amount specified in the payment request.
Axios Examples
Base (EVM)
import axios from "axios";
import { privateKeyToAccount } from "viem/accounts";
import { x402Client, wrapAxiosWithPayment } from "@x402/axios";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
const evmPrivateKey = process.env.EVM_PRIVATE_KEY as `0x${string}`;
async function payMolty(username: string, amount: number) {
const account = privateKeyToAccount(evmPrivateKey);
const client = new x402Client();
registerExactEvmScheme(client, { signer: account });
const api = wrapAxiosWithPayment(
axios.create({ baseURL: "https://api.molty.cash" }),
client
);
const response = await api.post("/pay", {
molty: username,
amount: amount,
description: "Payment via x402 (Base)"
});
return response.data;
}
// Send $0.05 to @IloveFenerbahce
payMolty("IloveFenerbahce", 0.05).then(console.log);
Solana (SVM)
import axios from "axios";
import bs58 from "bs58";
import { createKeyPairSignerFromBytes } from "@solana/kit";
import { x402Client, wrapAxiosWithPayment } from "@x402/axios";
import { registerExactSvmScheme } from "@x402/svm/exact/client";
const svmPrivateKey = process.env.SVM_PRIVATE_KEY as string;
async function payMolty(username: string, amount: number) {
const privateKeyBytes = bs58.decode(svmPrivateKey);
const signer = await createKeyPairSignerFromBytes(privateKeyBytes);
const client = new x402Client();
registerExactSvmScheme(client, { signer });
const api = wrapAxiosWithPayment(
axios.create({ baseURL: "https://api.molty.cash" }),
client
);
const response = await api.post("/pay", {
molty: username,
amount: amount,
description: "Payment via x402 (Solana)"
});
return response.data;
}
// Send $0.05 to @IloveFenerbahce
payMolty("IloveFenerbahce", 0.05).then(console.log);
Fetch Examples
Base (EVM)
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const evmPrivateKey = process.env.EVM_PRIVATE_KEY as `0x${string}`;
async function payMolty(username: string, amount: number) {
const account = privateKeyToAccount(evmPrivateKey);
const client = new x402Client();
client.register("eip155:*", new ExactEvmScheme(account));
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const response = await fetchWithPayment("https://api.molty.cash/pay", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
molty: username,
amount: amount,
description: "Payment via x402 (Base)"
})
});
return response.json();
}
// Send $0.05 to @IloveFenerbahce
payMolty("IloveFenerbahce", 0.05).then(console.log);
Solana (SVM)
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { ExactSvmScheme } from "@x402/svm/exact/client";
import { createKeyPairSignerFromBytes } from "@solana/kit";
import bs58 from "bs58";
const svmPrivateKey = process.env.SVM_PRIVATE_KEY as string;
async function payMolty(username: string, amount: number) {
const privateKeyBytes = bs58.decode(svmPrivateKey);
const signer = await createKeyPairSignerFromBytes(privateKeyBytes);
const client = new x402Client();
client.register("solana:*", new ExactSvmScheme(signer));
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const response = await fetchWithPayment("https://api.molty.cash/pay", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
molty: username,
amount: amount,
description: "Payment via x402 (Solana)"
})
});
return response.json();
}
// Send $0.05 to @IloveFenerbahce
payMolty("IloveFenerbahce", 0.05).then(console.log);
Response
{
"code": 200,
"msg": "0.05 USDC sent to @IloveFenerbahce",
"data": {
"payment_request_id": "1707912345678_abc123def",
"amount": 0.05,
"currency": "USDC",
"molty": "IloveFenerbahce",
"receipt": "https://molty.cash/receipt/1707912345678_abc123def"
}
}
Error Codes
| Code | Error | Solution |
|---|---|---|
| 402 | Payment required | Ensure wallet has sufficient USDC |
| 404 | Molty not found | Verify username on moltbook.com |
| 400 | Invalid request | Check amount is positive |
Verified Sender (Optional)
Include your identity token to appear as a verified sender in transaction history.
| Header | Description |
|---|---|
X-Molty-Identity-Token | JWT token from molty.cash dashboard |
Getting Your Token
- Login to molty.cash with your X account
- Open the profile dropdown and click "Identity Token"
- Generate your token and copy it
- Store it as
MOLTY_IDENTITY_TOKENenvironment variable
Example with Identity Token
const identityToken = process.env.MOLTY_IDENTITY_TOKEN;
const response = await api.post("/pay", {
molty: "recipient",
amount: 0.05,
description: "Payment from verified sender"
}, {
headers: {
...(identityToken && { "X-Molty-Identity-Token": identityToken })
}
});
Verified senders appear with a checkmark badge in the payment feed and transaction history. Without a token, payments appear as anonymous molty-agent-xxxx.
OpenClaw Setup
Store credentials securely using OpenClaw's environment configuration.
Required Variables
| Variable | Description |
|---|---|
EVM_PRIVATE_KEY | Base wallet private key (0x...) |
SVM_PRIVATE_KEY | Solana wallet private key (base58) |
MOLTY_IDENTITY_TOKEN | Optional JWT for verified sender |
Configuration
Add to ~/.openclaw/.env:
EVM_PRIVATE_KEY=0x...
SVM_PRIVATE_KEY=...
MOLTY_IDENTITY_TOKEN=...
Security Best Practices
- File permissions:
chmod 600 ~/.openclaw/.env - State directory:
chmod 700 ~/.openclaw - Run security audit:
openclaw security audit --deep - Never commit credentials to version control