Overview
The OKX DEX SDK provides transaction broadcasting with built-in MEV (Maximal Extractable Value) protection. This feature helps protect your transactions from front-running and sandwich attacks.API Whitelist Required: Transaction broadcasting requires your API key to be whitelisted. Contact OKX support to enable this feature.
Basic Transaction Broadcasting
MEV Protection
MEV protection helps prevent front-running and sandwich attacks by routing your transaction through protected channels.Enabling MEV Protection
Without MEV Protection
Complete Broadcasting Example
Solana: Jito MEV Protection
For Solana transactions, use Jito for MEV protection:Advanced Options
Custom Extra Data
Provide additional metadata with your transaction:Transaction Verification
After broadcasting, verify the transaction:Error Handling
Handle Broadcast Failures
Retry Logic
Best Practices
Always Use MEV Protection
For production applications, always enable MEV protection:Verify Network Connection
Monitor Gas Prices
Check gas prices before broadcasting:API Reference
broadcastTransaction
Parameters:signedTx- Signed transaction hex string (required)chainIndex- Chain identifier (required)address- Wallet address (required)enableMevProtection- Enable MEV protection (optional, recommended: true)jitoSignedTx- Jito-signed transaction for Solana (optional)extraData- Additional metadata as JSON string (optional)
orderId- Unique order identifier for trackingtxHash- Transaction hash
Whitelist Requirement: This endpoint requires API key whitelisting. Contact OKX support to enable broadcasting for your API key.
Next Steps
Order Tracking
Track your broadcasted transactions
Gas Estimation
Optimize gas costs before broadcasting