2

I am attempting to setup LndHub with a Pi3 via docker-compose. After bitcoind blockchain sync completed, judging by the logs from lnd (Lightning) and LndHub, it seems like LndHub is having trouble decoding messages from lnd (logs pasted below)?

Anyone faced this sort of issue before? Or have any suggestions?

I know this is more of a JS/RPC question, but thought ppl here may have more experience with the libraries used by lnd & LndHub.

I guess my next step is probably to add some print statements somewhere in the LndHub code. Will update this post after I do that.

lnd logs:

2021-06-20 23:42:12.591 [INF] CRTR: Processed channels=38 updates=78 nodes=32 in last 59.874156103s
2021-06-20 23:42:13.955 [ERR] RPCS: [/lnrpc.Lightning/SubscribeInvoices]: encoding/hex: invalid byte: U+002F '/'
2021-06-20 23:42:13.956 [ERR] RPCS: [/lnrpc.Lightning/GetInfo]: encoding/hex: invalid byte: U+002F '/'
2021-06-20 23:42:13.958 [ERR] RPCS: [/lnrpc.Lightning/GetInfo]: encoding/hex: invalid byte: U+002F '/'
2021-06-20 23:42:13.961 [ERR] RPCS: [/lnrpc.Lightning/ListChannels]: encoding/hex: invalid byte: U+002F '/'

LndHub logs:

updateLightning()                                                                                                                            
updated                                                                                                                                      
2021-06-20T22:50:34.595Z : info: [BOOTING UP] : "Listening on port 3000"                                                                     
Node NOT Exiting...                                                                                                                          
{ Error: 2 UNKNOWN: encoding/hex: invalid byte: U+002F '/'                                                                                   
    at Object.callErrorFromStatus (/opt/LndHub/build/node_modules/@grpc/grpc-js/build/src/call.js:31:26)                                     
    at Object.onReceiveStatus (/opt/LndHub/build/node_modules/@grpc/grpc-js/build/src/client.js:327:49)                                      
    at Object.onReceiveStatus (/opt/LndHub/build/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)                        
    at process.nextTick (/opt/LndHub/build/node_modules/@grpc/grpc-js/build/src/call-stream.js:130:78)                                       
    at process._tickCallback (internal/process/next_tick.js:61:11)
  code: 2,
  details: 'encoding/hex: invalid byte: U+002F \'/\'',
  metadata:
   Metadata { internalRepr: Map { 'content-type' => [Array] }, options: {} } }                                                              
lnd failure

Software versions:

Hardware: Raspberry Pi 3
OS: Raspbian Buster 10
Docker Base Image: Ubuntu 18.04
Bitcoin: 0.21.1
Lnd: v0.13.0-beta
LndHub: v1.3.0 (Node: v10.15.3)

Dockerfile and docker-compose files:

https://github.com/pangyuteng/bitcoin-lndhub/blob/main/docker-compose.yml
bictoind: https://github.com/pangyuteng/bitcoin-lndhub/blob/main/bitcoind/Dockerfile
lnd: https://github.com/pangyuteng/bitcoin-lndhub/blob/main/lnd/Dockerfile
LndHub: https://github.com/pangyuteng/bitcoin-lndhub/blob/main/hub/Dockerfile

--- EDIT 2021-09-22 ---

I updated bitcoin-core to v22. now lnd is giving a different error from rpcperms/interceptor.go... and I have to figure out how to get rpc to run for lnd, as below seems to indicate "rpc is not running"...

export LND_DIR=/mnt/hdd/lnd
export MACAROON_HEADER="Grpc-Metadata-macaroon: $(sudo xxd -ps -u -c 1000 $LND_DIR/data/chain/bitcoin/mainnet/admin.macaroon)"
curl -X GET --cacert $LND_DIR/tls.cert --header "$MACAROON_HEADER" https://localhost:8080/v1/balance/blockchain

{"error":"the RPC server is in the process of starting up, but not yet ready to accept calls","code":2,"message":"the RPC server is in the process of starting up, but not yet ready to accept calls","details":[]}

--- EDIT 2021-09-27 ---

Turns out my bitcoind was not syncing due having enough swap and server constantly shuts down / kernel panic.

After syncing and reenabled swap... it is back to the orginal error message but at a different location (node:internal/process/task_queues:78:11) and there seems to be some communication going on between lndhub with bitcoind! :)

bitcoind getblockchaininfo: {
  result: {
    chain: 'main',
    blocks: 702459,
    headers: 702459,
    bestblockhash: '0000000000000000000a45d676fc178cc7603ca7908af2ed1701137a848db5d3',
    difficulty: 18997641161758.95,
    mediantime: 1632764543,
    verificationprogress: 0.9999990028709793,
    initialblockdownload: false,
    chainwork: '0000000000000000000000000000000000000000221092943f73a5bddde80438',
    size_on_disk: 416306659033,
    pruned: false,
    softforks: {
      bip34: [Object],
      bip66: [Object],
      bip65: [Object],
      csv: [Object],
      segwit: [Object],
      taproot: [Object]
    },
    warnings: ''
  },
  error: null,
  id: '883e89b6-7c7e-4cd5-aa8e-a6e54879ae62'
}
lnd failure
Error: 2 UNKNOWN: encoding/hex: invalid byte: U+002F '/'
    at Object.callErrorFromStatus (/opt/LndHub/node_modules/@grpc/grpc-js/src/call.ts:81:24)
    at Object.onReceiveStatus (/opt/LndHub/node_modules/@grpc/grpc-js/src/client.ts:338:36)
    at Object.onReceiveStatus (/opt/LndHub/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
    at Object.onReceiveStatus (/opt/LndHub/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
    at /opt/LndHub/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 2,
  details: "encoding/hex: invalid byte: U+002F '/'",
  metadata: Metadata {
    internalRepr: Map(1) { 'content-type' => [Array] },
    options: {}
  }
}

0

All along it was a configuration error on my end in the docker-compose file, and also me not being patient enough to wait until core node is synced, since that is when lnd is willing to be able to "talk" to core node. of note, I learned that you can't just bring down these services with docker-compose down, and ideally you need to gracefully shut down bitcoin core first via bitcoin-cli stop, then you can do a docker-compose down - the potential impact would be bitcoin blockchain file will become corrupt, thus requiring you to sync/reindex the blockchain.

         volumes:
+            - /lnd/tls.cert:/opt/LndHub/tls.cert:ro
+            - /lnd/admin.macaroon:/opt/LndHub/admin.macaroon:ro
         environment:
             CONFIG: ${HUBCONFIG}
-            TLSCERT: "/lnd/tls.cert"
-            MACAROON: "/lnd/admin.macaroon"

(Illustrative git diff shown above)

Environment variables TLSCERT and MACAROON should not have been file paths, instead, it should just be assumed to be in the lnd-hub folder, thus mounted to said locations. Alternatively from the official website, if you want, you could also have the corresponding hex-encoded file content defined as TLSCERT and MACAROON.

The docker-compose and corresponding files are available below. https://github.com/pangyuteng/bitcoin-lndhub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.