sendrawtransaction - Zcash

This method submits a signed raw transaction to the network. Zebrad has no wallet functionality, so applications must construct and sign transactions using an external wallet (Zallet, Ywallet, Zashi, or a library like pyzcash) before submission. Returns the transaction ID immediately if the transaction is accepted into the mempool.

Parameters

ParameterTypeRequiredDescription
hexstringstringYesHex-encoded signed serialized transaction
allowhighfeesbooleanNoIf true, bypass the high-fee sanity check. Default false

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "sendrawtransaction",
    "params": [
        "0400008085202f89..."
    ],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'sendrawtransaction',
    params: [
        "0400008085202f89..."
    ],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'sendrawtransaction',
        'params': [
        "0400008085202f89..."
    ],
        'id': 'getblock.io'
    }
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "sendrawtransaction",
            "params": [
        "0400008085202f89..."
    ],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;
    
    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "80d21f43485fb5aed2bcb011a00fb70776b2f6b4ba05722dbf2dce6f53fc410f"
}

The hex in the request above is a truncated placeholder, so sending it unchanged returns error -22. Substitute a complete, signed transaction serialized as hex. Zcash transactions from NU5 onward are version 5 and begin with 05000080; the 04000080 prefix shown is the older v4 Sapling format, which is still accepted.

Response Parameters

ParameterTypeDescription
resultstring32-byte transaction ID of the submitted transaction

Use Cases

  • Wallet Transaction Submission: Submit locally-signed transactions from Zallet, Ywallet, or Zashi to the network
  • Bridge Relayer Submission: Cross-chain bridges submit signed transactions relaying messages onto Zcash
  • Backend Automation: Custody systems using external HSM-backed signers submit signed transactions programmatically
  • Test Environment Broadcasts: Submit test-signed transactions to Testnet during application development

Error Handling

Error CodeMessageDescription
-22TX decode failedTransaction hex is malformed or the byte structure is invalid
-25TX rejectedTransaction rejected by consensus rules (invalid script, insufficient fee, etc.)
-26TX not acceptedTransaction rejected by mempool policy (e.g. non-standard, low fee, duplicate)
-27Transaction already in block chainThis transaction was already mined
-32602Invalid paramsHex string is malformed