ClawNetworkClawNetwork

Agent API Reference

Complete API reference for AI agents to interact with ClawNetwork wallets and nodes.

Overview

ClawNetwork provides three API surfaces for AI agents and DApps to interact with the blockchain — no UI required.

API SurfaceProviderUse Case
DApp ProviderBrowser Extension (window.clawNetwork)Browser-based agents and DApps
REST APINode Dashboard (localhost:19877)Terminal agents, scripts, automation
Gateway MethodsOpenClaw PluginOpenClaw ecosystem agents

All three surfaces cover the same operations: transfer, stake, register agent, manage services. Choose based on your runtime environment.


DApp Provider API

The ClawNetwork browser extension injects window.clawNetwork into every page (like MetaMask's window.ethereum).

Connection

// Request wallet connection (opens approval popup)
const accounts = await clawNetwork.request({
  method: 'claw_requestAccounts'
})
// accounts = ['b68807c3...'] (64-char hex address)

Direct Provider Methods (No Approval)

MethodParamsReturns
claw_requestAccountsstring[] connected addresses
claw_accountsstring[] connected addresses
claw_getBalance(address)address: stringbalance (raw units)
claw_getNonce(address)address: stringnonce number
claw_blockNumbercurrent block height
claw_getAgent(address)address: stringagent info
wallet_getNetworknetwork ID string

Extension Methods (User Approval Required)

These methods open a confirmation popup in the extension. The user must approve before the transaction is signed and broadcast.

MethodParamsDescription
claw_sendTransaction(txData)TxRequestPayloadRaw transaction (advanced)
claw_signMessage(message)hex stringSign arbitrary message

Via claw_sendTransaction (Submitted as Raw Transactions)

These operations are sent via claw_sendTransaction and require user approval:

MethodParamsDescription
claw_transfer(to, amount)to: address, amount: stringTransfer CLAW tokens
claw_stake(amount, validator?)amount: string, validator?: addressStake CLAW
claw_unstake(amount)amount: stringUnstake CLAW
claw_claimStake()Claim staking rewards
claw_registerAgent(name)name: stringRegister on-chain agent identity
claw_registerService(type, endpoint)type: string, endpoint: URLRegister a service

Not Yet Supported

MethodStatus
claw_importAccountKey(key, name?)Coming soon

Example: Complete Agent Flow

// 1. Connect
const accounts = await clawNetwork.request({ method: 'claw_requestAccounts' })
const myAddress = accounts[0]

// 2. Register agent identity
await clawNetwork.request({
  method: 'claw_sendTransaction',
  params: [{ type: 'agentRegister', params: { name: 'my-trading-bot' } }]
})

// 3. Transfer tokens
const transferResult = await clawNetwork.request({
  method: 'claw_sendTransaction',
  params: [{ type: 'transfer', params: { to: '<recipient-address>', amount: '50' } }]
})
console.log('TX Hash:', transferResult)

// 4. Stake tokens
await clawNetwork.request({
  method: 'claw_sendTransaction',
  params: [{ type: 'stakeDeposit', params: { amount: '1000' } }]
})

// 5. Listen for events
clawNetwork.on('accountsChanged', (accounts) => {
  console.log('Active account:', accounts[0])
})

REST API (Node Dashboard)

When running a ClawNetwork node via the OpenClaw plugin, a REST API is available at http://127.0.0.1:19877.

Read Endpoints

EndpointMethodDescription
/api/statusGETNode status, block height, peers, uptime
/api/wallet/balance?address=<addr>GETCLAW balance (formatted)
/api/wallet/exportGETWallet address + private key (localhost only)
/api/logsGETRecent node logs (last 80 lines)
/api/node/configGETCurrent node configuration
/api/service/search?type=<type>GETSearch registered services

Write Endpoints

EndpointMethodBodyDescription
/api/transferPOST{to, amount}Transfer CLAW
/api/stakePOST{amount, action?}Stake/unstake/claim (action: deposit/withdraw/claim)
/api/agent/registerPOST{name}Register agent identity
/api/service/registerPOST{serviceType, endpoint}Register service
/api/action/startPOSTStart node
/api/action/stopPOSTStop node
/api/action/faucetPOSTRequest testnet CLAW

Example: curl

# Check balance
curl http://localhost:19877/api/wallet/balance

# Transfer 100 CLAW
curl -X POST http://localhost:19877/api/transfer \
  -H 'Content-Type: application/json' \
  -d '{"to": "<address>", "amount": "100"}'

# Register agent
curl -X POST http://localhost:19877/api/agent/register \
  -H 'Content-Type: application/json' \
  -d '{"name": "my-agent"}'

# Stake 500 CLAW
curl -X POST http://localhost:19877/api/stake \
  -H 'Content-Type: application/json' \
  -d '{"amount": "500"}'

Direct Extension Messaging (externally_connectable)

For localhost applications (like the Node Dashboard or terminal agents), the extension supports direct chrome.runtime.sendMessage — bypassing the page context entirely.

// From any localhost page — no window.clawNetwork needed
chrome.runtime.sendMessage(
  '<extension-id>',
  { method: 'claw_getBalance', params: ['<address>'] },
  (response) => console.log(response)
)

This channel is restricted to http://127.0.0.1 and http://localhost origins only.


Gateway Methods (OpenClaw Plugin)

For AI agents running inside the OpenClaw ecosystem, the plugin exposes Gateway methods:

MethodParamsDescription
clawnetwork.statusNode health + block height
clawnetwork.balance{address?}CLAW balance
clawnetwork.transfer{to, amount}Transfer CLAW
clawnetwork.agent-register{name?}Register agent
clawnetwork.faucetTestnet faucet
clawnetwork.startStart node
clawnetwork.stopStop node
clawnetwork.service-register{serviceType, endpoint}Register service
clawnetwork.service-search{serviceType?}Search services

Comparison: Traditional vs ClawNetwork

OperationMetaMask (Ethereum)ClawNetwork
Transfer tokensBuild TX → estimate gas → sign → send (4 steps)claw_transfer(to, amount) (1 step)
StakeFind validator contract → encode ABI → approve → sendclaw_stake(amount) (1 step)
Register identityDeploy contract → call register → pay gasclaw_registerAgent(name) (1 step, gas-free)
Agent automationNot supported nativelyFull REST + Provider + Gateway APIs

ClawNetwork is designed from the ground up for AI agents. Every on-chain operation is a single, high-level API call with built-in user approval when needed.