Wallet API

Broadcast#

Broadcast transactions to the blockchain, only for use with wallet accounts.

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#

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

Request Parameters#

ParameterTypeRequiredDescription
signedTxStringYesSigned transaction string
chainIndexStringYesUnique identifier for the chain, e.g., ETH=3, details can be found in the Chain Unique Identifier Compilation
accountIdStringYesUnique identifier for the account
fromAddrStringYesSender's address
toAddrStringYesRecipient's address
txHashStringYesTransaction hash
txAmountStringYesThe amount of the main chain currency to transfer, passed in the smallest unit of the mainnet currency, such as ETH wei.
serviceChargeStringYesgasPrice * gasLimit, representing the total transaction fee, passed in the smallest unit of the mainnet currency, such as ETH wei.
tokenAddressStringYesToken address
txTypeStringYesTransaction 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
tagStringNoCustom tag
extJsonObjectYesExtended parameters
>gasLimitStringNoGas limit
>nonceStringNoNonce
>gasPriceStringNoGas price

Response Parameters#

ParameterTypeDescription
orderIdStringUnique 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": ""
}