getumbrel / umbrel-middleware

RESTful Bitcoin and Lightning API for Umbrel
MIT License
21 stars 11 forks source link

Unable to get lnd information #55

Closed mariodian closed 4 years ago

mariodian commented 4 years ago

Hi,

I'm trying to run umbrel manually (without Docker) because I already run my own instances of lnd and bitcoind. However when opening the web UI, I get stuck on /api/v1/lnd/info/status which returns {operational: false, unlocked: false}. When printing the complete error I get the following:

{ LndError: Unable to get lnd information
    at rpcFn.call (/home/satoshi/source/umbrel/umbrel-middleware/services/lnd.js:68:18)
    at Object.onReceiveStatus (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/client_interceptors.js:1210:9)
    at InterceptingListener._callNext (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/client_interceptors.js:847:24)
  name: 'LndError',
  message: 'Unable to get lnd information',
  error:
   { Error: 14 UNAVAILABLE: failed to connect to all addresses
       at Object.exports.createStatusError (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/common.js:91:15)
       at Object.onReceiveStatus (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/client_interceptors.js:1209:28)
       at InterceptingListener._callNext (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/client_interceptors.js:568:42)
       at InterceptingListener.onReceiveStatus (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/client_interceptors.js:618:8)
       at callback (/home/satoshi/source/umbrel/umbrel-middleware/node_modules/grpc/src/client_interceptors.js:847:24)
     code: 14,
     metadata: Metadata { _internal_repr: {}, flags: 0 },
     details: 'failed to connect to all addresses' },
  statusCode: undefined }
::ffff:127.0.0.1 - - [Sun, 23 Aug 2020 09:45:23 GMT] "GET /v1/lnd/info/status HTTP/1.0" 200 38 "http://bitcoin.freedomnode.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"

I'm 100% sure that LND_HOST, TLS_FILE and MACAROON_DIR are set up correctly.

I'm accessing the web UI remotely (nginx is setup correcly), however lnd, bitcond and all umbrel packages are running on the same server.

Is it possible that umbrel-middleware can't yet communicate with lnd > 0.10.4 or is there something else I should check? I'm currently running lnd 0.11.

Thanks!

nolim1t commented 4 years ago

Do you have LND_NETWORK set?

mariodian commented 4 years ago

@nolim1t the problem was that MACAROON_DIR is supposed to be a path to the directory where macaroons are stored, not a path to admin.macaroon itself as per the documentation.

Screen Shot 2020-08-24 at 2 44 08 PM
nolim1t commented 4 years ago

That path is correct. But from within docker.

You should be able to explicitly define it too

nolim1t commented 4 years ago

But I'll make a note in the documentation

mariodian commented 4 years ago

That path is correct. But from within docker.

You should be able to explicitly define it too

But when I change to my lnd macaroon' path it doesn't work. It only works when it points to the directory instead of the macaroon.

mayankchhabra commented 4 years ago

Good spot, @mariodian! Looks like MACAROON_DIR is incorrectly referred to the admin.macaroon path in the documentation, when we indeed use it as the macaroon directory path:

https://github.com/getumbrel/umbrel-middleware/blob/81728d83832f9b2b0d4918fe736db5c2e19f3d45/services/lnd.js#L22

mariodian commented 4 years ago

I ran into another problem though.

When going through the account creation at server.com/start and then trying to recover the wallet with seed, it's loading forever and the error I'm getting is:

/v1/lnd/wallet/seed
LndError: Macaroon exists, therefore wallet already exists
Screen Shot 2020-08-24 at 2 52 25 PM

So I can't make it past the sign up screen.

mayankchhabra commented 4 years ago

Ah unfortunately the way the entire stack is structured, it doesn't support using an existing lnd wallet. There're too many moving parts to manually fix (such as the dashboard password needs to be the same password as your lnd wallet so it's auto-unlocked when you login, etc).

I'd really not recommend running it with an existing lnd/bitcoind instance for the same reason. Even if you get it working, the next OTA update will probably break it again...

mariodian commented 4 years ago

@mayankchhabra I see. Is an existing lnd/bitcoind instance going to be supported in the future?

mayankchhabra commented 4 years ago

I don't really think so because the way we're architecting getumbrel/umbrel is so that it's a plug-n-play solution that bundles everything and requires no additional configuration.

mariodian commented 4 years ago

Alright thanks. I'll change the code to fit my needs. I really like the UI!