RPCHub – 推荐一个非常好用的RPC 工具

  • A+
所属分类:区块链

chatGPT账号

作为一名 Web3 开发者,你是否遇到这样的问题:MetaMask 配置节点 RPC URL 又连接不上了,需要去Chainlist 或 Rpclist 重新找一个节点配置到MetaMask, 也许过段时间有需要重新做一遍。

如果你有这个困扰,RPCHub 推荐给你,RPCHub 由 BlockPI 团队开发, 我也是从 Web3极客公开课 听到这款产品。

RPCHub 是一款 RPC 聚合器, 是一个在本地运行的软件,MetaMask 配置节点连接到 RPCHub, 然后 RPCHub 将RPC请求分发到多个RPC端点。RPCHub可以同时配置多个端点(可以私有的、公共的节点服务器),另外支持我们自己来配置负载平衡的策略,以确保快速响应时间。

RPCHub 安装

RPCHub 是一款开源命令行工具,在GitHub https://github.com/BlockPILabs/aggregator 下载最新的Releases 版本:

RPCHub - 推荐一个非常好用的RPC 工具

当前最新的版本是1.0.1 ,我们选择自己的系统进行下载。下载之后解压缩,会包含一个 aggregator 可执行文件,直接运行:

./aggregator 
v1.0.1
EROR[06-03|03:40:11] Load default config failed               module=config statusCode=0 error=timeout retries=1
INFO[06-03|03:40:15] Load default config success              module=config
INFO[06-03|03:40:16] New load balancer                        module=load-balance chain=ethereum-sepolia nodes=1
INFO[06-03|03:40:16] New load balancer                        module=load-balance chain=gnosis nodes=1
INFO[06-03|03:40:16] New load balancer                        module=load-balance chain=oasys nodes=2
INFO[06-03|03:40:16] New load balancer                        module=load-balance chain=scroll-testnet nodes=2
...
INFO[06-03|03:40:23] Updated authority phishing db            module=plugins addresses=2986
INFO[06-03|03:40:23] Starting proxy server                    module=server addr=:8011
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/aptos
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/arbitrum
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/avalanche
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/bsc
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/ethereum
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/ethereum-goerli
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/ethereum-sepolia
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/fantom
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/gnosis
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/optimism
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/polygon
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/polygon-mumbai
INFO[06-03|03:40:23] Registered RPC                           module=server endpoint=http://localhost:8011/scroll-testnet

aggregator 启动后,会打印差距所有可用的链的RPC (例如:http://localhost:8011/bsc), 介绍就可以把这个端点配置到MetaMask中, 如图:

RPCHub - 推荐一个非常好用的RPC 工具

PRCHub 配置

PRCHub 提供了前端Console页面(https://ag-cfg.rpchub.io/)来方便用户配置区块链的RPC 端口。

打开https://ag-cfg.rpchub.io/, 输入 http://127.0.0.1:8012 和密码123456 :

RPCHub - 推荐一个非常好用的RPC 工具

之后就进入了控制台。

其实 RPCHub 的配置是存储在本地的, Console 前端的配置页面会通过访问 RPCHub 启动的 server (http://127.0.0.1:8012)来读取本地配置以及写入新配置。

添加 RPC

RPCHub - 推荐一个非常好用的RPC 工具

我这里给BSC添加了一个新的 RPC URL:

RPCHub - 推荐一个非常好用的RPC 工具

随后我们可以在aggregator 控制台看到有对新添加节点 ninicoin 的请求。

DBUG[06-03|04:54:07] relay rpc -> eth_call                    module=plugins sid=s-0000000000000158 node=bsc-blockpi-public isTx=true tries=2
DBUG[06-03|04:54:21] relay rpc -> eth_blockNumber             module=plugins sid=s-0000000000000159 node=bsc-blockpi-public isTx=false tries=1
DBUG[06-03|04:54:21] relay rpc -> eth_getBlockByNumber        module=plugins sid=s-0000000000000160 node=bsc-blockpi-public isTx=false tries=1
DBUG[06-03|04:54:21] relay rpc -> eth_call                    module=plugins sid=s-0000000000000161 node=ninicoin isTx=true tries=1
DBUG[06-03|04:54:41] relay rpc -> eth_blockNumber             module=plugins sid=s-0000000000000162 node=omniatech isTx=false tries=1
DBUG[06-03|04:54:43] relay rpc -> eth_getBlockByNumber        module=plugins sid=s-0000000000000163 node=ninicoin isTx=false tries=1
DBUG[06-03|04:54:46] relay rpc -> eth_getBlockByNumber        module=plugins sid=s-0000000000000163 node=omniatech isTx=false tries=2
DBUG[06-03|04:54:47] relay rpc -> eth_call                    module=plugins sid=s-0000000000000164 node=bsc-official isTx=true tries=1

我们还可以根据需要设置代理, 设置钓鱼地址数据库等。

RPCHub - 推荐一个非常好用的RPC 工具

开发者们如果对 RPCHub 有什么想法,还可以向 @BlockPI 。

希望 RPCHub 可以帮助到各位 web3 开发者。

免责声明

免责声明:

本文不代表知点网立场,且不构成投资建议,请谨慎对待。用户由此造成的损失由用户自行承担,与知点网没有任何关系;

知点网不对网站所发布内容的准确性,真实性等任何方面做任何形式的承诺和保障;

网站内所有涉及到的区块链(衍生)项目,知点网对项目的真实性,准确性等任何方面均不做任何形式的承诺和保障;

网站内所有涉及到的区块链(衍生)项目,知点网不对其构成任何投资建议,用户由此造成的损失由用户自行承担,与知点网没有任何关系;

知点区块链研究院声明:知点区块链研究院内容由知点网发布,部分来源于互联网和行业分析师投稿收录,内容为知点区块链研究院加盟专职分析师独立观点,不代表知点网立场。

本文是全系列中第79 / 223篇:行业技术

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的电报
  • 这是我的电报扫一扫
  • weinxin
chatGPT账号
知点

发表评论

您必须登录才能发表评论!