BroadcastTransaction - Tron

This method submits a signed transaction to the network. It accepts the full signed Transaction message and returns whether it was accepted.

Service

This method is served by the protocol.Wallet service.

Method

protobufrpc BroadcastTransaction (Transaction) returns (Return)

Request Message

Transaction

FieldTypeDescription
raw_datarawThe transaction body, including its contracts
signaturerepeated bytesSignatures over the transaction

Request

bashgrpcurl -H 'x-api-key: <ACCESS-TOKEN>' \
  -d '{"raw_data": {"contract": []}, "signature": ["<signature-bytes>"]}' \
  shared.eu-central-1.getblock.io:443 protocol.Wallet/BroadcastTransaction

example.py

pythonimport grpc
# Stubs generated from java-tron's api.proto with grpcio-tools
from api import api_pb2_grpc
from core import Contract_pb2, Tron_pb2

creds = grpc.ssl_channel_credentials()
channel = grpc.secure_channel('shared.eu-central-1.getblock.io:443', creds)
metadata = [('x-api-key', '<ACCESS-TOKEN>')]
stub = api_pb2_grpc.WalletStub(channel)

response = stub.BroadcastTransaction(signed_transaction, metadata=metadata)
print(response)

example.go

goconn, _ := grpc.Dial(
    "shared.eu-central-1.getblock.io:443",
    grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
)
defer conn.Close()

client := api.NewWalletClient(conn)
ctx := metadata.AppendToOutgoingContext(
    context.Background(), "x-api-key", "<ACCESS-TOKEN>")

resp, _ := client.BroadcastTransaction(ctx, signedTx)
fmt.Println(resp)

Response Message

Return

FieldTypeDescription
resultbooltrue when the transaction is accepted
coderesponse_codeRejection code, when not accepted
messagebytesRejection reason, when not accepted

Use Cases

  • Payment Broadcast: Submit a signed TRX or token transfer
  • Contract Calls: Broadcast a signed contract call
  • dApp Backends: Relay transactions signed on the client
  • Retry Flows: Resubmit a signed transaction from stored data

Error Handling

CodeStatusDescription
3INVALID_ARGUMENTA request field is missing or malformed
5NOT_FOUNDThe requested account, block, or transaction does not exist
16UNAUTHENTICATEDThe access token is missing or invalid
13INTERNALThe node failed to process the request