Skip to main content

Getting CosmosHub RPC

CosmosHub ipRPC ๐Ÿช™โ€‹

Mainnet ๐ŸŒโ€‹

Service ๐Ÿ”ŒURL ๐Ÿ”—
๐ŸŸข tendermint-rpchttps://cosmoshub.tendermintrpc.lava.build
๐ŸŸข tendermint-rpc / websocketwss://cosmoshub.tendermintrpc.lava.build/websocket
๐ŸŸข resthttps://cosmoshub.lava.build
๐ŸŸข grpccosmoshub.grpc.lava.build

Testnet ๐Ÿงชโ€‹

Service ๐Ÿ”ŒURL ๐Ÿ”—
๐ŸŸข tendermint-rpchttps://cosmoshubt.tendermintrpc.lava.build
๐ŸŸข tendermint-rpc / websocketwss://cosmoshubt.tendermintrpc.lava.build/websocket
๐ŸŸข resthttps://cosmoshubt.lava.build
๐ŸŸข grpccosmoshubt.grpc.lava.build

API Referenceโ€‹

curl -X GET -H "Content-Type: application/json" https://g.w.lavanet.xyz:443/gateway/cosmoshub/rest/3dc655f970c930f1d3e78ee71beece18/cosmos/base/tendermint/v1beta1/blocks/latest

Gatewayโ€‹

To learn more about using the Lava Gateway visit the Getting Started guide



SDKโ€‹

Input ๐Ÿ“ฅโ€‹

// Install lavaSDK with the following command:
// npm i @lavanet/lava-sdk
const { LavaSDK } = require("@lavanet/lava-sdk");

async function useCosmoshubMainnet() {
const cosmoshubMainnet = await LavaSDK.create({
privateKey: process.env.PRIVATE_KEY, //hide your private key in an environmental variable
chainIds: "COS5",
});

const cosmoshubBlockResponse = await cosmoshubMainnet.sendRelay({
method: "GET",
url: "/node_info",
rpcInterface: "rest",
});

console.log(cosmoshubBlockResponse);
}

(async () => {
await useCosmoshubMainnet();
})();