简体   繁体   English

无法让 RPC URL 连接 MetaMask,在基板中的单台机器上运行多个节点时

[英]Unable to get the RPC URL to connect MetaMask, When running multiple nodes on single machine in substrate

When running the multiple nodes on the substrate, unable to get the correct RPC URL to connect to MetaMask Wallet在基板上运行多个节点时,无法获取正确的 RPC URL 以连接到 MetaMask 钱包

ChainId: 421 at runtime ChainId:运行时为 421

Output: Output:

Node 1:节点 1:

2022-07-27 14:32:35 〽️ Prometheus exporter started at 127.0.0.1:9615
2022-07-27 14:32:35 Running JSON-RPC HTTP server: addr=127.0.0.1:9933, allowed origins=Some(["http://localhost:", "http://127.0.0.1:", "https://localhost:", "https://127.0.0.1:", "https://polkadot.js.org"])
2022-07-27 14:32:35 Running JSON-RPC WS server: addr=127.0.0.1:9945, allowed origins=Some(["http://localhost:", "http://127.0.0.1:", "https://localhost:", "https://127.0.0.1:", "https://polkadot.js.org"])

Node 2:节点 2:

2022-07-27 14:32:56 Running JSON-RPC HTTP server: addr=127.0.0.1:9934, allowed origins=Some(["http://localhost:", "http://127.0.0.1:", "https://localhost:", "https://127.0.0.1:", "https://polkadot.js.org"])
2022-07-27 14:32:56 Running JSON-RPC WS server: addr=127.0.0.1:9946, allowed origins=Some(["http://localhost:", "http://127.0.0.1:", "https://localhost:", "https://127.0.0.1:", "https://polkadot.js.org"])
2022-07-27 14:32:56 creating instance on iface 192.168.22.183

Steps to produce Node 1 (Command) at terminal 1:在终端 1生成节点 1(命令)的步骤:

./target/release/frontier-template-node
--base-path /tmp/alice
--chain local
--alice
--port 30333
--ws-port 9945
--rpc-port 9933
--node-key 0000000000000000000000000000000000000000000000000000000000000001
--telemetry-url 'wss://telemetry.polkadot.io/submit/ 0'
--validator

Node 2 (Command) at terminal 2:终端 2 上的节点 2(命令):

./target/release/frontier-template-node
--base-path /tmp/alice
--chain local
--alice
--port 30333
--ws-port 9945
--rpc-port 9933
--node-key 0000000000000000000000000000000000000000000000000000000000000001
--telemetry-url 'wss://telemetry.polkadot.io/submit/ 0'
--validator

From the info provided it is hard to know what "unable to get the correct RPC URL to connect to MetaMask Wallet" means.从提供的信息中很难知道“无法获得正确的 RPC URL 以连接到 MetaMask 钱包”是什么意思。

But given the command you provided, you cannot use same port to run multiple nodes in single machine and neither you should use same base path to run multiple nodes.但是根据您提供的命令,您不能使用相同的端口在单台机器上运行多个节点,也不应该使用相同的基本路径来运行多个节点。 This will make both nodes to write to the database and it have no idea that other process is also writing the same file.这将使两个节点都写入数据库,并且它不知道其他进程也在写入同一个文件。 Instead here is the command you should try:相反,这是您应该尝试的命令:

run first node运行第一个节点

./target/release/frontier-template-node
    --base-path /tmp/mynode/alice
    --chain local
    --alice
    --port 3033
    --ws-port 9945
    --rpc-port 9933
    --node-key 0000000000000000000000000000000000000000000000000000000000000001
    --telemetry-url 'wss://telemetry.polkadot.io/submit/ 0'
    --validator

run second node运行第二个节点

./target/release/frontier-template-node
    --base-path /tmp/mynode/bob
    --chain local
    --bob
    --port 3034
    --ws-port 9944
    --rpc-port 9934
    --node-key 0000000000000000000000000000000000000000000000000000000000000001
    --telemetry-url 'wss://telemetry.polkadot.io/submit/ 0'
    --validator

Notice the change in port values and base path while running two nodes.注意运行两个节点时端口值和基本路径的变化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM