broadcast_tx_sync - Cronos

Submits a signed transaction and returns once CheckTx has run, without waiting for the transaction to be included in a block. A code of 0 means the transaction was accepted into the mempool, not that it succeeded on chain.

Parameters

ParameterTypeRequiredDescription
txstringYesBase64-encoded signed transaction bytes

Request

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

example.js

javascriptconst axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    id: 'getblock.io',
    method: 'broadcast_tx_sync',
    params: {
        "tx": "Cr0BCroBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5k..."
    }
}, { 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',
        'id': 'getblock.io',
        'method': 'broadcast_tx_sync',
        'params': {
            "tx": "Cr0BCroBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5k..."
        }
    }
)

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>/")
        .json(&json!({
            "jsonrpc": "2.0",
            "id": "getblock.io",
            "method": "broadcast_tx_sync",
            "params": {
                "tx": "Cr0BCroBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5k..."
            }
        }))
        .send().await?
        .json::<Value>().await?;
    println!("{}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "code": 0,
        "data": "",
        "log": "",
        "codespace": "",
        "hash": "A1B2C3D4E5F60718293A4B5C6D7E8F90112233445566778899AABBCCDDEEFF00"
    }
}

Response Fields

FieldTypeDescription
codeintegerCheckTx ABCI code: 0 if accepted into the mempool
datastringBase64 response data from CheckTx (usually empty)
logstringLog message; carries the reason when the transaction is rejected
codespacestringModule codespace identifying the source of a non-zero code
hashstringTransaction hash — poll tx or tx_search to confirm inclusion

Use Cases

  • Transaction Submission: Broadcast a signed transaction and get the hash back
  • Fast Rejection: Catch signature, sequence, and fee errors via a non-zero code
  • Wallet Backends: Submit, then confirm inclusion with a follow-up tx lookup

A zero code only confirms the transaction passed CheckTx and entered the mempool. Confirm on-chain execution with tx or tx_search using the returned hash.

Error Handling

ErrorMessageDescription
-32603 / Internal errorInternal errorThe tx field is not valid base64 or the transaction is malformed
403 / RBAC: access deniedAccess deniedThe GetBlock access token is missing or incorrect