Wallet API
BTC batch broadcast transaction

BTC batch broadcast transaction#

Broadcasting transaction in batches is used for inscribing. if the inscription relies on the order of the broadcast, submit the transactions in the required order.

Request URL#

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

Request parameters#

ParameterTypeRequiredDescription
txListArrayYesTransaction list
>signedTxStringYesThe transaction string that has been signed
>chainIdStringYesUnique identifier of the chain
>walletIdStringYesUnique identifier of the wallet
>addrFromStringYesTransaction from address
>addrToStringYesTransaction to address
>txHashStringYesTransaction hash
>txAmountStringYesTransfer amount
>serviceChargeStringYesService charge (minimum unit of main coin)
>tokenAddressStringYesToken address
>txTypeStringYesTransaction type
>extJsonJson ObjectYesExtended parameters
>>dependTxArrayYesReveal transaction-dependent transactions, and do not transmit submitted transactions
>>itemIdStringYesItem Id
>>feeRateStringYesFee rate
>>broadcastTypeIntYesBroadcast type, fixed 1

Response parameters#

ParameterTypeDescription
itemIdStringItem Id
txHashStringTransaction hash

Request example#

shell
curl --location --request POST 'https://www.okx.com/api/v5/waas/transaction/send-transaction-batch' \
--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 'Content-Type: application/json' \
--data '{
  txList: [
    {
      //commitTx
      "signedTx": "020000000001011dbc8a5de45010046b7df1341ebf66665edb7a2a49398be6777b57335da1dfa50100000000fdffffff02661b0000000000002251202e5cc70522e7f2403c0758f31c78b76b4bf5322a5a2ad2f12cfd1a94e258f50e761d01000000000022512084c74a9f1f1453548b52d866ea64029298adf21679d4e09d2c053b8886995e7401402a7356eb38a6eb35656752562db83601272e3cba37be6ae935c032a218b64050f3947b89ab9334b0221d78702cb70c01843ae7046fe9c1d7261554386fd2fc0400000000",
      "walletId": "13886e05-1265-4b79-8ac3-b7ab46211004",
      "addrFrom": "bc1psnr548clz3f4fz6jmpnw5eqzj2v2musk082wp8fvq5ac3p5ete6qg05u8u",
      "addrTo": "bc1p9ewvwpfzuleyq0q8tre3c79hdd9l2v32tg4d9ufvl5dffcjc758qplhdzs",
      "txHash": "cd09509cc602ea797c5d3218f36b401a6f21202470ea6e2ef98db71d48980e1f", //sdk wallet.calcTxHash
      "txAmount": 0,
      "chainId": 0,
      "txType": "BRC20_DEPLOY",
      "serviceCharge": 6468,
      "tokenAddress": "",
      "extJson": {
        "broadcastType": 1,
        "dependTx": [],
        "feeRate": "27",
        "itemId": "commitTx"
      }
    },
    {
      //revealTxs
      "signedTx": "020000000001011f0e98481db78df92e6eea702420216f1a406bf318325d7c79ea02c69c5009cd0000000000fdffffff01220200000000000022512084c74a9f1f1453548b52d866ea64029298adf21679d4e09d2c053b8886995e740340fc4cf17439dd9fb0b9b352eaee98ba63c01e7b2aaaafafcac65444d1435a1890cd3835c4fa9b5bd9aae6d8a89073bb9d4d5931cc4ff18540afd35abddc41aa1a8620da459477b18d59be71a3ab0c0565abf3ca79b3e34f4ea66accdfa749c900f163ac0063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800407b2270223a226272632d3230222c226f70223a226465706c6f79222c227469636b223a22746f6b62222c226d6178223a22313030222c226c696d223a2235227d6821c0da459477b18d59be71a3ab0c0565abf3ca79b3e34f4ea66accdfa749c900f16300000000",
      "walletId": "13886e05-1265-4b79-8ac3-b7ab46211004",
      "addrFrom": "bc1p9ewvwpfzuleyq0q8tre3c79hdd9l2v32tg4d9ufvl5dffcjc758qplhdzs",
      "addrTo": "bc1psnr548clz3f4fz6jmpnw5eqzj2v2musk082wp8fvq5ac3p5ete6qg05u8u",
      "txHash": "64c89978eb7c1b9a197e2d86b49c2d025dc09f70b17bbb76894767e463a7cbec",
      "txAmount": 0,
      "chainId": 0,
      "txType": "BRC20_DEPLOY",
      "serviceCharge": 6468,
      "tokenAddress": "",
      "extJson": {
        "broadcastType": 1,
        // revealTx depends on the  commitTx
        "dependTx": [
          "cd09509cc602ea797c5d3218f36b401a6f21202470ea6e2ef98db71d48980e1f"
        ],
        "feeRate": "27",
        "itemId": "revealTx0"
      }
    }
  ]
}'

Response example#

200
{
  "code": 0,
  "msg": "success",
  "data": [{
    "txHashList":[
      {
        "itemId": "commitTx",
        "txHash": "cd09509cc602ea797c5d3218f36b401a6f21202470ea6e2ef98db71d48980e1f"
      },
      {
        "itemId": "reveal0",
        "txHash": "64c89978eb7c1b9a197e2d86b49c2d025dc09f70b17bbb76894767e463a7cbec"
      }
    ]
  }]
}