<p>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 <code>lnd</code> is willing to be able to &quot;talk&quot; to core node.  of note, I learned that you can't just bring down these services with <code>docker-compose down</code>, and ideally you need to gracefully shut down bitcoin core first via <code>bitcoin-cli stop</code>, then you can do a <code>docker-compose down</code> - the potential impact would be bitcoin blockchain file will become corrupt, thus requiring you to sync/reindex the blockchain.</p>
<pre><code>         volumes:
+            - /lnd/tls.cert:/opt/LndHub/tls.cert:ro
+            - /lnd/admin.macaroon:/opt/LndHub/admin.macaroon:ro
         environment:
             CONFIG: ${HUBCONFIG}
-            TLSCERT: &quot;/lnd/tls.cert&quot;
-            MACAROON: &quot;/lnd/admin.macaroon&quot;
</code></pre>
<p>(Illustrative <code>git diff</code> shown above)</p>
<p>Environment variables <code>TLSCERT</code> and <code>MACAROON</code> 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 <a href="https://github.com/BlueWallet/LndHub" rel="nofollow noreferrer">official website</a>, if you want, you could also have the corresponding hex-encoded file content defined as <code>TLSCERT</code> and <code>MACAROON</code>.</p>
<p>The docker-compose and corresponding files are available below.
<a href="https://github.com/pangyuteng/bitcoin-lndhub" rel="nofollow noreferrer">https://github.com/pangyuteng/bitcoin-lndhub</a></p>

CC BY-SA 4.0
2021-10-10T18:13:15.157Z
2021-10-10T18:18:28.573Z
2021-10-10T18:18:28.573Z
pangyuteng
<p>I am attempting to setup LndHub with a Pi3 via docker-compose.  After bitcoind blockchain sync completed, judging by the logs from <code>lnd</code> (Lightning) and <code>LndHub</code>, it seems like <code>LndHub</code> is having trouble decoding messages from <code>lnd</code> (logs pasted below)?</p>
<p>Anyone faced this sort of issue before?
Or have any suggestions?</p>
<p>I know this is more of a JS/RPC question, but thought ppl here may have more experience with the libraries used by lnd &amp; LndHub.</p>
<p>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.</p>
<p><code>lnd</code> logs:</p>
<pre><code>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 '/'
</code></pre>
<p><code>LndHub</code> logs:</p>
<pre><code>updateLightning()                                                                                                                            
updated                                                                                                                                      
2021-06-20T22:50:34.595Z : info: [BOOTING UP] : &quot;Listening on port 3000&quot;                                                                     
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' =&gt; [Array] }, options: {} } }                                                              
lnd failure
</code></pre>
<p>Software versions:</p>
<pre><code>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)
</code></pre>
<p>Dockerfile and docker-compose files:</p>
<pre><code>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
</code></pre>
<p>--- EDIT 2021-09-22 ---</p>
<p>I updated bitcoin-core to v22. now lnd is giving a different error from <code>rpcperms/interceptor.go</code>... and I have to figure out how to get rpc to run for lnd, as below seems to indicate &quot;rpc is not running&quot;...</p>
<pre><code>export LND_DIR=/mnt/hdd/lnd
export MACAROON_HEADER=&quot;Grpc-Metadata-macaroon: $(sudo xxd -ps -u -c 1000 $LND_DIR/data/chain/bitcoin/mainnet/admin.macaroon)&quot;
curl -X GET --cacert $LND_DIR/tls.cert --header &quot;$MACAROON_HEADER&quot; https://localhost:8080/v1/balance/blockchain

{&quot;error&quot;:&quot;the RPC server is in the process of starting up, but not yet ready to accept calls&quot;,&quot;code&quot;:2,&quot;message&quot;:&quot;the RPC server is in the process of starting up, but not yet ready to accept calls&quot;,&quot;details&quot;:[]}
</code></pre>
<p>--- EDIT 2021-09-27 ---</p>
<p>Turns out my bitcoind was not syncing due having enough swap and server constantly shuts down / kernel panic.</p>
<p>After syncing and reenabled swap... it is back to the orginal error message but at a different location (<code>node:internal/process/task_queues:78:11</code>) and there seems to be some communication going on between lndhub with bitcoind! :)</p>
<pre><code>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: &quot;encoding/hex: invalid byte: U+002F '/'&quot;,
  metadata: Metadata {
    internalRepr: Map(1) { 'content-type' =&gt; [Array] },
    options: {}
  }
}

</code></pre>

<lightning-network>
lnd and Bluewallet LndHub integration error
pangyuteng
# lnd and Bluewallet LndHub integration error

(Asked by: username_0 on 2021-06-21)

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/username_0/bitcoin-lndhub/blob/main/docker-compose.yml
bictoind: https://github.com/username_0/bitcoin-lndhub/blob/main/bitcoind/Dockerfile
lnd: https://github.com/username_0/bitcoin-lndhub/blob/main/lnd/Dockerfile
LndHub: https://github.com/username_0/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: {}
  }
}

```

**Tags:** lightning-network


---

## 1 answers

### Answer by username_0 on 2021-10-10. Score: 0 | Accepted answer

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](https://github.com/BlueWallet/LndHub), 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/username_0/bitcoin-lndhub>


---

