lightninglabs / lightning-terminal

Lightning Terminal: Your Home for Lightning Liquidity
MIT License
488 stars 82 forks source link

mobile: v2 implementation #704

Open djkazic opened 5 months ago

djkazic commented 5 months ago

Here's an initial implementation of mobile-v2, which will replace https://github.com/lightninglabs/lightning-terminal/pull/526. This is distinguished from the initial mobile branch proof of concept by:

There needs to be a refactor and some review around this code, so I am opening it as a draft PR.

Note: java protoc code generation was not compiling for loop.proto, seems like the deprecated field id may be causing protoc to create conflicting implementations of getIdBytes() between the new and old id types. Removing the deprecated id fields in SwapResponse and SwapStatus fixes the issue.

dstadulis commented 5 months ago

CC @kaloudis

djkazic commented 5 months ago

Coming soon: glue code for loop/pool/tapd for proper dialing

kaloudis commented 4 months ago

Is there the ability to build the package with select subservices, and not others (eg. build w/ Taproot Assets and Loop, but not Pool)? If so, it's not documented in the README

guggero commented 4 months ago

No, not yet. For that we'd need to put a bunch of configuration code behind build flags.

Roasbeef commented 4 months ago

@kaloudis have you been able to integrate this PR as is?

kaloudis commented 3 months ago

Was having some issues building but with Kevin's help was able to build for Android and iOS. Need to set Docker file sharing implementation to gRPC FUSE if using macOS

related: https://stackoverflow.com/questions/77256594/getting-sed-couldnt-open-temporary-file-permission-denied-error-in-docker-sc

kaloudis commented 3 months ago

Next up for the Zeus POC is to find a way to add LNC and Speedloader calls to the exposed methods. Tried to simply replace the LND dependency in the go.mod with replace github.com/lightningnetwork/lnd => github.com/ZeusLN/lnd v0.17.4-beta-zeus.1 but that didn't do the trick.

Will try to pull them into lightning-terminal directly

kaloudis commented 3 months ago

Was able to build lightning-terminal mobile with Speedloader and LNC added to it. Working on a POC with Tapas in ZEUS next.

johnanisere commented 2 months ago

Hi @djkazic, I'm running this PR in integrated mode on IOS.

When I make requests to tapd, I always get Error: rpc error: code = Unknown desc = invalid macaroon: verification failed: signature mismatch after caveat verification

But requests to Lnd works fine.

this is what my conf file looks like

# Application Options
lnd-mode=integrated
network=testnet
uipassword=password
faraday-mode=remote
loop-mode=remote
pool-mode=remote

# Lnd
lnd.debuglevel=info
lnd.maxbackoff=2s
lnd.nolisten=1
lnd.norest=1

# Lnd - bitcoin
lnd.bitcoin.active=1
lnd.bitcoin.testnet=1
lnd.bitcoin.node=neutrino

# Lnd - Neutrino
lnd.neutrino.addpeer=btcd-testnet.lightning.computer
lnd.neutrino.feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json

# Lnd - Autopilot
lnd.autopilot.active=1
lnd.autopilot.private=1
lnd.autopilot.minconfs=1
lnd.autopilot.conftarget=16
lnd.autopilot.allocation=0.5
lnd.autopilot.heuristic=externalscore:0.95
lnd.autopilot.heuristic=preferential:0.05

# Lnd - Routing
lnd.routing.assumechanvalid=1

What could be wrong ?

djkazic commented 2 months ago

I've seen that before when using the wrong macaroon.

djkazic commented 2 months ago

I can drop the changes needed to fix this in a commit, one sec.

djkazic commented 2 months ago

@johnanisere I pushed a fix.

johnanisere commented 2 months ago

Thanks @djkazic. Works fine now

johnanisere commented 2 months ago

Hi @djkazic , I can't find the taproot assets api for subscribing to receive events for incoming asset transfers (https://lightning.engineering/api-docs/api/taproot-assets/taproot-assets/subscribe-receive-events) in the IOS framework generated. I can see the one for subscribing to send events though. Is this intentional?

djkazic commented 2 months ago

This is likely a proto file issue. Looking into this now.

djkazic commented 2 months ago

Force pushed the latest proto files. Should be working now.

johnanisere commented 2 months ago

Thanks @djkazic , now I get these errors when I run make ios


/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:190:27: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:202:30: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:203:18: client.CommitVirtualPsbts undefined (type assetwalletrpc.AssetWalletClient has no field or method CommitVirtualPsbts)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:219:27: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:231:30: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:232:18: client.PublishAndLogTransfer undefined (type assetwalletrpc.AssetWalletClient has no field or method PublishAndLogTransfer)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:304:27: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:316:30: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:317:18: client.QueryInternalKey undefined (type assetwalletrpc.AssetWalletClient has no field or method QueryInternalKey)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: undefined: assetwalletrpc.QueryScriptKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: too many errors
# github.com/lightninglabs/lightning-terminal/mobile
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:190:27: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:202:30: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:203:18: client.CommitVirtualPsbts undefined (type assetwalletrpc.AssetWalletClient has no field or method CommitVirtualPsbts)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:219:27: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:231:30: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:232:18: client.PublishAndLogTransfer undefined (type assetwalletrpc.AssetWalletClient has no field or method PublishAndLogTransfer)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:304:27: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:316:30: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:317:18: client.QueryInternalKey undefined (type assetwalletrpc.AssetWalletClient has no field or method QueryInternalKey)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: undefined: assetwalletrpc.QueryScriptKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: too many errors
# github.com/lightninglabs/lightning-terminal/mobile
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:190:27: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:202:30: undefined: assetwalletrpc.CommitVirtualPsbtsRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:203:18: client.CommitVirtualPsbts undefined (type assetwalletrpc.AssetWalletClient has no field or method CommitVirtualPsbts)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:219:27: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:231:30: undefined: assetwalletrpc.PublishAndLogRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:232:18: client.PublishAndLogTransfer undefined (type assetwalletrpc.AssetWalletClient has no field or method PublishAndLogTransfer)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:304:27: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:316:30: undefined: assetwalletrpc.QueryInternalKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:317:18: client.QueryInternalKey undefined (type assetwalletrpc.AssetWalletClient has no field or method QueryInternalKey)
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: undefined: assetwalletrpc.QueryScriptKeyRequest
/Users/johnanisere/go/src/github.com/lightninglabs/lightning-terminal/mobile/assetwallet_api_generated.go:331:27: too many errors
/Users/johnanisere/go/bin/gomobile: ios/arm64: go build -tags mobile,-s,-w,-buildid=,-X,github.com/lightningnetwork/lnd/build.Commit=lightning-terminal-v0.12.2-alpha-23-g447a9fb066c5dfd8380417e96f3c0843d7e45d7e,-X,github.com/lightningnetwork/lnd/build.CommitHash=447a9fb066c5dfd8380417e96f3c0843d7e45d7e,-X,github.com/lightningnetwork/lnd/build.GoVersion=,-X,github.com/lightningnetwork/lnd/build.RawTags=litd,autopilotrpc,signrpc,walletrpc,chainrpc,invoicesrpc,watchtowerrpc,neutrinorpc,peersrpc,-X,github.com/lightninglabs/lightning-terminal.appFilesPrefix=,-X,github.com/lightninglabs/lightning-terminal.Commit=v0.12.2-alpha-23-g447a9fb066c5dfd8380417e96f3c0843d7e45d7e,-X,github.com/lightninglabs/loop.Commit=v0.26.6-beta,-X,github.com/lightninglabs/pool.Commit=v0.6.4-beta.0.20231003174306-80d8854a0c4b,-X,github.com/lightninglabs/taproot-assets.Commit=v0.3.2 -v -buildmode=c-archive -o /var/folders/t5/styjmbqd34q6f9pt1gnk_np00000gn/T/gomobile-work-622384700/Litdmobile-ios-arm64.a ./gobind failed: exit status 1

make: *** [ios] Error 1```
djkazic commented 2 months ago

OK so the fundamental issue is that bumping the proto file like that without bumping the dependency is a chicken or egg problem.

@johnanisere we are blocked until taproot-assets cuts a new release. That functionality you described is newer than the latest release (0.3.3). cc @Roasbeef

djkazic commented 2 months ago

I'll push a revert of the proto files for now.

djkazic commented 2 months ago

OK revert pushed.

johnanisere commented 2 months ago

Alright, Got it @djkazic

johnanisere commented 2 months ago

Hi @djkazic, I noticed that all requests to Lnd fail until it's fully synced to the chain. Request to GetInfo also fails, which makes it difficult to calculate sync progress.

Screenshot 2024-04-24 at 19 40 15
djkazic commented 2 months ago

I believe that is due to lnd still starting up. Rpc active does not mean it is done. Server active status is needed for rpc requests to be routed.

johnanisere commented 1 month ago

Hi @djkazic ,

There seem to be something wrong with tor setup of Litdmobile. when ever i run Litdmobile with the tor config below, I get this error : could not load config: ValidateConfig: listening must be enabled when enabling inbound connections over Tor.

Here is what my config file looks like

# Application Options
lnd-mode=integrated
network=testnet
uipassword=password
faraday-mode=remote
loop-mode=remote
pool-mode=remote

# Lnd
lnd.debuglevel=info
lnd.maxbackoff=2s
lnd.nolisten=1
lnd.norest=1

# Lnd - bitcoin
lnd.bitcoin.active=1
lnd.bitcoin.testnet=1
lnd.bitcoin.node=neutrino

# Lnd - Neutrino
lnd.neutrino.addpeer=btcd-testnet.lightning.computer
lnd.neutrino.feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json

# Lnd - Autopilot
lnd.autopilot.active=1
lnd.autopilot.private=1
lnd.autopilot.minconfs=1
lnd.autopilot.conftarget=16
lnd.autopilot.allocation=1
lnd.autopilot.heuristic=externalscore:0.95
lnd.autopilot.heuristic=preferential:0.05

# Lnd - Routing
lnd.routing.assumechanvalid=1

# Lnd - Tor
lnd.tor.socks=127.0.0.1:9050
lnd.tor.control=127.0.0.1:9051
lnd.tor.active=1
lnd.tor.v3=1
lnd.tor.password=somepassword
lnd.listen=localhost

What am i doing wrong?

djkazic commented 1 month ago

lnd.nolisten=1 is the problem:

https://github.com/lightningnetwork/lnd/blob/4417229bc800752691217c27a7ce615e98c94135/config.go#L1100

johnanisere commented 1 month ago

lnd.nolisten=1 is the problem:

https://github.com/lightningnetwork/lnd/blob/4417229bc800752691217c27a7ce615e98c94135/config.go#L1100

oh, thanks @djkazic

lightninglabs-deploy commented 5 days ago

@roasbeef: review reminder @kaloudis: review reminder