BroadcastTx
curl --request POST \
--url https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs \
--header 'Content-Type: application/json' \
--data '
{
"tx_bytes": "aSDinaTvuI8gbWludGxpZnk=",
"mode": "BROADCAST_MODE_UNSPECIFIED"
}
'import requests
url = "https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs"
payload = {
"tx_bytes": "aSDinaTvuI8gbWludGxpZnk=",
"mode": "BROADCAST_MODE_UNSPECIFIED"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({tx_bytes: 'aSDinaTvuI8gbWludGxpZnk=', mode: 'BROADCAST_MODE_UNSPECIFIED'})
};
fetch('https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'tx_bytes' => 'aSDinaTvuI8gbWludGxpZnk=',
'mode' => 'BROADCAST_MODE_UNSPECIFIED'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs"
payload := strings.NewReader("{\n \"tx_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"mode\": \"BROADCAST_MODE_UNSPECIFIED\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs")
.header("Content-Type", "application/json")
.body("{\n \"tx_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"mode\": \"BROADCAST_MODE_UNSPECIFIED\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"tx_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"mode\": \"BROADCAST_MODE_UNSPECIFIED\"\n}"
response = http.request(request)
puts response.read_body{
"tx_response": {
"height": "<string>",
"txhash": "<string>",
"codespace": "<string>",
"code": 123,
"data": "<string>",
"raw_log": "<string>",
"logs": [
{
"msg_index": 123,
"log": "<string>",
"events": [
{
"type": "<string>",
"attributes": [
{
"key": "<string>",
"value": "<string>"
}
]
}
]
}
],
"info": "<string>",
"gas_wanted": "<string>",
"gas_used": "<string>",
"tx": {
"@type": "<string>"
},
"timestamp": "<string>",
"events": [
{
"type": "<string>",
"attributes": [
{
"key": "<string>",
"value": "<string>",
"index": true
}
]
}
]
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}tx
BroadcastTx
gRPC: cosmos.tx.v1beta1.Service/BroadcastTx (reference)
BroadcastTx broadcast transaction.
POST
/
cosmos
/
tx
/
v1beta1
/
txs
BroadcastTx
curl --request POST \
--url https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs \
--header 'Content-Type: application/json' \
--data '
{
"tx_bytes": "aSDinaTvuI8gbWludGxpZnk=",
"mode": "BROADCAST_MODE_UNSPECIFIED"
}
'import requests
url = "https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs"
payload = {
"tx_bytes": "aSDinaTvuI8gbWludGxpZnk=",
"mode": "BROADCAST_MODE_UNSPECIFIED"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({tx_bytes: 'aSDinaTvuI8gbWludGxpZnk=', mode: 'BROADCAST_MODE_UNSPECIFIED'})
};
fetch('https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'tx_bytes' => 'aSDinaTvuI8gbWludGxpZnk=',
'mode' => 'BROADCAST_MODE_UNSPECIFIED'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs"
payload := strings.NewReader("{\n \"tx_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"mode\": \"BROADCAST_MODE_UNSPECIFIED\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs")
.header("Content-Type", "application/json")
.body("{\n \"tx_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"mode\": \"BROADCAST_MODE_UNSPECIFIED\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"tx_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"mode\": \"BROADCAST_MODE_UNSPECIFIED\"\n}"
response = http.request(request)
puts response.read_body{
"tx_response": {
"height": "<string>",
"txhash": "<string>",
"codespace": "<string>",
"code": 123,
"data": "<string>",
"raw_log": "<string>",
"logs": [
{
"msg_index": 123,
"log": "<string>",
"events": [
{
"type": "<string>",
"attributes": [
{
"key": "<string>",
"value": "<string>"
}
]
}
]
}
],
"info": "<string>",
"gas_wanted": "<string>",
"gas_used": "<string>",
"tx": {
"@type": "<string>"
},
"timestamp": "<string>",
"events": [
{
"type": "<string>",
"attributes": [
{
"key": "<string>",
"value": "<string>",
"index": true
}
]
}
]
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Body
application/json
BroadcastTxRequest is the request type for the Service.BroadcastTxRequest RPC method.
BroadcastTxRequest is the request type for the Service.BroadcastTxRequest RPC method.
tx_bytes is the raw transaction.
BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method.
- BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering
- BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards.
- BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for a CheckTx execution response only.
- BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns immediately.
Available options:
BROADCAST_MODE_UNSPECIFIED, BROADCAST_MODE_BLOCK, BROADCAST_MODE_SYNC, BROADCAST_MODE_ASYNC Response
A successful response.
BroadcastTxResponse is the response type for the Service.BroadcastTx method.
tx_response is the queried TxResponses.
Show child attributes
Show child attributes
Was this page helpful?