Broadcast transactions to the blockchain, only for use with wallet account.
This interface includes functions such as broadcasting transactions, checking transaction balances, displaying transaction records, and accelerating transactions.
Except for the signed transaction string, all other parameters will be returned when querying transaction records. If acceleration is needed, a new transaction can be initiated based on parameters such as nonce and gasPrice.
When broadcasting BTC and other UTXO model transactions, certain parameters do not need to be displayed, and they can be left blank.
POST https://www.okx.com/api/v5/wallet/pre-transaction/send-transaction
Parameter | Type | Required | Description |
---|---|---|---|
signedTx | String | Yes | Signed transaction string |
chainIndex | String | Yes | Unique identifier for the chain, e.g., ETH=3, details can be found in the Chain Unique Identifier Compilation |
accountId | String | Yes | Unique identifier for the account |
fromAddr | String | Yes | Sender's address |
toAddr | String | Yes | Recipient's address |
txHash | String | Yes | Transaction hash |
txAmount | String | Yes | The amount of the main chain crypto, passed in the smallest unit of the mainnet coin, such as ETH wei. |
serviceCharge | String | Yes | gasPrice * gasLimit, representing the total transaction fee, passed in the smallest unit of the mainnet currency, such as ETH wei. |
tokenAddress | String | Yes | Token address |
txType | String | Yes | Transaction type:1 : Tranfer 3 : Contract interaction 4 : Authorization 50 : BRC20_MINT 51 : BRC20_INSCRIBE 52 : BRC20_TRADE 53 : BRC20_SEND 54 : BRC20_RECEIVE 60 : BRC20_DEPLOY |
extJson | Object | Yes | Extended parameters |
>gasLimit | String | No | Gas limit |
>nonce | String | No | Nonce |
>gasPrice | String | No | Gas price |
Parameter | Type | Description |
---|---|---|
orderId | String | Unique transaction identifier |
Example for ETH
curl --location --request POST 'https://www.okx.com/api/v5/wallet/pre-transaction/send-transaction' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--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",
"accountId":"44486e05-3235-2f8e-5fe2-a8ab46217863",
"fromAddr": "0x383c8208b4711256753b70729ba0cf0cda55efad",
"toAddr": "0x4ad041bbc6fa102394773c6d8f6d634320773af4",
"txHash": "0x238193be9e80e68eace3588b45d8cf4a7eae0fa3",
"txAmount": "31600000000000000",
"chainIndex": "3",
"txType": "transfer",
"serviceCharge":"186865801413",
"tokenAddress":""
"extJson": {
"gasPrice":"",
"gasLimit":"",
"nonce": "",
}
}'
Example for BTC
curl --location --request POST 'https://www.okx.com/api/v5/wallet/transaction/send-transaction' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--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",
"accountId":"44486e05-3235-2f8e-5fe2-a8ab46217863",
"fromAddr": "",
"toAddr": "",
"txHash": "264e479f4955a1beeaac9bf9fc9b0200c42a7965bff7708109b696b35a5a53fe",
"txAmount": "31600000000000000",
"chainIndex": "0",
"txType": "BRC20_SEND",
"tokenAddress":""
"extJson": {
"gasPrice":"",
"gasLimit":"",
"nonce": "",
"callData": ""
}
}'
ETH Response Example
{
"code": "0",
"data": [
{
"orderId": "0x383c8208b4711256753b70729ba0cf0cda55efad"
}
],
"msg": ""
}