Cosmos RPC Proxy
curl --request POST \
--url https://router-api.initia.xyz/api/rpc/{chainId} \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"method": "abci_query",
"params": {
"data": "0a14...",
"path": "/cosmos.bank.v1beta1.Query/AllBalances",
"prove": false
}
}
'import requests
url = "https://router-api.initia.xyz/api/rpc/{chainId}"
payload = {
"id": 1,
"method": "abci_query",
"params": {
"data": "0a14...",
"path": "/cosmos.bank.v1beta1.Query/AllBalances",
"prove": False
}
}
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({
id: 1,
method: 'abci_query',
params: {data: '0a14...', path: '/cosmos.bank.v1beta1.Query/AllBalances', prove: false}
})
};
fetch('https://router-api.initia.xyz/api/rpc/{chainId}', 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://router-api.initia.xyz/api/rpc/{chainId}",
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([
'id' => 1,
'method' => 'abci_query',
'params' => [
'data' => '0a14...',
'path' => '/cosmos.bank.v1beta1.Query/AllBalances',
'prove' => false
]
]),
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://router-api.initia.xyz/api/rpc/{chainId}"
payload := strings.NewReader("{\n \"id\": 1,\n \"method\": \"abci_query\",\n \"params\": {\n \"data\": \"0a14...\",\n \"path\": \"/cosmos.bank.v1beta1.Query/AllBalances\",\n \"prove\": false\n }\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://router-api.initia.xyz/api/rpc/{chainId}")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"method\": \"abci_query\",\n \"params\": {\n \"data\": \"0a14...\",\n \"path\": \"/cosmos.bank.v1beta1.Query/AllBalances\",\n \"prove\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router-api.initia.xyz/api/rpc/{chainId}")
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 \"id\": 1,\n \"method\": \"abci_query\",\n \"params\": {\n \"data\": \"0a14...\",\n \"path\": \"/cosmos.bank.v1beta1.Query/AllBalances\",\n \"prove\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}RPC
Cosmos RPC Proxy
JSON-RPC 2.0 proxy to the Cosmos RPC of a supported Cosmos chain. The request and response follow the standard JSON-RPC 2.0 specification.
Only a limited set of RPC methods is supported:
status— fetch the node status.paramsmust be{}.abci_query— query application state.paramsmust includedata(string),path(string), andprove(boolean). Allowedpathvalues:/cosmos.auth.v1beta1.Query/Account/cosmos.bank.v1beta1.Query/AllBalances/cosmos.tx.v1beta1.Service/Simulate
broadcast_tx_sync— broadcast a signed transaction.paramsmust contain a singletxfield (string).tx_search— search for transactions.paramsmust includepage(string, only"1"is allowed) andquery(string, must matchtx.hash='<64-hex>').
Any other method or unsupported parameter shape returns a 400 error.
POST
/
api
/
rpc
/
{chainId}
Cosmos RPC Proxy
curl --request POST \
--url https://router-api.initia.xyz/api/rpc/{chainId} \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"method": "abci_query",
"params": {
"data": "0a14...",
"path": "/cosmos.bank.v1beta1.Query/AllBalances",
"prove": false
}
}
'import requests
url = "https://router-api.initia.xyz/api/rpc/{chainId}"
payload = {
"id": 1,
"method": "abci_query",
"params": {
"data": "0a14...",
"path": "/cosmos.bank.v1beta1.Query/AllBalances",
"prove": False
}
}
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({
id: 1,
method: 'abci_query',
params: {data: '0a14...', path: '/cosmos.bank.v1beta1.Query/AllBalances', prove: false}
})
};
fetch('https://router-api.initia.xyz/api/rpc/{chainId}', 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://router-api.initia.xyz/api/rpc/{chainId}",
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([
'id' => 1,
'method' => 'abci_query',
'params' => [
'data' => '0a14...',
'path' => '/cosmos.bank.v1beta1.Query/AllBalances',
'prove' => false
]
]),
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://router-api.initia.xyz/api/rpc/{chainId}"
payload := strings.NewReader("{\n \"id\": 1,\n \"method\": \"abci_query\",\n \"params\": {\n \"data\": \"0a14...\",\n \"path\": \"/cosmos.bank.v1beta1.Query/AllBalances\",\n \"prove\": false\n }\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://router-api.initia.xyz/api/rpc/{chainId}")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"method\": \"abci_query\",\n \"params\": {\n \"data\": \"0a14...\",\n \"path\": \"/cosmos.bank.v1beta1.Query/AllBalances\",\n \"prove\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router-api.initia.xyz/api/rpc/{chainId}")
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 \"id\": 1,\n \"method\": \"abci_query\",\n \"params\": {\n \"data\": \"0a14...\",\n \"path\": \"/cosmos.bank.v1beta1.Query/AllBalances\",\n \"prove\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}Path Parameters
Cosmos chain ID to proxy the RPC call to.
Body
application/json
Was this page helpful?