api/v2/sendtx - Zcash

This endpoint broadcasts a signed, serialized transaction to the Zcash network through the Zebra node and returns its transaction id on acceptance. Transparent and shielded transactions are both accepted.

Parameters

ParameterTypeLocationRequiredDescription
hexstringbodyYesHex-encoded signed raw transaction, sent as the plain-text request body

Request

The trailing slash on /api/v2/sendtx/ is mandatory. Request bodies are limited to 8 MiB.

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/sendtx/' \
--header 'Content-Type: text/plain' \
--data-raw '050000800a27a726...'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/sendtx/',
    { method: 'POST', headers: { 'Content-Type': 'text/plain' }, body: '050000800a27a726...' }
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/sendtx/',
    headers={'Content-Type': 'text/plain'},
    data='050000800a27a726...'
)

print(response.json())

Response

json{
    "result": "076a0119b89f661efa34e815079726b36b4cfbd0375f66af72f505c88bafde37"
}

Response Parameters

FieldTypeDescription
resultstringTransaction id of the accepted transaction

Acceptance means the node admitted the transaction to its mempool, not that it has been mined. A Zcash transaction also carries an expiryheight, after which it can no longer be mined; if it has not confirmed by then, it must be rebuilt rather than rebroadcast.

The fee must meet the ZIP-317 conventional fee of 5,000 zatoshis per logical action, with a minimum of two actions. Blockbook's estimatefee endpoint is not available on Zcash, so compute the fee from that rule. The transaction must also be signed for the consensus branch ID in force, reported under backend.consensus by api/status.

Use Cases

  • Wallet Sends: Broadcast a transaction built and signed on the client
  • Payment Settlement: Push a payout to the network
  • Shielding: Broadcast a transaction moving transparent funds into a shielded pool

Error Handling

HTTP StatusMessageDescription
400Bad requestThe hex is malformed or not a complete signed transaction
400Transaction rejectedThe fee is below the ZIP-317 minimum, the expiry height has passed, or the branch ID is wrong
403ForbiddenMissing or invalid ACCESS-TOKEN
500Internal errorThe node failed to process the broadcast