Infura提供免费的以太坊节点RPC API服务、IPFS API服务以及整合了多个数字货币交易所数据的加密货币行情信息API服务。
Infura开发文档中文版由汇智网翻译整理,访问地址:Infura开发文档 - 汇智网。
如果希望快速掌握区块链应用的开发,推荐汇智网的《区块链应用开发系列教程》, 内容涵盖比特币、以太坊、eos、超级账本fabric和tendermint等多种区块链, 并且支持java、c#、go、nodejs、python、php、dart等多种开发语言
1、支持的网络
Infura支持如下的以太坊和IPFS网络的访问点:
| 网络 | 说明 | URL |
|---|---|---|
| Mainnet | JSON-RPC over HTTPs | https://mainnet.infura.io/v3/YOUR-PROJECT-ID |
| Mainnet | JSON-RPC over websockets | wss://mainnet.infura.io/ws/v3/YOUR-PROJECT-ID |
| Ropsten | JSON-RPC over HTTPs | https://ropsten.infura.io/v3/YOUR-PROJECT-ID |
| Ropsten | JSON-RPC over websockets | wss://ropsten.infura.io/ws/v3/YOUR-PROJECT-ID |
| Rinkeby | JSON-RPC over HTTPs | https://rinkeby.infura.io/v3/YOUR-PROJECT-ID |
| Rinkeby | JSON-RPC over websockets | wss://rinkeby.infura.io/ws/v3/YOUR-PROJECT-ID |
| Kovan | JSON-RPC over HTTPs | https://kovan.infura.io/v3/YOUR-PROJECT-ID |
| Kovan | JSON-RPC over websockets | wss://kovan.infura.io/ws/v3/YOUR-PROJECT-ID |
| Görli | JSON-RPC over HTTPs | https://goerli.infura.io/v3/YOUR-PROJECT-ID |
| Görli | JSON-RPC over websockets | wss://goerli.infura.io/ws/v3/YOUR-PROJECT-ID |
| IPFS | IPFS Gateway | https://ipfs.infura.io/ipfs/ |
| IPFS | IPFS API | https://ipfs.infura.io:5001/api/ |
注意:请务必使用你的Infura仪表盘中的项目ID/Project ID来替换上述URL中的
YOUR-PROJECT-ID。
2、以太坊RPC API - 支持HTTPS/WebSocket
- eth_accounts:查询节点账户
- eth_blockNumber:查询当前区块号
- eth_call:消息调用
- eth_chainId:查询链ID
- eth_estimateGas:估算交易gas用量
- eth_gasPrice:查询当前gas价格
- eth_getBalance:查询账户余额
- eth_getBlockByHash:查询指定哈希的区块数据
- eth_getBlockByNumber:查询指定编号的区块数据
- eth_getBlockTransactionCountByHash:获取指定哈希区块内的交易数量
- eth_getBlocktransactionCountByNumber:获取指定编号区块内的交易数量
- eth_getCode:读取指定地址的代码
- eth_getLogs:查询日志
- eth_getStorageAt:读取指定存储位置的内容
- eth_getTransactionByBlockHashAndIndex:查询指定哈希区块内指定序号的交易
- eth_getTransactionByBlockNumberAndIndex:查询指定编号区块内指定序号的交易
- eth_getTransactionByHash:查询指定哈希的交易
- eth_getTransactionCount:查询指定账号的交易数量
- eth_getTransactionReceipt:查询指定交易的收据
- eth_getUncleByBlockHashAndIndex:查询指定哈希区块的指定序号的叔伯块
- eth_getUncleByBlockNumberAndIndex:查询指定编号区块的制定序号的叔伯块
- eth_getUncleCountByBlockHash:查询指定哈希区块的叔伯数量
- eth_getUncleCountByBlockNumber:查询指定编号区块的叔伯数量
- eth_getWork:查询POW工作
- eth_hashrate:查询哈希速率
- eth_mining:查询挖矿状态
- eth_protocolVersion:查询协议版本
- eth_sendRawTransaction:发送裸交易
- eth_submitWork:提交POW计算
- eth_syncing:查询节点同步状态
- net_listening:查询节点监听状态
- net_peerCount:查询节点已连接的对端节点数量
- net_version:查询当前网络ID
- web3_clientVersion:查询节点版本
3、以太坊RPC API - 仅支持Websocket
- eth_newBlockFilter:创建新的区块过滤器
- eth_newFilter:创建新的日志过滤器
- eth_newPendingTransactionFilter:创建新的待定交易过滤器
- eth_getFilterChanges:查询过滤器变化
- eth_getFilterLogs:查询过滤器日志
- eth_uninstallFilter:卸载过滤器
- eth_subscribe:订阅事件
- eth_unsubscribe:取消事件订阅
- parity_subscribe:订阅parity命令
- parity_unsubscribe:取消parity命令订阅
3、IPFS API
- ipfs block_get
- ipfs block_stat
- ipfs cat
- ipfs dag_get
- ipfs dag_resolve
- ipfs get
- ipfs object_data
- ifps object_get
- ipfs object_stat
- ipfs pin_add
- ipfs version
- ipfs add
- ipfs block_put
- ipfs dag_put
- ipfs object_put
4、加密货币行情API
- /v1/ticker/:symbol:查询指定交易币对在最大交易量的交易所的行情数据
- /v1/ticker/:symbol/full:查询指定交易币对在所有交易所的行情数据
- /v1/ticker/symbols:查询所有支持的交易币对
- /v1/blacklist:查询黑名单
- /v2/blacklist:查询黑名单、白名单以及模糊名单
Infura开发文档地址:http://cw.hubwiz.com/card/c/infura-api/
版权声明:本文为shebao3333原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。