x402 Singularity Layer
x402-layer helps agents pay for APIs with USDC, deploy monetized endpoints, manage credits/webhooks/marketplace listings, and handle wallet-first ERC-8004 re...
x402-layer helps agents pay for APIs with USDC, deploy monetized endpoints, manage credits/webhooks/marketplace listings, and handle wallet-first ERC-8004 re...
Real data. Real impact.
Growing
Developers
Per week
Open source
Skills give you superpowers. Install in 30 seconds.
x402 is a Web3 payment layer where humans and agents can sell and consume APIs, products, and credits. This skill can sign wallet messages, submit on-chain transactions, call x402/studio APIs, and manage monetized endpoint infrastructure. Sensitive credentials are only needed for specific capability paths, not for baseline installation or read-only discovery. This skill covers the full Singularity Layer lifecycle:
Networks: Base, Ethereum, Polygon, BSC, Monad, Solana
Currency: USDC
Protocol: HTTP 402 Payment Required
Security-first usage: No secret environment variable is universally required for installation. Set only the minimum variables needed for the exact runbook you are using. Prefer AWAL, OWS, API keys, or ephemeral wallets over long-lived mainnet private keys whenever possible.
Execution scope: For discovery, docs, and listing inspection, stay on the no-secret path first. Only use private keys, Solana signer keys, endpoint API keys, PATs, or support tokens when the user explicitly wants signing, webhook management, support auth, or owner-scoped control-plane actions.
Expected network/binary surface:
,api.x402layer.cc,studio.x402layer.cc, and localmcp.x402layer.cc/awalbinaries when those wallet modes are explicitly enabled.ows
Use this routing first, then load the relevant reference doc.
| User intent | Primary path | Reference |
|---|---|---|
| Integrate crypto payments into an app/platform | , , , , | , , |
| Pay/consume endpoint or product | , , , , | , , , |
| Discover/search marketplace | | , |
| Create/edit/list endpoint | , , , | , , |
| Manage dashboard/platform control plane with PAT-backed access | tools such as , , , , , , | , , |
| Configure/verify webhooks | , | |
| Register/discover/manage/rate agents (ERC-8004/Solana-8004) | , , , , | |
| Human-backed agent wallet benefits (World AgentKit) | , | |
| Support and buyer/seller messaging | , , | |
| Use OpenWallet / OWS as an optional wallet backend | | , , |
pip install -r {baseDir}/requirements.txt
Option A: private keys
export PRIVATE_KEY="0x..." export WALLET_ADDRESS="0x..." # Solana optional export SOLANA_SECRET_KEY="base58-or-[1,2,3,...]"
Option B: Coinbase AWAL
# Install Coinbase AWAL skill (shortcut) npx skills add coinbase/agentic-wallet-skills export X402_USE_AWAL=1
Option C: OpenWallet / OWS
npm install -g @open-wallet-standard/core export OWS_WALLET="hackathon-wallet"
Use private-key mode for deep ERC-8004 registration and any on-chain update path that still needs direct transaction signing. AWAL remains useful for x402 payment flows. OWS is optional-first for pay/discover/sign-message flows plus wallet-auth list/support flows through
ows_cli.py and the shared wallet helpers.
Do not export every credential shown above at once. Pick one wallet path and only the extra control-plane credentials the selected runbook needs.
If the user provides a dashboard PAT, the agent can also use Singularity MCP for owner-scoped account actions:
export SINGULARITY_PAT="sgl_pat_..."
Use MCP when the task is about:
Keep the direct scripts for:
Security note: scripts read only explicit process environment variables.
.env files are not auto-loaded.
Least-privilege note: the skill supports multiple credential types, but no single runbook needs all of them. Read-only discovery needs no secrets. PAT, API-key, AWAL, OWS, EVM, and Solana signing flows should be treated as separate capability paths, and users should set only the smallest subset required for the task in front of them.
Risk note: this skill can sign messages, submit transactions, and call x402/studio APIs. Prefer AWAL, OWS, PATs, endpoint API keys, or throwaway wallets over long-lived private keys when possible.
| Script | Purpose |
|---|---|
| Pay endpoint on Base, with optional AgentKit benefit flow |
| Pay endpoint on Solana |
| Consume using credits |
| Purchase digital products/files |
| Check credit balance |
| Buy endpoint credit packs |
| Browse/search marketplace and inspect AgentKit benefits |
| Authenticate a wallet for support APIs |
| Check support eligibility, open/list/show/close/reopen support threads |
| Send and read XMTP support messages for a support thread |
| Run AWAL auth/pay/discover commands |
| Run OpenWallet / OWS wallet, pay, discover, sign-message, and agent-key commands |
| Script | Purpose |
|---|---|
| Deploy endpoint ($1 one-time, includes 4,000 credits) |
| List/update endpoint settings |
| Recharge provider endpoint credits |
| List/unlist/update marketplace listing |
| Set/remove/check endpoint webhook URL |
| Verify webhook signature + receipt genuineness (PyJWT/JWKS) |
| Script | Purpose |
|---|---|
| Register ERC-8004/Solana-8004 agent with image/version/tags and endpoint binding support |
| List ERC-8004 agents owned by the configured wallet or linked dashboard user |
| List platform endpoints that can be linked to ERC-8004 agents |
| Update existing ERC-8004/Solana-8004 agent metadata, visibility, and endpoint bindings |
| Submit on-chain reputation feedback |
When x402 proxies traffic to your origin, verify:
x-api-key: <YOUR_API_KEY>
Reject requests when missing/invalid.
# 1. Create or reuse a paid endpoint python {baseDir}/scripts/create_endpoint.py my-api "My API" https://api.example.com 0.012. Add server-side fulfillment
python {baseDir}/scripts/manage_webhook.py set my-api https://my-server.com/webhook
3. Verify webhook signatures and payment receipts server-side
python {baseDir}/scripts/verify_webhook_payment.py
--body-file ./webhook.json
--signature 't=1700000000,v1=<hex>'
--secret '<YOUR_SIGNING_SECRET>'
--required-source-slug my-api
--require-receipt
python {baseDir}/scripts/pay_base.py https://api.x402layer.cc/e/weather-data python {baseDir}/scripts/pay_base.py https://api.x402layer.cc/e/weather-data --agentkit auto python {baseDir}/scripts/pay_solana.py https://api.x402layer.cc/e/weather-data python {baseDir}/scripts/consume_credits.py https://api.x402layer.cc/e/weather-dataOptional OWS backend
python {baseDir}/scripts/ows_cli.py pay-url https://api.x402layer.cc/e/weather-data --wallet hackathon-wallet
python {baseDir}/scripts/discover_marketplace.py python {baseDir}/scripts/discover_marketplace.py search weather python {baseDir}/scripts/discover_marketplace.py details weather-apiOptional OWS discovery path
python {baseDir}/scripts/ows_cli.py discover weather
python {baseDir}/scripts/create_endpoint.py my-api "My API" https://api.example.com 0.01 python {baseDir}/scripts/manage_endpoint.py list python {baseDir}/scripts/manage_endpoint.py update my-api --price 0.02 python {baseDir}/scripts/topup_endpoint.py my-api 10
python {baseDir}/scripts/list_on_marketplace.py my-api \ --category ai \ --description "AI-powered analysis" \ --logo https://example.com/logo.png \ --banner https://example.com/banner.jpg
python {baseDir}/scripts/manage_webhook.py set my-api https://my-server.com/webhook python {baseDir}/scripts/manage_webhook.py info my-api python {baseDir}/scripts/manage_webhook.py remove my-api
Studio seller webhooks are HMAC-signed. Expect:
X-X402-SignatureX-X402-TimestampX-X402-EventX-X402-Event-IdVerify
HMAC-SHA256(timestamp + "." + rawBody) with the webhook signing_secret. Keep legacy raw-secret header checks only as backward-compatibility fallback for older receivers.
Webhook verification helper:
python {baseDir}/scripts/verify_webhook_payment.py \ --body-file ./webhook.json \ --signature 't=1700000000,v1=<hex>' \ --secret '<YOUR_SIGNING_SECRET>' \ --required-source-slug my-api \ --require-receipt
# Inspect whether a listing advertises a verified human-backed agent wallet benefit python {baseDir}/scripts/discover_marketplace.py details weather-dataAttempt Base payment with AgentKit if the endpoint advertises a benefit
python {baseDir}/scripts/pay_base.py https://api.x402layer.cc/e/weather-data --agentkit auto
Require AgentKit qualification instead of silently falling back
python {baseDir}/scripts/pay_base.py https://api.x402layer.cc/e/weather-data --agentkit required
# Authenticate the current wallet for support APIs python {baseDir}/scripts/support_auth.py loginCheck whether support is available for a listing
python {baseDir}/scripts/support_threads.py eligibility endpoint weather-data
Open or reuse the support thread
python {baseDir}/scripts/support_threads.py open endpoint weather-data
Read and send XMTP messages for a support thread
node {baseDir}/scripts/xmtp_support.mjs messages <thread_id> node {baseDir}/scripts/xmtp_support.mjs send <thread_id> "Need help with this endpoint"
# List local OWS wallets python {baseDir}/scripts/ows_cli.py wallet-listSign a message without exporting a raw private key
python {baseDir}/scripts/ows_cli.py sign-message --chain ethereum --wallet hackathon-wallet --message "hello"
Create an OWS agent API key
python {baseDir}/scripts/ows_cli.py key-create --name codex-agent --wallet hackathon-wallet
OWS now works well for wallet lookup, challenge signing, marketplace discovery, support auth, and wallet-auth list flows. Deep ERC-8004 registration and on-chain agent update transactions still require direct signing keys.
# Set a dashboard PAT only for owner-scoped control-plane actions export SINGULARITY_PAT="sgl_pat_..."Then use Singularity MCP for owner inventory/config operations such as:
- list_my_endpoints
- update_endpoint
- list_my_products
- update_product
- set_webhook
- remove_webhook
- request_endpoint_creation_payment
python {baseDir}/scripts/list_my_endpoints.pypython {baseDir}/scripts/register_agent.py
"My Agent"
"Autonomous service agent"
--network baseSepolia
--image https://example.com/agent.png
--version 1.10.0
--tag finance
--tag automation
--endpoint-id <ENDPOINT_UUID>
--custom-endpoint https://api.example.com/agentpython {baseDir}/scripts/list_agents.py --network baseSepolia
python {baseDir}/scripts/update_agent.py
--network baseSepolia
--agent-id 123
--version 1.4.1
--tag finance
--tag automation
--endpoint-id <ENDPOINT_UUID>
--publicThe same EVM flow also supports:
--network ethereum
--network polygon
--network bsc
--network monad
python {baseDir}/scripts/submit_feedback.py
--network base
--agent-id 123
--rating 5
--comment "High quality responses"
Load only what is needed for the user task:
references/payments-integration.md:
product-vs-endpoint-vs-credits decision guide plus webhook/receipt fulfillment patterns.references/pay-per-request.md:
EIP-712/Solana payment flow and low-level signing details.references/credit-based.md:
credit purchase + consumption behavior and examples.references/marketplace.md:
search/list/unlist marketplace endpoints.references/agentkit-benefits.md:
discover, qualify for, and pay with World AgentKit human-backed agent wallet benefits.references/agentic-endpoints.md:
endpoint creation/top-up/status API behavior.references/webhooks-verification.md:
webhook events, signature verification, and receipt cross-checks.references/agent-registry-reputation.md:
ERC-8004/Solana-8004 registration, discovery, management, and feedback rules.references/xmtp-support.md:
how support chat works in Studio, what needs human setup, and how agents should coordinate with users.references/mcp-control-plane.md:
when to use Singularity MCP, what PAT scopes are needed, and which owner-scoped actions should prefer MCP over direct scripts.references/openwallet-ows.md:
optional OpenWallet / OWS wallet backend guidance, install commands, and current scope.references/payment-signing.md:
exact signing domains/types/header payload details.No single task needs every variable below. Use least privilege and set only what the current script requires.
Choose the smallest path that fits the task:
| Variable | Used by | Notes |
|---|---|---|
| most Base/EVM flows | primary wallet address |
| Base private-key mode, support auth, XMTP helper | EVM signing key |
| AWAL mode | set |
| auth selection | , , |
| network selection | , |
| optional AgentKit behavior | , , |
| API override | default |
| OWS wrapper flows | wallet name or ID for |
| OWS wrapper flows | optional explicit path to the executable |
| Variable | Used by | Notes |
|---|---|---|
| Singularity MCP owner-scoped management flows | optional PAT in format; not required for install or normal script usage |
| Variable | Used by | Notes |
|---|---|---|
| endpoint/webhook/listing management | endpoint API key |
| fallback for management scripts | interchangeable fallback with |
| Variable | Used by | Notes |
|---|---|---|
| Solana private-key mode | base58 secret or JSON array bytes |
| Solana override and listing helpers | optional |
| dual-chain endpoint mode | optional |
| Variable | Used by | Notes |
|---|---|---|
| support thread scripts | optional reuse of prior login |
| , | optional Studio API base override |
| support thread scripts | default |
| | default |
| | optional persistent DB path override |
| Variable | Used by | Notes |
|---|---|---|
| | only needed for reputation feedback writes |
and other chain RPC URLs | | optional RPC overrides for agent registration |
https://api.x402layer.cc/e/{slug}https://api.x402layer.cc/api/marketplacehttps://api.x402layer.cc/api/credits/*https://api.x402layer.cc/agent/*https://mcp.x402layer.cc/mcpSolana exact-payment flows must use the
feePayer returned by the challenge and keep the transaction compute-unit limit within facilitator requirements. pay_solana.py and solana_signing.py handle this for the current PayAI-backed flow; prefer Base when you need the simplest production path.
OpenWallet / OWS support is optional-first in this release: use it for pay/discover/sign-message flows and wallet-auth list/support flows, but keep private-key mode for deep wallet-first registration and on-chain update transaction paths. OWS execution now requires a local
ows binary (or OWS_BIN) instead of fetching code on demand via runtime npx.
This skill supports many optional workflows, so it can work with many credential types. That does not mean you should set all of them.
Preferred order of safety when possible:
Do not export a long-lived high-value custody wallet into the environment just to browse, inspect, or test small flows.
No automatic installation available. Please visit the source repository for installation instructions.
View Installation Instructions1,500+ AI skills, agents & workflows. Install in 30 seconds. Part of the Torly.ai family.
© 2026 Torly.ai. All rights reserved.