Using the Cosmos API

Cosmos SDK exposes three primary interfaces for interacting with a node. Each interface is accessible through a different port:

  • gRPC: Port 9090
  • REST: Port 1317
  • CometBFT RPC: Port 26657

Nodes also expose other endpoints, such as the CometBFT P2P endpoint, or the Prometheus endpoint, which are not directly related to the Cosmos SDK. For detailed instructions on configuring these additional CometBFT endpoints, refer to the CometBFT Configuration Manual.

gRPC (Devnet)

The Cosmos SDK uses Protobuf as its primary encoding library. This allows seamless integration with gRPC. Below is an example of querying the list of governance proposals using grpcurl:

grpcurl -plaintext cosmos.xrplevm.org:9090 cosmos.gov.v1.Query/Proposals
Response (truncated example)
{
  "proposals": [
    {
      "id": "49",
      "messages": [
        {
          "@type": "/ethermint.evm.v1.MsgUpdateParams",
          ...
        }
      ],
      "status": "PROPOSAL_STATUS_PASSED",
      ...
    }
  ],
  "pagination": {
    "total": "49"
  }
}

For more details on the Cosmos SDK gRPC server, refer to the Cosmos SDK gRPC Server documentation.
The full gRPC server specification is available at buf.build/cosmos/cosmos-sdk.


REST API (Devnet)

The Cosmos SDK also provides a REST API for interacting with the blockchain using HTTP requests. Below is an example of querying the list of governance proposals with curl:

curl -X GET "http://cosmos.xrplevm.org:1317/cosmos/gov/v1/proposals" -H "accept: application/json"
Response (truncated example)
{
  "proposals": [
    {
      "id": "49",
      "messages": [
        {
          "@type": "/ethermint.evm.v1.MsgUpdateParams",
          ...
        }
      ],
      "status": "PROPOSAL_STATUS_PASSED",
      ...
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "49"
  }
}

Learn more about the Cosmos REST server in the Cosmos SDK REST Server documentation.
Access the full REST API specification at cosmos.xrplevm.org:1317.


CometBFT RPC (Devnet)

CometBFT exposes an RPC server for consensus-related data and includes methods for interacting with the Cosmos SDK via the abci_query endpoint. Below is an example of querying governance proposals with curl:

curl -X GET 'http://cosmos.xrplevm.org:26657/abci_query?path="/cosmos.gov.v1.Query/Proposals"' -H "accept: application/json"
Response (truncated example)
{
  "jsonrpc": "2.0",
  "id": -1,
  "result": {
    "response": {
      "code": 0,
      "log": "",
      "info": "",
      "index": "0",
      "key": null,
      "value": "CqwCCAEShgEKKC9...dsZXR5am12cAESAhAx",
      "proofOps": null,
      "height": "13713161",
      "codespace": ""
    }
  }
}

Explore the Cosmos CometBFT RPC documentation for more details.
Access the CometBFT RPC interface at cosmos.xrplevm.org:26657.

With these endpoints, you can query governance proposals (and more) on both the Devnet and Testnet environments. The same commands can be adapted for other Cosmos SDK features, providing a versatile approach to interacting with the XRPL EVM’s Cosmos-based layer.