首页 > 解决方案 > Substrate 节点教程 - 无法使用浏览器访问本地网络上机器上的节点

问题描述

运行 Ubuntu 20.04.2 并遵循https://substrate.dev/docs/en/tutorials/create-your-first-substrate-chain/上的教程

Introduction · Substrate Developer Hub 在本教程中,您将学习如何编译和启动 Substrate Developer Hub 节点模板

2021-08-08 18:31:06  Pre-sealed block for proposal at 414. Hash now 0xb97ef6e3533f47dfa1e2c0453bd9115cc753b51bf45218181945083a1122b851, previously 0xb661bc316808789cd1dd9e5cb65cf1ac18e2d27c05ec0c679abd5c4dad6eabe4.    
2021-08-08 18:31:06 ✨ Imported #414 (0xb97e…b851)    
2021-08-08 18:31:07  Idle (0 peers), best: #414 (0xb97e…b851), finalized #412 (0xfd49…e08f), ⬇ 0 ⬆ 0    
2021-08-08 18:31:12  Starting consensus session on top of parent 0xb97ef6e3533f47dfa1e2c0453bd9115cc753b51bf45218181945083a1122b851    
2021-08-08 18:31:12  Prepared block for proposing at 415 [hash: 0x43c0cbed55fe998c9dff16ff086d6576def8a24b57b32973dc54ec3ecec57be0; parent_hash: 0xb97e…b851; extrinsics (1): [0xa4c9…413f]]    
2021-08-08 18:31:12  Pre-sealed block for proposal at 415. Hash now 0xc3feebabe2896be78240ce46ef110f9df0c441694538300d111ed1a78c9e065b, previously 0x43c0cbed55fe998c9dff16ff086d6576def8a24b57b32973dc54ec3ecec57be0.    
2021-08-08 18:31:12 ✨ Imported #415 (0xc3fe…065b)    
2021-08-08 18:31:12  Idle (0 peers), best: #415 (0xc3fe…065b), finalized #412 (0xfd49…e08f), ⬇ 0 ⬆ 0    
2021-08-08 18:31:17  Idle (0 peers), best: #415 (0xc3fe…065b), finalized #413 (0x5a41…f7af), ⬇ 0 ⬆ 0    
2021-08-08 18:31:18  Starting consensus session on top of parent 0xc3feebabe2896be78240ce46ef110f9df0c441694538300d111ed1a78c9e065b    
2021-08-08 18:31:18  Prepared block for proposing at 416 [hash: 0x9c7862deacdb09f5fa4123c9f0abdbf5a5baa7c5092623c39aaf72d52ff283d7; parent_hash: 0xc3fe…065b; extrinsics (1): [0xefd1…e72a]]    
2021-08-08 18:31:18  Pre-sealed block for proposal at 416. Hash now 0x564871f647c1d291d2a7d2f935b46bda3635d29b6b141627171759a3b643be6d, previously 0x9c7862deacdb09f5fa4123c9f0abdbf5a5baa7c5092623c39aaf72d52ff283d7.    
2021-08-08 18:31:18 ✨ Imported #416 (0x5648…be6d)

我运行了节点,./target/release/node-template --dev --tmp --ws-external --rpc-external 然后按照说明运行了前端。当我尝试从本地网络上的机器连接时,我得到了 "Error Connecting to Substrate { "isTrusted": true }"

我试过 Safari、Firefox 和 Chrome

我该如何解决?

更新:我可以让它在本地运行前端并将substrate-front-end-template/blob/master/src/config/development.json中的PROVIDER_SOCKET设置为远程主机。

它仍然无法与远程机器上的节点和前端一起使用。

标签: substrate

解决方案


添加

--unsafe-ws-external --rpc-cors all

到你的参数


推荐阅读