Make your own NKM (New Kind of Miner) out of a Raspberry pi

on the second raspberry i have a different error

`sudo make

make build_local || make build_local_with_proxy
make[1]: Entering directory ‘/home/pi/go/src/github.com/nknorg/nkn’
make build BUILD_DIR=. BIN_DIR=.
make[2]: Entering directory ‘/home/pi/go/src/github.com/nknorg/nkn’
GOPROXY= GOOS= GOARCH= GOARM= GO111MODULE=on go build -ldflags “-s -w -X github.com/nknorg/nkn/v2/config.Version=v2.0.8” -o ././nknd ./cmd/nknd/
/bin/sh: 1: go: not found
make[2]: *** [Makefile:28: build] Error 127
make[2]: Leaving directory ‘/home/pi/go/src/github.com/nknorg/nkn’
make[1]: *** [Makefile:70: build_local] Error 2
make[1]: Leaving directory ‘/home/pi/go/src/github.com/nknorg/nkn’
make[1]: Entering directory ‘/home/pi/go/src/github.com/nknorg/nkn’
make build_local GOPROXY=https://goproxy.io
make[2]: Entering directory ‘/home/pi/go/src/github.com/nknorg/nkn’
make build BUILD_DIR=. BIN_DIR=.
make[3]: Entering directory ‘/home/pi/go/src/github.com/nknorg/nkn’
GOPROXY=https://goproxy.io GOOS= GOARCH= GOARM= GO111MODULE=on go build -ldflags “-s -w -X github.com/nknorg/nkn/v2/config.Version=v2.0.8” -o ././nknd ./cmd/nknd/
/bin/sh: 1: go: not found
make[3]: *** [Makefile:28: build] Error 127
make[3]: Leaving directory ‘/home/pi/go/src/github.com/nknorg/nkn’
make[2]: *** [Makefile:70: build_local] Error 2
make[2]: Leaving directory ‘/home/pi/go/src/github.com/nknorg/nkn’
make[1]: *** [Makefile:74: build_local_with_proxy] Error 2
make[1]: Leaving directory ‘/home/pi/go/src/github.com/nknorg/nkn’
make: *** [Makefile:78: build_local_or_with_proxy] Error 2`

Hi there,

I’m running into a problem similar to @nebeleben, I think. I’m stuck at the creation of the ID.

2021/04/15 12:24:13 Set SyncHeaderMaxSize to 5394
2021/04/15 12:24:13 Set SyncBatchWindowSize to 26
2021/04/15 12:24:13 Set TxPoolMaxMemorySize to 1
2021/04/15 12:24:13.977156 [INFO ] GID 1, Discovering NAT gateway...
2021/04/15 12:24:18.370084 [INFO ] GID 1, Mapped external port 30001 to internal port 30001
2021/04/15 12:24:18.499124 [INFO ] GID 1, Mapped external port 30002 to internal port 30002
2021/04/15 12:24:18.647823 [INFO ] GID 1, Mapped external port 30004 to internal port 30004
2021/04/15 12:24:18.761895 [INFO ] GID 1, Mapped external port 30003 to internal port 30003
2021/04/15 12:24:18.928069 [INFO ] GID 1, Mapped external port 30005 to internal port 30005
2021/04/15 12:24:18.971638 [INFO ] GID 1, Node version: v2.0.8
2021/04/15 12:24:21.368069 [INFO ] GID 1, Getting my IP address...
2021/04/15 12:24:21.927973 [INFO ] GID 1, GetMyExtIP got resp: {"id":"1","jsonrpc":"2.0","result":{"RemoteAddr":"xx.xx.xx.xx"}} from http://mainnet-seed-0009.nkn.org:30003
2021/04/15 12:24:21.940313 [INFO ] GID 1, From http://mainnet-seed-0009.nkn.org:30003 got myself ExtIP: {"id":"1","jsonrpc":"2.0","result":{"RemoteAddr":"xx.xx.xx.xx"}}
2021/04/15 12:24:21.948851 [INFO ] GID 1, My IP address is xx.xx.xx.xx
2021/04/15 12:24:21.965735 [INFO ] GID 1, set default cert domain to: xx-xx-xx-xx.ipv4.nknlabs.io
2021/04/15 12:24:21.974248 [INFO ] GID 1, use default https certs
2021/04/15 12:24:21.979543 [INFO ] GID 1, use default wss certs
2021/04/15 12:24:22.318272 [INFO ] GID 1, database Version: 1
2021/04/15 12:24:22.324771 [INFO ] GID 1, State root: xxxxxxxxxxxxxxxxxxx
2021/04/15 12:24:22.327716 [INFO ] GID 1, Start pruning...
2021/04/15 12:24:22.332777 [INFO ] GID 1, get height of trie pruned error: leveldb: not found
2021/04/15 12:24:22.335340 [INFO ] GID 1, get compact height error: leveldb: not found
2021/04/15 12:24:22.338604 [INFO ] GID 1, get no ID from local ledger
2021/04/15 12:24:22.694123 [INFO ] GID 1, GetID got resp: {"error":{"code":-45022,"data":null,"message":"INTERNAL ERROR, there is no ID in account"},"id":"1","jsonrpc":"2.0"} from http://mainnet-seed-0001.nkn.org:30003
2021/04/15 12:24:22.749861 [INFO ] GID 88, read resourceFile err: open certs/xx-xx-xx-xx.ipv4.nknlabs.io.resource.json: no such file or directory
2021/04/15 12:24:22 [INFO] [xx-xx-xx-xx.ipv4.nknlabs.io] acme: Obtaining bundled SAN certificate
2021/04/15 12:24:23.088935 [INFO ] GID 1, GetID got resp: {"error":{"code":-45022,"data":null,"message":"INTERNAL ERROR, there is no ID in account"},"id":"1","jsonrpc":"2.0"} from http://mainnet-seed-0016.nkn.org:30003
2021/04/15 12:24:23.304369 [ERROR] GID 88, apply cert failed: acme: error: 429 :: POST :: https://acme-v02.api.letsencrypt.org/acme/new-order :: urn:ietf:params:acme:error:rateLimited :: Error creating new order :: too many certificates already issued for: nknlabs.io: see https://letsencrypt.org/docs/rate-limits/, url: 
2021/04/15 12:24:23.550995 [INFO ] GID 1, GetID got resp: {"error":{"code":-45022,"data":null,"message":"INTERNAL ERROR, there is no ID in account"},"id":"1","jsonrpc":"2.0"} from http://mainnet-seed-0042.nkn.org:30003
2021/04/15 12:24:23.695072 [INFO ] GID 1, GetNonceByAddr got resp: {"id":"1","jsonrpc":"2.0","result":{"currentHeight":2530094,"nonce":0,"nonceInTxPool":0}} from http://mainnet-seed-0030.nkn.org:30003
2021/04/15 12:24:23.709311 [INFO ] GID 1, Creating generate ID txn. This process may take quite a few minutes...
2021/04/15 12:24:24.016879 [INFO ] GID 88, read resourceFile err: open certs/xx-xx-xx-xx.ipv4.nknlabs.io.resource.json: no such file or directory
2021/04/15 12:29:22.006335 [INFO ] GID 90, https server is unavailable yet

And if I wait, the last line outputs again every couple of minutes.

This line catches my attention:

Error creating new order :: too many certificates already issued for: nknlabs.io: see https://letsencrypt.org/docs/rate-limits/

But I’ve tried this command multiple times, so perhaps I have exceeded the limit for my IP address.

@nebeleben was suggested to generate the ID on a separate machine. Do you also think I have to do that? I would prefer not to, since I have no idea how - I would need a full tutorial for that.

Update:

I’ve managed to run nknd from my Mac using the same wallet.json file I had in the Raspberry Pi. ID generation is then successful, yay!

But… when I copy that wallet back to the Raspberry and run nknd there, it fails again. :frowning:

It give me:

[INFO ] GID 1, GetID got resp: {"error":{"code":-45022,"data":null,"message":"INTERNAL ERROR, there is no ID in account"},"id":"1","jsonrpc":"2.0"} from http://mainnet-seed-0040.nkn.org:30003

At that same point, my Mac gets this instead:

[INFO ] GID 1, GetID got resp: {"id":"1","jsonrpc":"2.0","result":{"id":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}} from http://mainnet-seed-0021.nkn.org:30003

And is able to continue. Any ideas @yilun or @zbruceli?

This is quite strange. Are you sure you are using the same wallet.json on both side? And they are both in your current working directory when you start nknd?

Ouch! I had a different wallet on the Raspi. My bad. I was convinced I synced the wallets in the two devices, but I must have missed something in the process.

Now it seems to be running the node. Or at least trying to! I see a lot of lines like:

Ping ... error: Wait for reply timeout
Error sending sync messge to node
Get consensus state from neighbor ... error: Wait for reply timeout

and only every now and then also

DropTxns: X txns (XXX bytes) in txpool, no need to drop

Is that normal?

OK, after fiddling with the router config, I’m getting better results. Turns out removing my manually added Port Forwarding rules works better. Now the raspi/router adds the rules as “Automatically added by UPnP” and the node seems to have more successful connections. Now I’m getting many more of these lines:

Remote node connect from xx.xx.xx.xx:41322 to local address xx.xx.xx.xx:30001

Still I’m getting an overwhelming amount of errors like the ones I mentioned above in between. Is that normal?

All of the logs you mentioned are normal. The default log level is pretty verbose, just in case you need some info to debug :slight_smile:

1 Like

So, my Raspberry Pi seems to have been mining for almost 24 hours, however nStatus still says “node offline.” NKNx on the other hand took very long to start listing the node, and when it did, it has it under “WAIT_FOR_SYNCING.” Is that also normal?

That typically means your port forwarding is not set up correctly on your router.

PS: currently nknx is not updating node status and they are working on it. Check their pinned msg in #nknx channel in discord for more info.

Turns out it is super important to upgrade the version of GO. Only after downloading and extracting the latest tar ball did the compilation work. Thank you for this.