Broadcast Transactions#
Broadcast transactions to the specified blockchain.
Transaction Broadcast API is available to our enterprise customers only. If you are interested, please contact us dexapi@okx.com.
Disclaimer
Your end-user's transaction can only be covered by the MEV protection feature if you actually utilise OKX Build's API services for that particular transaction. MEV protection is currently an experimental feature provided by third-parties and OKX Build does not guarantee the effectiveness and quality of such MEV protection.
Request URL#
POST https://web3.okx.com/api/v5/dex/pre-transaction/broadcast-transaction
Request Parameters#
Parameter | Type | Required | Description |
---|---|---|---|
signedTx | String | Yes | The transaction string after being signed |
chainIndex | String | Yes | Unique identifier for the chain. e.g., ETH=1. See more here. |
address | String | Yes | Address. |
extraData | String | No | Additional parameters for calldata and other information |
> enableMevProtection | Boolean | No | Enable MEV protection. Not enabled by default. Valid values: false :not enabled, true :enabled It supports only ETH 、BSC 、SOL 、BASE , more chains will be supported soon. |
> jitoSignedTx | String | No | The transaction string after being signed that will send to Jito, applicable to SOL . For SOL, signedTx and jitoSignedTx must be passed at the same time |
Response Parameters#
Parameter | Type | Description |
---|---|---|
orderId | String | Unique transaction identifier |
txHash | String | Transaction Hash. It supports only ETH 、BSC 、SOL 、BASE , more chains will be supported soon. |
Request Example#
shell
curl --location --request POST 'https://web3.okx.com/api/v5/dex/pre-transaction/broadcast-transaction' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z' \
--data-raw '{
"signedTx":"0x08b47112567534ad041bbc6fa102394773c6d8f6d634320773af4da55efa",
"address": "0x383c8208b4711256753b70729ba0cf0cda55efad",
"chainIndex": "1",
"extraData":"{\"enableMevProtection\":true,\"jitoSignedTx\":\"0x123456\"}"
}'
Response Example#
200
{
"code": "0",
"data": [
{
"orderId": "0x383c8208b4711256753b70729ba0cf0cda55efad",
"txHash": "0xd394f356a16b618ed839c66c935c9cccc5dde0af832ff9b468677eea38759db5"
}
],
"msg": ""
}