跳转至主要内容

Cosmos QuickStart

更新于
Aug 07, 2026

The quickest way to start building on Cosmos with Quicknode is by sending a JSON-RPC or REST/gRPC request to your endpoint. In this quickstart, you’ll create an endpoint, copy its provider URL, and make your first request. Code samples are available in cURL as well as popular SDKs and programming languages.

Get Your Cosmos Endpoint

1

创建一个Quicknode

如果您尚未注册,请在此注册。

2

前往您的仪表盘

从左侧边栏菜单中打开“端点”仪表板,以管理您所有的区块链端点

3

创建一个新的endpoint

Click Create an Endpoint in the top-right corner, select Cosmos as your blockchain, then select your preferred network

4

复制您的服务提供商网址

请将该 HTTP URL 备好。您将在下文的请求中用到它。

了解有关仪表板的更多信息

如需了解Quicknode 详细操作指南,请参阅我们的 指南

发送您的第一个请求

Your endpoint is ready. Now, let's make your first call to the Cosmos blockchain. We’ll use the block_by_hash method, which returns details of a specificed block when given a hash parameter. 请选择您偏好的语言或工具,并按照步骤提交请求.


1

检查 cURL 的安装情况

大多数基于 *nix 的系统默认都支持 cURL。打开终端,运行以下命令即可查看 cURL 的版本:

curl --version
2

Query block by hash

Retrieve block information by hash from your Quicknode endpoint:

curl --location '<YOUR_QUICKNODE_ENDPOINT_URL>/block_by_hash?hash=0x645507DC48B4EF4BFF51826A0A5B73FD8CF926036AA4F6697D748FFC0B56D134'
3

Sample response

{
"jsonrpc": "2.0",
"id": -1,
"result": {
"block_id": { ... }
},
"block": {
"header": {
"version": {
"block": "11"
},
"chain_id": "cosmoshub-4",
"height": "20431644",
"time": "2024-05-15T01:23:57.786705041Z",
"last_block_id": { ... },
},
"data": {
"txs": [ ... ]
},
"evidence": {
"evidence": []
},
"last_commit": { ... }
}
}
}

如果您想进一步了解如何发送 API 请求,请查看我们的指南示例应用