Bitcoin Forum

Bitcoin => Electrum => Topic started by: SlackBitcoiner on June 19, 2023, 09:33:03 PM



Title: Receiving and sending lightning payments from the command line
Post by: SlackBitcoiner on June 19, 2023, 09:33:03 PM
How can one send and receive lightning payments using electrum in the command line?  There is lots of documentation for using lightning via the GUI, but I could not find any for the command line.

```
electrum payto lnurl1dp68gurn8ghj7cn5vdcxz7fwvfkxge3w0puh5t6z23pj742ff38925jv9acxz7f0dyhnymmwv e6kx5zg2e4nsurft958xnzpxanhzag3qne3r 0.000093
# invalid bitcoin address: lnurl1dp68gurn8ghj7cn5vdcxz7fwvfkxge3w0puh5t6z23pj742ff38925jv9acxz7f0dyhnymmwv e6kx5zg2e4nsurft958xnzpxanhzag3qne3r
```

The closest I have found is 'lnpay' which takes no amount as an argument.


Title: Re: Receiving and sending lightning payments from the command line
Post by: BitMaxz on July 04, 2023, 07:54:45 PM
I tried to read the command.py (https://github.com/spesmilo/electrum/blob/master/electrum/commands.py#L1095) on Github and yeah lnpay is the only closes command that works like payto command in on-chain.

Have you recently tried that command?
If you get some error and use the same format you provided above as sample would you mind to change the amount in sats? I just got the idea from command.py (https://github.com/spesmilo/electrum/blob/master/electrum/commands.py#L1115).

Code:
electrum lnpay lnurl1dp68gurn8ghj7cn5vdcxz7fwvfkxge3w0puh5t6z23pj742ff38925jv9acxz7f0dyhnymmwv e6kx5zg2e4nsurft958xnzpxanhzag3qne3r 9300


Title: Re: Receiving and sending lightning payments from the command line
Post by: nc50lc on July 05, 2023, 05:46:27 AM
-snip-
Unfortunately, as OP mentioned, lnpay currently doesn't take an amount arg.
As you can see in commands.py->line1138 (https://github.com/spesmilo/electrum/blob/c4e8869c1a624b8d6a2e51258794b2925620a272/electrum/commands.py#L1138), it only takes an "invoice" arg so the recipient has to add a 'requested amount' to his invoice for it to work in lnpay.

The "amount" in line 1115 that you've linked is under the command open_channel.


@SlackBitcoiner
Is trivial to add that feature so if you really need it, I'd suggest you to open a new "feature request" issue in GitHub.
Developers may find it necessary since the implementation of no-amount invoice made the command unusable in this kind of scenario.