Wallet API

Broadcast#

Broadcast transactions to the blockchain, only for use with user wallets.

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.

Request Path#

GET https://www.okx.com/api/waas/wallet/pre-transaction/send-transaction

Request Parameters#

ParameterTypeRequiredDescription

| 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 | Wallet account ID | | fromAddr | String | Yes | Sender's address | | toAddr | String | Yes | Recipient's address | | txHash | String | Yes | Transaction hash | | txAmount | String | Yes | Amount of main chain coin to transfer, balance insufficient judgment | | serviceCharge | String | Yes | Fee (smallest unit of the main network coin, e.g., ETH wei) | | tokenAddress | String | Yes | Token address | | txType | String | Yes | Transaction type (TRANSFER, CONTRACT_CALL) | | tag | String | No | Custom tag | | extJson | Object | Yes | Extended parameters | | >gasLimit | String | No | Gas limit | | >nonce | String | No | Nonce | | >gasPrice | String | No | Gas price |

Response Parameters#

ParameterTypeDescription

| orderId | String | Unique transaction identifier |

Request Example#

shell
Example for ETH

curl --location --request POST 'https://www.okx.com/api/v5/waas/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": "nonce",
        "callData": ""
    }
}'

Example for BTC

curl --location --request POST 'https://www.okx.com/api/v5/waas/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": ""
    }
}'

Response Example#

200
ETH Response Example

{
    "code": "0",
    "data": [
        {
            "orderId": "0x383c8208b4711256753b70729ba0cf0cda55efad"          
        }
    ],
    "msg": ""
}

BTC Response Example

{
    "code": "0",
    "data": [
        {
            "orderId": "0x383c8208b4711256753b70729ba0cf0cda55efad"          
        }
    ],
    "msg": ""
}