Nkn是怎么切换节点的

有个疑问,路径选择是择优选取的,有没有方法可以从客户端(nkn-tunnel)选取路径

Tuna 模式是可以选取中转节点的(比如 nkn-tuna-session, nkn-tunnel, nConnect 内可用),不过客户端选取的路径是不能参与挖矿的,所以需要客户端给中转接点付费。

只能在tuna模式下才能选取中转节点么?还有个疑问,就是能不能选取出口的位置 :thinking:

是的

可以的,tuna 模式可以通过参数过滤出口节点的 IP 地址,比如可以选择只要美国的 IP 或者不要美国的 IP。

好的,谢谢您的解答。还有一个疑问,tunnel模式下,能自己选择入口节点么?

你是指 nkn-tunnel 这个库么?这个是可以开启 tuna 模式的,所以是可以的

我指的是tunnel模式

我现在在搭建节点,但是会报一个错误。[ERROR] GID 26, apply cert failed: error: one or more domains had a problem:
[118-193-45-148.ipv4.nknlabs.io] acme: error: 400 :: urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up A for 192-168-100-45.ipv4.nknlabs.io - check that a DNS record exists for this domain; DNS problem: NXDOMAIN looking up AAAA for 192-168-100-45.ipv4.nknlabs.io - check that a DNS record exists for this domain, url:。请问这个错误有没有什么影响呢

什么的 tunnel 模式?我们并没有什么tunnel 模式呀

1 Like

这个只影响 https,你不用 https 的话没有影响。而且你这个版本是不是有些旧?这个错误最新版应该是不同的

1 Like

2.1.8的版本了,测试发现的

报错之后一直不能建立邻居

那我搞错了,我用的nkn-tunnel,以为是一种模式

消除这个报错又什么方法呢,网络上没有找到相关的资料

可以试试最新版,不过这个错误和建立邻居是没有关系的,一般来说最有可能的是你机器的 30001-30005 端口没有开放

我周末换了新版本(2.2.0)试了试,并且关闭了防火墙,还是会报这个错误

请问方便贴一下相关的错误日志嘛?

./nknd --config config.json -c --web-gui-listen-address 0.0.0.0
2023/06/05 10:13:48 Set SyncStateMaxThread to 28
2023/06/05 10:13:48 Set SyncHeaderMaxSize to 42410
2023/06/05 10:13:48 Set SyncBatchWindowSize to 52
2023/06/05 10:13:48 Set TxPoolMaxMemorySize to 3
2023/06/05 10:13:48 Set ClientMsgCacheSize to 8863744
2023/06/05 10:13:48.898506 [INFO ] GID 1, Skip automatic port forwading. You need to set up port forwarding and firewall yourself.
2023/06/05 10:13:48.898766 [INFO ] GID 1, Node version: v2.2.0
Password:
2023/06/05 10:13:53.423936 [INFO ] GID 1, set default cert domain to: x-x-x-x.ipv4.staticdns1.io
2023/06/05 10:13:53.423993 [INFO ] GID 1, use default https certs
2023/06/05 10:13:53.424014 [INFO ] GID 1, use default wss certs
2023/06/05 10:13:53.429631 [INFO ] GID 1, database Version: 1
2023/06/05 10:13:53.430463 [INFO ] GID 1, State root: a5c25c33383e434b9803c78ac0babc8cbcf1390fd2593c623283579d51f04d21
2023/06/05 10:13:53.430520 [INFO ] GID 1, Start pruning…
2023/06/05 10:13:53.430570 [INFO ] GID 1, get height of trie pruned error: leveldb: not found
2023/06/05 10:13:53.430741 [INFO ] GID 1, RefCount height: 1, length of refCounts: 10
2023/06/05 10:13:53.430853 [INFO ] GID 1, RefCount height: 2, length of refCounts: 10
2023/06/05 10:13:53.430953 [INFO ] GID 1, RefCount height: 3, length of refCounts: 10
2023/06/05 10:13:53.431077 [INFO ] GID 1, RefCount height: 4, length of refCounts: 10
2023/06/05 10:13:53.431191 [INFO ] GID 1, RefCount height: 5, length of refCounts: 10
2023/06/05 10:13:53.431308 [INFO ] GID 1, RefCount height: 6, length of refCounts: 11
2023/06/05 10:13:53.431401 [INFO ] GID 1, RefCount height: 7, length of refCounts: 11
2023/06/05 10:13:53.431509 [INFO ] GID 1, RefCount height: 8, length of refCounts: 11
2023/06/05 10:13:53.431682 [INFO ] GID 1, RefCount height: 9, length of refCounts: 11
2023/06/05 10:13:53.431788 [INFO ] GID 1, RefCount height: 10, length of refCounts: 11
2023/06/05 10:13:53.431918 [INFO ] GID 1, RefCount height: 11, length of refCounts: 11
2023/06/05 10:13:53.432041 [INFO ] GID 1, RefCount height: 12, length of refCounts: 11
2023/06/05 10:13:53.432145 [INFO ] GID 1, RefCount height: 13, length of refCounts: 11
2023/06/05 10:13:53.432429 [INFO ] GID 1, RefCount height: 14, length of refCounts: 11
2023/06/05 10:13:53.432556 [INFO ] GID 1, RefCount height: 15, length of refCounts: 11
2023/06/05 10:13:53.432664 [INFO ] GID 1, RefCount height: 16, length of refCounts: 11
2023/06/05 10:13:53.432768 [INFO ] GID 1, RefCount height: 17, length of refCounts: 11
2023/06/05 10:13:53.432889 [INFO ] GID 1, RefCount height: 18, length of refCounts: 11
2023/06/05 10:13:53.432996 [INFO ] GID 1, RefCount height: 19, length of refCounts: 11
2023/06/05 10:13:53.433131 [INFO ] GID 1, RefCount height: 20, length of refCounts: 11
2023/06/05 10:13:53.433282 [INFO ] GID 1, RefCount height: 21, length of refCounts: 11
2023/06/05 10:13:53.433387 [INFO ] GID 1, RefCount height: 22, length of refCounts: 11
2023/06/05 10:13:53.433484 [INFO ] GID 1, RefCount height: 23, length of refCounts: 11
2023/06/05 10:13:53.433590 [INFO ] GID 1, RefCount height: 24, length of refCounts: 11
2023/06/05 10:13:53.433690 [INFO ] GID 1, RefCount height: 25, length of refCounts: 11
2023/06/05 10:13:53.433805 [INFO ] GID 1, RefCount height: 26, length of refCounts: 11
2023/06/05 10:13:53.433910 [INFO ] GID 1, RefCount height: 27, length of refCounts: 11
2023/06/05 10:13:53.434013 [INFO ] GID 1, RefCount height: 28, length of refCounts: 11
2023/06/05 10:13:53.434116 [INFO ] GID 1, RefCount height: 29, length of refCounts: 11
2023/06/05 10:13:53.434145 [INFO ] GID 1, get compact height error: leveldb: not found
2023/06/05 10:13:53.434210 [INFO ] GID 1, current chord ID: 2ea9ab9198d1638007400cd2c3bef1cc745b864b76011a0e1bc52180ac6452d4
2023/06/05 10:13:53.435103 [INFO ] GID 1, Init node ID to 2ea9ab9198d1638007400cd2c3bef1cc745b864b76011a0e1bc52180ac6452d4
2023/06/05 10:13:53.435829 [INFO ] GID 37, DropTxns: 0 txns (0 bytes) in txpool, no need to drop
2023/06/05 10:13:53.436197 [INFO ] GID 81, Set min verifiable height to 34
2023/06/05 10:13:54.115990 [INFO ] GID 22, read resourceFile err: open certs/x-x-x-x.ipv4.staticdns1.io.resource.json: no such file or directory
2023/06/05 10:13:54 [INFO] [x-x-x-x.ipv4.staticdns1.io] acme: Obtaining bundled SAN certificate
2023/06/05 10:13:54 [INFO] [x-x-x-x.ipv4.staticdns1.io] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/234021736757
2023/06/05 10:13:54 [INFO] [x-x-x-x.ipv4.staticdns1.io] acme: Could not find solver for: tls-alpn-01
2023/06/05 10:13:54 [INFO] [x-x-x-x.ipv4.staticdns1.io] acme: use http-01 solver
2023/06/05 10:13:54 [INFO] [x-x-x-x.ipv4.staticdns1.io] acme: Trying to solve HTTP-01
2023/06/05 10:14:03.436317 [WARN ] GID 78, Handle proposal error: wait for proposal timeout
2023/06/05 10:14:05 [INFO] Deactivating auth: https://acme-v02.api.letsencrypt.org/acme/authz-v3/234021736757
2023/06/05 10:14:05.740287 [ERROR] GID 22, apply cert failed: error: one or more domains had a problem:
[118-192-45-148.ipv4.staticdns1.io] acme: error: 400 :: urn:ietf:params:acme:error:connection :: x.x.x.x: Fetching http://x-x-x-x.ipv4.staticdns1.io/.well-known/acme-challenge/C9qJEZbR1xyk7T4QhxTjV9CATXPdwQlQigL5BoAhjNc: Timeout during connect (likely firewall problem), url:

2023/06/05 10:14:06.421748 [INFO ] GID 22, read resourceFile err: open certs/x-x-x-x.ipv4.staticdns1.io.resource.json: no such file or directory
2023/06/05 10:14:13.436223 [INFO ] GID 37, DropTxns: 0 txns (0 bytes) in txpool, no need to drop
2023/06/05 10:14:13.529027 [WARN ] GID 78, Handle proposal error: wait for neighbor vote timeout
2023/06/05 10:14:23.621470 [WARN ] GID 78, Handle proposal error: wait for neighbor vote timeout
^C
Received an interrupt, stopping services…
2023/06/05 10:14:27.500069 [INFO ] GID 1, Chord overlay stops
2023/06/05 10:14:27.500145 [INFO ] GID 1, Local node 2ea9ab9198d1638007400cd2c3bef1cc745b864b76011a0e1bc52180ac6452d4@tcp://x.x.x.x:30001 stops
2023/06/05 10:14:27.601081 [INFO ] GID 1, Routing stops
2023/06/05 10:14:27.601139 [INFO ] GID 1, Routing stops
2023/06/05 10:14:27.601178 [INFO ] GID 1, Routing stops
2023/06/05 10:14:27.601205 [INFO ] GID 1, Routing stops

netstat -lnutp | grep nkn
tcp6 0 0 :::30000 :::* LISTEN 6522/./nknd
tcp6 0 0 :::30001 :::* LISTEN 6522/./nknd
tcp6 0 0 :::30002 :::* LISTEN 6522/./nknd
tcp6 0 0 :::30003 :::* LISTEN 6522/./nknd

可以看到这一行 letsencrypt 的输出,说明他们尝试连接到你这里验证失败,大概率还是防火墙问题。这个不一定是你本机的防火墙,更有可能是路由器、网络运营商或者 VPS 的防火墙。不过这个错误不一定说明你的节点无法正常运行。申请证书需要的端口是 80 或者 443,而 NKN 节点正常运行需要的端口是 30001-30005,有的运营商对 80、443 这些端口有更严格的限制。如果你的 NKN 节点启动以后有入向的邻居,那就说明你的 30001-30005 端口是开放的,节点除了没有证书以外其他都是可以正常运行的。否则的话就说明你的 30001-30005 端口也没开放。