/okx:okx-onchain-gatewayfrom okx
This skill should be used when the user asks to 'broadcast transaction', 'send tx', 'estimate gas', 'simulate transaction', 'check tx status', 'track my transaction', 'get gas price', 'gas limit', 'broadcast signed tx', or mentions broadcasting transactions, sending transactions on-chain, gas estimation, transaction simulation, tracking broadcast orders, or checking transaction status. Covers gas price, gas limit estimation, transaction simulation, transaction broadcasting, and order tracking across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon, and 20+ other chains. Do NOT use for swap quote or execution - use okx-dex-swap instead. Do NOT use for general programming questions about transaction handling.
Ships in okx. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
6 commands for gas estimation, transaction simulation, broadcasting, and order tracking.
Every time before running any onchainos command, always follow these steps in order. Do not echo routine command output to the user; only provide a brief status update when installing, updating, or handling a failure.
Confirm installed: Run which onchainos. If not found, install it:
curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh
If the install script fails, ask the user to install manually following the instructions at: https://github.com/okx/onchainos-skills
Check for updates: Read ~/.onchainos/last_check and compare it with the current timestamp:
cached_ts=$(cat ~/.onchainos/last_check 2>/dev/null || true)
now=$(date +%s)
cached_ts is non-empty and (now - cached_ts) < 43200 (12 hours), skip the update and proceed.curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh
If a newer version is installed, tell the user and suggest updating their onchainos skills from https://github.com/okx/onchainos-skills to get the latest features.If any onchainos command fails with an unexpected error during this
session, try reinstalling before giving up:
curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh
Create a .env file in the project root to override the default API credentials (optional — skip this for quick start):
OKX_API_KEY= # or OKX_ACCESS_KEY
OKX_SECRET_KEY=
OKX_PASSPHRASE=
okx-dex-swapokx-dex-marketokx-dex-tokenokx-wallet-portfoliookx-onchain-gateway)# Get current gas price on XLayer
onchainos gateway gas --chain xlayer
# Estimate gas limit for a transaction
onchainos gateway gas-limit --from 0xYourWallet --to 0xRecipient --chain xlayer
# Simulate a transaction (dry-run)
onchainos gateway simulate --from 0xYourWallet --to 0xContract --data 0x... --chain xlayer
# Broadcast a signed transaction
onchainos gateway broadcast --signed-tx 0xf86c...signed --address 0xYourWallet --chain xlayer
# Track order status
onchainos gateway orders --address 0xYourWallet --chain xlayer --order-id 123456789
The CLI accepts human-readable chain names and resolves them automatically.
| Chain | Name | chainIndex |
|---|---|---|
| XLayer | xlayer | 196 |
| Solana | solana | 501 |
| Ethereum | ethereum | 1 |
| Base | base | 8453 |
| BSC | bsc | 56 |
| Arbitrum | arbitrum | 42161 |
| # | Command | Description |
|---|---|---|
| 1 | onchainos gateway chains | Get supported chains for gateway |
| 2 | onchainos gateway gas --chain <chain> | Get current gas prices for a chain |
| 3 | onchainos gateway gas-limit --from ... --to ... --chain ... | Estimate gas limit for a transaction |
| 4 | onchainos gateway simulate --from ... --to ... --data ... --chain ... | Simulate a transaction (dry-run) |
| 5 | onchainos gateway broadcast --signed-tx ... --address ... --chain ... | Broadcast a signed transaction |
| 6 | onchainos gateway orders --address ... --chain ... | Track broadcast order status |
This skill is the final mile — it takes a signed transaction and sends it on-chain. It pairs with swap (to get tx data).
User: "Swap 1 ETH for USDC and broadcast it"
1. okx-dex-swap onchainos swap swap --from ... --to ... --amount ... --chain ethereum --wallet <addr>
↓ user signs the tx locally
2. okx-onchain-gateway onchainos gateway broadcast --signed-tx <signed_hex> --address <addr> --chain ethereum
↓ orderId returned
3. okx-onchain-gateway onchainos gateway orders --address <addr> --chain ethereum --order-id <orderId>
Data handoff:
tx.data, tx.to, tx.value, tx.gas from swap → user builds & signs → --signed-tx for broadcastorderId from broadcast → --order-id param in orders queryUser: "Simulate this transaction first, then broadcast if safe"
1. onchainos gateway simulate --from 0xWallet --to 0xContract --data 0x... --chain ethereum
↓ simulation passes (no revert)
2. onchainos gateway broadcast --signed-tx <signed_hex> --address 0xWallet --chain ethereum
3. onchainos gateway orders --address 0xWallet --chain ethereum --order-id <orderId>
User: "Check gas, swap for USDC, then send it"
1. onchainos gateway gas --chain ethereum → check gas prices
2. okx-dex-swap onchainos swap swap --from ... --to ... --chain ethereum --wallet <addr>
↓ user signs
3. onchainos gateway broadcast --signed-tx <signed_hex> --address <addr> --chain ethereum
4. onchainos gateway orders --address <addr> --chain ethereum --order-id <orderId>
onchainos gateway gasonchainos gateway gas-limitonchainos gateway simulateonchainos gateway broadcastonchainos gateway ordersonchainos gateway chains--chain xlayer, low gas, fast confirmation) as the default, then ask which chain the user prefers--signed-tx → remind user to sign the transaction first (this CLI does NOT sign)--from, --to, optionally --data (calldata)--address and --chain, optionally --order-idonchainos gateway gas or gas-limit, display resultsonchainos gateway simulate, check for revert or successonchainos gateway broadcast with signed tx, return orderIdonchainos gateway orders, display order statusAfter displaying results, suggest 2-3 relevant follow-up actions:
| Just completed | Suggest |
|---|---|
gateway gas | 1. Estimate gas limit for a specific tx → onchainos gateway gas-limit (this skill) 2. Get a swap quote → okx-dex-swap |
gateway gas-limit | 1. Simulate the transaction → onchainos gateway simulate (this skill) 2. Proceed to broadcast → onchainos gateway broadcast (this skill) |
gateway simulate | 1. Broadcast the transaction → onchainos gateway broadcast (this skill) 2. Adjust and re-simulate if failed |
gateway broadcast | 1. Track order status → onchainos gateway orders (this skill) |
gateway orders | 1. View price of received token → okx-dex-market 2. Execute another swap → okx-dex-swap |
Present conversationally, e.g.: "Transaction broadcast! Would you like to track the order status?" — never expose skill names or endpoint paths to the user.
Get supported chains for gateway. No parameters required.
onchainos gateway chains
Return fields:
| Field | Type | Description |
|---|---|---|
chainIndex | String | Chain identifier (e.g., "1", "501") |
name | String | Human-readable chain name (e.g., "Ethereum") |
logoUrl | String | Chain logo image URL |
shortName | String | Chain short name (e.g., "ETH") |
Get current gas prices for a chain.
onchainos gateway gas --chain <chain>
| Param | Required | Default | Description |
|---|---|---|---|
--chain | Yes | - | Chain name (e.g., ethereum, solana, xlayer) |
Return fields:
| Field | Type | Description |
|---|---|---|
normal | String | Normal gas price (legacy) |
min | String | Minimum gas price |
max | String | Maximum gas price |
supporteip1559 | Boolean | Whether EIP-1559 is supported |
eip1559Protocol.suggestBaseFee | String | Suggested base fee |
eip1559Protocol.baseFee | String | Current base fee |
eip1559Protocol.proposePriorityFee | String | Proposed priority fee |
eip1559Protocol.safePriorityFee | String | Safe (slow) priority fee |
eip1559Protocol.fastPriorityFee | String | Fast priority fee |
For Solana chains: proposePriorityFee, safePriorityFee, fastPriorityFee, extremePriorityFee.
Estimate gas limit for a transaction.
onchainos gateway gas-limit --from <address> --to <address> --chain <chain> [--amount <amount>] [--data <hex>]
| Param | Required | Default | Description |
|---|---|---|---|
--from | Yes | - | Sender address |
--to | Yes | - | Recipient / contract address |
--chain | Yes | - | Chain name |
--amount | No | "0" | Transfer value in minimal units |
--data | No | - | Encoded calldata (hex, for contract interactions) |
Return fields:
| Field | Type | Description |
|---|---|---|
gasLimit | String | Estimated gas limit for the transaction |
Simulate a transaction (dry-run).
onchainos gateway simulate --from <address> --to <address> --data <hex> --chain <chain> [--amount <amount>]
| Param | Required | Default | Description |
|---|---|---|---|
--from | Yes | - | Sender address |
--to | Yes | - | Recipient / contract address |
--data | Yes | - | Encoded calldata (hex) |
--chain | Yes | - | Chain name |
--amount | No | "0" | Transfer value in minimal units |
Return fields:
| Field | Type | Description |
|---|---|---|
intention | String | Transaction intent description |
assetChange[] | Array | Asset changes from the simulation |
assetChange[].symbol | String | Token symbol |
assetChange[].rawValue | String | Raw amount change |
gasUsed | String | Gas consumed in simulation |
failReason | String | Failure reason (empty string = success) |
risks[] | Array | Risk information |
Broadcast a signed transaction.
onchainos gateway broadcast --signed-tx <tx> --address <address> --chain <chain>
| Param | Required | Default | Description |
|---|---|---|---|
--signed-tx | Yes | - | Fully signed transaction (hex for EVM, base58 for Solana) |
--address | Yes | - | Sender wallet address |
--chain | Yes | - | Chain name |
Return fields:
| Field | Type | Description |
|---|---|---|
orderId | String | OKX order tracking ID (use for order status queries) |
txHash | String | On-chain transaction hash |
Track broadcast order status.
onchainos gateway orders --address <address> --chain <chain> [--order-id <id>]
| Param | Required | Default | Description |
|---|---|---|---|
--address | Yes | - | Wallet address |
--chain | Yes | - | Chain name |
--order-id | No | - | Specific order ID (from broadcast response) |
Return fields:
| Field | Type | Description |
|---|---|---|
cursor | String | Pagination cursor for next page |
orders[] | Array | List of order objects |
orders[].orderId | String | OKX order tracking ID |
orders[].txHash | String | On-chain transaction hash |
orders[].chainIndex | String | Chain identifier |
orders[].address | String | Wallet address |
orders[].txStatus | String | Transaction status: 1 = Pending, 2 = Success, 3 = Failed |
orders[].failReason | String | Failure reason (empty if successful) |
User says: "What's the current gas price on XLayer?"
onchainos gateway gas --chain xlayer
# → Display:
# Base fee: 0.05 Gwei
# Max fee: 0.1 Gwei
# Priority fee: 0.01 Gwei
User says: "Simulate this swap transaction before I send it"
onchainos gateway simulate --from 0xYourWallet --to 0xDexContract --data 0x... --chain xlayer --amount 1000000000000000000
# → Display:
# Simulation: SUCCESS
# Estimated gas: 145,000
# Intent: Token Swap
User says: "Broadcast my signed transaction"
onchainos gateway broadcast --signed-tx 0xf86c...signed --address 0xYourWallet --chain xlayer
# → Display:
# Broadcast successful!
# Order ID: 123456789
# Tx Hash: 0xabc...def
User says: "Check the status of my broadcast order"
onchainos gateway orders --address 0xYourWallet --chain xlayer --order-id 123456789
# → Display:
# Order 123456789: Success (txStatus=2)
# Tx Hash: 0xabc...def
# Confirmed on-chain
--signed-tx format matches the chain.onchainos gateway chains first to verify.⚠️ Service is not available in your region. Please switch to a supported region and try again.--signed-tx is broadcast twice, the API may return an error or the same txHash — handle idempotently.18.5 Gwei), never raw wei21000, 145000)1.5 ETH), never base unitseip1559Protocol.suggestBaseFee + proposePriorityFee for EIP-1559 chains, normal for legacyethereum → 1, solana → 501)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ulpi-io/plugin-marketplace --plugin okx9 skills in this plugin
/okx-cex-botThis skill should be used when the user asks to 'start a grid bot', 'create a grid bot', 'stop the grid bot', 'show my grid bots', 'grid bot status', 'grid bot P&L', 'create a DCA bot', 'start a DCA bot', 'set up a martingale bot', 'show my DCA bots', 'stop the DCA bot', 'DCA P&L', or any request involving creating, stopping, querying, or monitoring grid or DCA (Dollar Cost Averaging / Martingale) bots on OKX CEX. Grid covers both spot and contract variants. DCA is contract-only (leveraged Martingale on futures/swaps). Requires API credentials. Do NOT use for regular spot/swap/futures orders (use okx-cex-trade), market data (use okx-cex-market), or account balance/portfolio (use okx-cex-portfolio)./okx-cex-marketThis skill should be used when the user asks for 'price of BTC', 'ETH ticker', 'show me the orderbook', 'market depth', 'BTC candles', 'OHLCV chart data', 'funding rate', 'open interest', 'mark price', 'index price', 'recent trades', 'price limit', 'list instruments', 'what instruments are available', or any request to query public market data on OKX CEX. All commands are read-only and do NOT require API credentials. Do NOT use for account balance/positions (use okx-cex-portfolio), placing/cancelling orders (use okx-cex-trade), or grid/DCA bots (use okx-cex-bot).Other plugins' skills for the same job