
API在社交媒体中的应用
在区块链开发和去中心化应用集成领域,快速、安全地访问 TRON 网络至关重要。TronGrid 托管 API 为开发者提供了高性能的节点访问服务和完善的区块链数据接口,能够方便地查询账户信息、交易记录以及智能合约交互。通过使用 TronGrid 托管 API,开发者可以实现应用对 TRON 主网和测试网的实时访问,同时享受官方提供的稳定性和安全保障。本文将指导你如何获取 TronGrid 托管 API 密钥,并进行基础测试,同时探讨在使用过程中需要考虑的其他关键因素。
获取TronGrid 托管 API密钥的过程相对简单,只需几个步骤即可完成:
1.访问 幂简平台中 TronGrid 开放平台服务商:
点击右侧访问官网,点击官网右上角注册或登录。
2.登录成功以后就会到仪表盘页面,可以看到 右侧有一个创建API密钥。
3.输入密钥名称
4.创建成功后可以进入检查页面,查看密钥详细信息。
5.这里能看到密钥详细信息。
在获取API密钥后,进行可用性测试是确保其正常工作的重要步骤。以下是使用curl进行测试的一个案例
以下接口为TronGrid 托管接口中 列出链上所有资产 接口。
输入:
curl --request GET \
--url https://api.shasta.trongrid.io/v1/assets \
--header 'accept: application/json'
输出:
结果以 JSON 格式返回,包含了多个数字资产的详细信息,如资产 ID、简称、名称、精度、总供应量、交易次数、拥有者地址及起止时间等;同时提供了分页信息、请求时间戳及数据指纹,全面展示了这些资产的基本属性、流通情况和访问管理细节。
{
"data": [
{
"id": 1001513,
"abbr": "MAT",
"description": "",
"name": "MyAwesomeToken",
"num": 1,
"precision": 0,
"url": "https://example.com",
"total_supply": 5000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "413a8d264521d7170e42f3f93c684625148df968b8",
"start_time": 1754637583711,
"end_time": 1754723973711
},
{
"id": 1001512,
"abbr": "GD",
"description": "",
"name": "GOOD",
"num": 100,
"precision": 2,
"url": "ceshi.com",
"total_supply": 1000000000000,
"trx_num": 1000000,
"vote_score": 0,
"owner_address": "41bd6d8d6a85ffbed34a62dc68fa027f0103ed2b3d",
"start_time": 1752854400000,
"end_time": 1752940800000
},
{
"id": 1001511,
"abbr": "NST11",
"description": "",
"name": "NST11",
"num": 1,
"precision": 0,
"url": "ceshi.com",
"total_supply": 1000000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "411c03fa040f3f6d3e7ab823125f33cdf6c55f32be",
"start_time": 1752838408403,
"end_time": 1784374398403
},
{
"id": 1001510,
"abbr": "U8GWCOM",
"description": "",
"name": "U8GWCOM",
"num": 1000,
"precision": 6,
"url": "https://u8gw.com/",
"total_supply": 1000000000000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41e743783bb04406e6f095b4900beaba557b8a01af",
"start_time": 1751889963219,
"end_time": 1751976363219
},
{
"id": 1001509,
"abbr": "PXIL",
"description": "",
"name": "PXIL",
"num": 10000,
"precision": 4,
"url": "http://pxil-incr-p2p.com",
"total_supply": 10000000000,
"trx_num": 1000000,
"vote_score": 0,
"owner_address": "41201740263f95e48007897ed24900c6de48b3505c",
"start_time": 1751756400000,
"end_time": 1751842800000
},
{
"id": 1001508,
"abbr": "U8.COM",
"description": "",
"name": "U8COM",
"num": 1,
"precision": 6,
"url": "https://u8gw.com/",
"total_supply": 1000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41616ddcaa27f6839e38f9fdbb2f7172ab824d62c6",
"start_time": 1751357201514,
"end_time": 1751443591514
},
{
"id": 1001507,
"abbr": "U8.COM",
"description": "",
"name": "U8.COM",
"num": 1,
"precision": 6,
"url": "https://u8gw.com/",
"total_supply": 1000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "410591b983f3b89d771576aa428680ce201bdf21a9",
"start_time": 1751355476596,
"end_time": 1751441866596
},
{
"id": 1001506,
"abbr": "U8COM",
"description": "",
"name": "U8COM",
"num": 1,
"precision": 6,
"url": "https://u8gw.com/",
"total_supply": 10000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41085b3d46e96be7dc4aa8e99ad0dfb47ddb7f1f16",
"start_time": 1751354696461,
"end_time": 1751441086461
},
{
"id": 1001505,
"abbr": "MiDollarAI",
"description": "",
"name": "MiDollarAI",
"num": 1,
"precision": 0,
"url": "https://MiDollar.io",
"total_supply": 1000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "414bddef775250e3af5def2cff48bb47ef2cb85d92",
"start_time": 1750734036000,
"end_time": 1750737576000
},
{
"id": 1001504,
"abbr": "MDAI",
"description": "",
"name": "MiDoAI",
"num": 1,
"precision": 6,
"url": "https://MiDoAI.io",
"total_supply": 100000000000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41e150e01ab0235a889824adc7e731f4ceb6e5d6d2",
"start_time": 1750733622000,
"end_time": 1750737162000
},
{
"id": 1001503,
"abbr": "MDAI",
"description": "",
"name": "MintDoAI",
"num": 1,
"precision": 6,
"url": "https://MintDollar.ai",
"total_supply": 100000000000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41906bf8946c1b254e63b21406faef1ef0d6db5782",
"start_time": 1750733271000,
"end_time": 1750736811000
},
{
"id": 1001502,
"abbr": "MDAI",
"description": "",
"name": "MintDollarAI",
"num": 1,
"precision": 6,
"url": "https://MintDollar.AI",
"total_supply": 100000000000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41374250da5a2dfbfde9838947edbf5bffd611e27c",
"start_time": 1750663014000,
"end_time": 1750666554000
},
{
"id": 1001501,
"abbr": "FUN",
"description": "",
"name": "24TimeFUN",
"num": 1,
"precision": 6,
"url": "https://24time.fun",
"total_supply": 100000000000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41c878c490fc34314da345a35bafa3d3987781f7a0",
"start_time": 1750423797000,
"end_time": 1750427337000
},
{
"id": 1001500,
"abbr": "FUN",
"description": "",
"name": "24Time.FUN",
"num": 1,
"precision": 6,
"url": "https://24time.fun",
"total_supply": 100000000000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "4105ca081fa08ce8ec7feb54564ed63b61e9506d76",
"start_time": 1750334700000,
"end_time": 1750338240000
},
{
"id": 1001499,
"abbr": "24TimeFUN",
"description": "",
"name": "24TimeFUN",
"num": 1,
"precision": 6,
"url": "https://24time.fun",
"total_supply": 100000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41862f16a3c80aa0e45aacf828116be29726658b5e",
"start_time": 1750298553000,
"end_time": 1750302093000
},
{
"id": 1001498,
"abbr": "trx",
"description": "",
"name": "TRX(TRX)",
"num": 100,
"precision": 6,
"url": "https://example.com",
"total_supply": 1000000000000000,
"trx_num": 100,
"vote_score": 0,
"owner_address": "41747294718582d91500b4286050a3376698bd1fa6",
"start_time": 1748539719000,
"end_time": 1751131119000
},
{
"id": 1001497,
"abbr": "TRX",
"description": "",
"name": "TRX(TRX)",
"num": 100,
"precision": 6,
"url": "https://example.com",
"total_supply": 1000000000000000,
"trx_num": 100,
"vote_score": 0,
"owner_address": "4106cda7268dcac9d64c88cdff19716826fd5cdea4",
"start_time": 1748539535000,
"end_time": 1751130935000
},
{
"id": 1001496,
"abbr": "trx",
"description": "",
"name": "TRX(TRX)",
"num": 100,
"precision": 6,
"url": "https://example.com",
"total_supply": 1000000000000000,
"trx_num": 100,
"vote_score": 0,
"owner_address": "417f23c35931c1ce30f82623558e779a410c595828",
"start_time": 1748539392000,
"end_time": 1751130792000
},
{
"id": 1001495,
"abbr": "4d5954",
"description": "",
"name": "4d7920546f6b656e",
"num": 1,
"precision": 6,
"url": "68747470733a2f2f6d79746f6b656e2e6578616d706c652e636f6d",
"total_supply": 1000000000000,
"trx_num": 1,
"vote_score": 0,
"owner_address": "41e01097fcbe2168884bfda5ced7f37b0db7ab7803",
"start_time": 1747486603613,
"end_time": 1747573003613
},
{
"id": 1001494,
"abbr": "FDT",
"description": "",
"name": "FLASH",
"num": 90000000,
"precision": 6,
"url": "ROMANCE.COM",
"total_supply": 2090009909000000,
"trx_num": 1000000000,
"vote_score": 0,
"owner_address": "41bae2af3696a4a1d62062110e21d1ad85e6626b61",
"start_time": 1746383400000,
"end_time": 1746469800000
}
],
"meta": {
"at": 1755207359667,
"fingerprint": "CoonJDu8eN2N4yvFTinUYnm6fj89o1vyFWswm1gAzghXjr7XWf5k1A4xVWhRWo7o7kKWkxL",
"links": {
"next": "https://api.shasta.trongrid.io/v1/assets?fingerprint=CoonJDu8eN2N4yvFTinUYnm6fj89o1vyFWswm1gAzghXjr7XWf5k1A4xVWhRWo7o7kKWkxL"
},
"page_size": 20
},
"success": true
}
在使用TronGrid 托管API搭建应用时,除了获取和测试API密钥外,还需考虑以下因素:
为了确保请求资源的合理分配,所有请求 API 都需要携带参数 API Key,未携带 API Key 的请求将被严重限制或根本不予响应。
目前,,调用接口时需要在请求头中使用参数 TRON-PRO-API-KEY,,并其值为 API 密钥。
HTTP 示例:
curl -X POST \
https://api.trongrid.io/wallet/createtransaction \
-H 'Content-Type: application/json' \
-H 'TRON-PRO-API-KEY: 25f66928-0b70-48cd-9ac6-da6f8247c663' \
-d '{
"to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d",
"owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292",
"amount": 1000
}'
📘注意:
目前,每个账户每天的总请求次数为100,000次(根据相关需求,总请求次数稍后会进行调整)。
为了确保请求资源的合理分配,建议所有对 Trongrid 服务的请求都包含参数 API Key。Trongrid 对所有用户设置了以下速率限制:
在申请和使用 TronGrid 托管 API密钥过程中,你可能会遇到以下常见问题:
如果我被限流了该怎么办?
如果您仍然被限流,可以尝试以下解决方法:
TronGrid 是什么,为什么要用它?
TronGrid 是由 TRON 社区提供的托管 API 层,替开发者对外暴露节点功能(查询账户、广播交易、检索区块/事件等),省去自己部署节点并提供 API Key/限流管理。
文档里时间戳和返回 meta.at 的单位是什么?
响应中常见的时间字段(如 create_time
、meta.at
)以毫秒为单位表示的 Unix 时间戳。
在获得TronGrid 托管 API密钥之后,即可开启API接口对接,本文整理了多篇使用TronGrid 托管 API的案例,帮助读者更有效地使用TronGrid 托管 API:
问题1: 什么是幂简集成平台?
幂简集成是蜜堂有信在2023年打造的一款SAAS产品,建设着国内最全的API平台,为开发者提供全面、高效、易用的API集成管理方案,一站搜索、试用、集成国内和国外API。让用户在AI时代全方位接入互联网,用API连接一切服务和算力,实现价值倍增。
问题2:如何找到TronGrid 托管 API
幂简API平台可以通过以下两种方式找到所需API:通过关键词搜索API(例如,输入’TronGrid 托管 API‘这类品类词,更容易找到结果)、或者从API hub分类页进入寻找。
问题3:TronGrid 托管 API的替代品有哪些?
市场上存在免费、付费两种替代者
例如
更多竞品可以在TronGrid 托管找到。
本文详细介绍了TronGrid托管API密钥的获取、可用性测试及使用注意事项,涵盖了从使用curl测试接口获取链上资产信息,到在应用中正确携带API密钥、遵守速率限制,以及解决常见问题的方法。同时,还提供了进阶指引和替代方案参考,帮助开发者更高效、安全地对接TronGrid托管API,实现数字资产管理和链上应用开发的便捷集成。