Title: c-lightning on testnet: problems and questions Post by: mocacinno on January 11, 2018, 10:09:05 AM Disclaimer: I must admit i'm very late at reading up on the lightning network. For a long time, i just tought: dev's are working on it, and sooner or later they'll deliver a usable daemon/wallet. I never bothered digging into the protocol.
Since the fees i payed for my transactions last month totalled over $200 in fiat terms, i wanted to gain some knowledge about LN, so i could start using it as soon as i deem it to be stable. In order to gain a lot of knowledge fast, i figured it would be best to just use one of my testnet nodes, compile c-lightning and start running a lightning node on the testnet to play with... The problems i ran into might be trivial, but i could not find the answers anywhere... If i really dug into the protocol and the sourcecode of c-lightning, i might find the answers myself, i just don't have the time to spend days on these problems right now. What happened: i'm running a bitcoin tesnetnet node on debian 16.04.1. The version i'm running is 150100 and it's fully sync'ed i compiled c-lightning (https://github.com/ElementsProject/lightning) i started lightningd in a screen session => lightningd/lightningd --network=testnet --log-level=debug i created a new address => cli/lightning-cli newaddr i funded this address, not from the node's wallet, but from electrum (i realise this might have been stupid) the funding transaction is/was https://www.blocktrail.com/tBTC/tx/72181b4f63ec65890884eed89153046659c8c77951d146f076b7fe3daf8b292b immediately, the stdout of lightningd showed following info "lightningd(18315): Owning output 0 5000000000 (P2SH) txid 72181b4f63ec65890884eed89153046659c8c77951d146f076b7fe3daf8b292b" great :)... However.... Code: cli/lightning-cli getinfo Code: cli/lightning-cli addfunds 0100000001aa85ac933d75d6f4e6ec401241f7c1ed89b771a7129377916329b70e4e51fc1f000000006b4830450221008ebc5b65ad97ce91408338be25cc4a448b2b3c4a7d4ea4331cfb060e4448c568022026b47d6383ba005dc168463e6d8ec04d8e26f6144610cfb915391330c1b397cd01210394bef21f302409bf762a5725f1831f747e51d2698da25131554a975f55912db8fdffffff0200f2052a0100000017a9146a0224cc128dbddaf60d0019fad95f6c41cb803b87f803ce780d0000001976a9148c9973ba715da98adcacfb40953209b24e207bc488ac00000000 hmm... something strange is going on, Could not add outputs to wallet Code: cli/lightning-cli listfunds Wait... What???? output 0 of txid 72181b4f63ec65890884eed89153046659c8c77951d146f076b7fe3daf8b292b has a value of 5000000000, why does my lightningd shows a value of 705032704 ??? I disregarded the value mismatch, and concluded my daemon did have at least some funds to open a channel, so i tryd connecting Code: cli/lightning-cli connect [my id, still not going to disclose this one] [my ip] 9735 the debug on my lightningd immediately showed me following output: Code: lightningd(18315): Connected json input seems like i'm unable to connect.... It became painfully obvious i wasn't connected: Code: cli/lightning-cli fundchannel [my id, still not going to disclose this one] 500000000 Code: cli/lightning-cli getpeers Code: cli/lightning-cli getchannels Just to re-try, i funded the wallet of my node that lightningd was connected to, created a new address, funded it from my node (which i had to fund first to begin with). I'm skipping some steps, but it boiled down to the following: Code: cli/lightning-cli addfunds 0200000001b0f4b5f77eb4f6c1cf38970ab1a329e4be503d56ed33febfc6cee0766658e117000000006a473044022006ddd04d56fcc4db3f6913bc5e662988e621916e9d304ed4ad4f1d6c06e89d3e0220475dff4d08cfb22c982dd33cb1cb47d1b0eb12670a3d072cbe3ec91f1fc4956401210287cc1d734d607b1126daccca6a502cedbf356c655a99d8620a8e3f23d28ddf4afeffffff0200b33f710000000017a914db4e4f5a29c45babc3a823e27128a24bd495e4ad873f89f505000000001976a914950b4d42b397c992c6ffe205fe8c012f9589092b88acac331300 Code: cli/lightning-cli listfunds But still, i couldn't connect (same error message), nor could i fund a channel (since i wasn't connected) I finally decided to stop my lightningd,rename ~/.lightning, restart my lightningd, fund it from my node's wallet, but still i'm unable to connect. I must be doing something stupid... I just can't figure out what... Oh, before anyone asks, i did trace the process when i was trying to connect... Following lines might be interesting: 29445 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 16 29445 fcntl(16, F_GETFL) = 0x2 (flags O_RDWR) 29445 fcntl(16, F_SETFL, O_RDWR|O_NONBLOCK) = 0 29445 fcntl(16, F_GETFD) = 0 29445 fcntl(16, F_SETFD, FD_CLOEXEC) = 0 29445 setsockopt(16, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 29445 epoll_ctl(3, EPOLL_CTL_ADD, 16, {EPOLLOUT, {u32=16, u64=16}}) = 0 29445 epoll_ctl(3, EPOLL_CTL_DEL, 16, 0x7ffe275412e0) = 0 29445 epoll_ctl(3, EPOLL_CTL_ADD, 16, {EPOLLOUT, {u32=16, u64=16}}) = 0 29445 connect(16, {sa_family=AF_INET, sin_port=htons(18332), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress) 29445 epoll_ctl(3, EPOLL_CTL_DEL, 16, 0x7ffe27541230) = 0 29445 epoll_ctl(3, EPOLL_CTL_ADD, 16, {EPOLLOUT, {u32=16, u64=16}}) = 0 29445 epoll_wait(3, [{EPOLLOUT, {u32=16, u64=16}}], 32, 900000) = 1 29445 getsockopt(16, SOL_SOCKET, SO_ERROR,
29445 epoll_ctl(3, EPOLL_CTL_DEL, 16, 0x7ffe275412c0) = 0 29445 epoll_ctl(3, EPOLL_CTL_ADD, 16, {EPOLLIN, {u32=16, u64=16}}) = 0 29445 epoll_wait(3, [{EPOLLIN, {u32=16, u64=16}}], 32, 900000) = 1 29445 ioctl(16, FIONREAD, [192]) = 0 29445 readv(16, [{"HTTP/1.1 200 OK\r\nContent-Type: a"..., 192}], 1) = 192 29445 epoll_ctl(3, EPOLL_CTL_DEL, 16, 0x7ffe27541260) = 0 29445 shutdown(16, SHUT_WR) = 0 29445 close(16) = 0 ... 29201 close(16) = -1 EBADF (Bad file descriptor) the debug.log of bitcoind didn't show anything usefull Title: Re: c-lightning on testnet: problems and questions Post by: Cdecker on January 11, 2018, 11:15:38 PM Hey mocacinno, thanks for giving c-lightning a shot. The value mismatch is actually important, no one has ever tried to give that many funds to a lightning wallet so far, and indeed you stumbled over a bug when reading back the funds from the DB. It is fixed in a PR and should be merged soon, at which point the true value of the output will show up :-)
As for the disconnection I don't really know. Are you trying to connect to yourself? `connect <myid> <myip> 9735` seems to suggest that. Title: Re: c-lightning on testnet: problems and questions Post by: mocacinno on January 12, 2018, 07:35:26 AM Hey mocacinno, thanks for giving c-lightning a shot. The value mismatch is actually important, no one has ever tried to give that many funds to a lightning wallet so far, and indeed you stumbled over a bug when reading back the funds from the DB. It is fixed in a PR and should be merged soon, at which point the true value of the output will show up :-) As for the disconnection I don't really know. Are you trying to connect to yourself? `connect <myid> <myip> 9735` seems to suggest that. Hi, It's great to see the dev team active on bitcointalk :) I'll try to pull the new code, recompile and put the old ~/.lightning folder back to verify if i see the 50 tbtc value. As for your second question, yes, i started lightningd on the same machine as bitcoind. Bitcoind is running in daemon mode, lightningd runs in a screen session. I then tryd to connect using lightning-cli on the same machine as lightningd and bitcoind were running. I verified using "lsof -i :9735" and found a possible error: Code: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME For some reason it's IPv6 instead of IPv4, eventough no other service is listening on this port... I tried many other ports, but the debug always shows Code: lightning_gossipd(9238): TRACE: Failed to bind on 2 socket: Address already in use Afterwards it always seems to listen on the ipv6 socket... EDIT: on a sidenote, the bug is fixed :) Code: li/lightning-cli listfunds Title: Re: c-lightning on testnet: problems and questions Post by: Cdecker on January 12, 2018, 09:11:10 AM Lucky I was pointed here by someone who saw your message, I only occasionally check bitcointalk. Bug reports and help should go to the github, mailing list or IRC channel, to ensure we see them :-)
Thanks for confirming that the patch worked ^^ Are you trying to connect the daemon to itself? Not sure why you'd do that, and pretty sure we close self-connections, try connecting to some other node on the network (https://explorer.acinq.co/ for (id, ip, port)-tuples) Title: Re: c-lightning on testnet: problems and questions Post by: YuriF on January 25, 2018, 10:24:50 AM I set lightning network of ElementsProject : https://github.com/ElementsProject/lightning (https://github.com/ElementsProject/lightning) run command getinfo :
Code: "version" : "v0.5.2-2016-11-21-1655-g2f4ba73", "blockheight" : 472053, "network" : "bitcoin" Code: { "command" : "dev-blockheight", "description" : "Show current block height" }, How did you run command addfunds ? It's : Code: "Unknown command 'addfunds'" Title: Re: c-lightning on testnet: problems and questions Post by: Cdecker on January 25, 2018, 11:28:16 AM Yes, `addfunds` was recently removed and we now rely on tracking the blockchain to tell us about incoming funds.
Title: Re: c-lightning on testnet: problems and questions Post by: YuriF on January 26, 2018, 03:08:51 PM Cdecker, does c-lightning only for testing but for work(planning to do an exchange) I go to install a Lightning Network Daemon (lnd) - ?
Title: Re: c-lightning on testnet: problems and questions Post by: cr1776 on January 26, 2018, 06:22:11 PM Cdecker, does c-lightning only for testing but for work(planning to do an exchange) I go to install a Lightning Network Daemon (lnd) - ? c-lightning and lnd both work for testnet and mainnet - if that is what you are asking. It isn’t completely clear. c-lightning coexists with bitcoin core whereas right now lnd doesn’t. Title: Re: c-lightning on testnet: problems and questions Post by: Cdecker on January 26, 2018, 06:41:20 PM Would be kind of overkill to create a full lightning implementation just for testing :-)
Title: Re: c-lightning on testnet: problems and questions Post by: Anti-Cen on January 28, 2018, 12:31:16 AM Cdecker, does c-lightning only for testing but for work(planning to do an exchange) I go to install a Lightning Network Daemon (lnd) - ? Here is a map of the LN network and it's not Bob connecting to Peter to send money to Alice and as you can see contains major hubs that charge both interest if you have a bi-directional channel open and LN tx fees too. https://lnmainnet.gaben.win/ Your always free not to use it and pay BTC miners $20 per transaction instead if you don't like bankers but the thing is it will be the miners running these banking hubs on LN anyway so they have you by the balls and anyway I like my data "On-Chain" and paying $0.10 per transaction without no up front fees to banks just like it was with Bitcoin about a year ago. Banking hubs are not an option in LN because if everyone paid for two channels to create a disbursed network then it would take 50,000 hops to cross the network so that's not going to work but it's what they were trying to lead people to believe. Title: Re: c-lightning on testnet: problems and questions Post by: achow101 on January 29, 2018, 12:57:59 AM c-lightning coexists with bitcoin core whereas right now lnd doesn’t. LND has the option to use Bitcoin Core as the full node backend. |