ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.83k stars 899 forks source link

Error of crashing in command of "lightningd/lightningd --network=testnet --log-level=debug" #984

Closed Dhara-Openxcell closed 6 years ago

Dhara-Openxcell commented 6 years ago

When I try running the "lightningd/lightningd --network=testnet --log-level=debug" after sucessfully starting the Bitcoin server using the "bitcoind -daemon -testnet" ,following issue occurs:

lightningd/lightningd --network=testnet --log-level=debug 2018-02-12T12:34:40.313Z lightningd(14966): Trying to guess public addresses... 2018-02-12T12:34:40.313Z lightningd(14966): Address 192.168.0.73:9735 is not routable 2018-02-12T12:34:40.313Z lightningd(14966): Failed to connect 10 socket: Network is unreachable 2018-02-12T12:34:40.313Z lightningd(14966): testing /home/blockchain/lightning/lightningd/lightning_channeld 2018-02-12T12:34:40.314Z lightningd(14966): testing /home/blockchain/lightning/lightningd/lightning_closingd 2018-02-12T12:34:40.314Z lightningd(14966): testing /home/blockchain/lightning/lightningd/lightning_gossipd 2018-02-12T12:34:40.315Z lightningd(14966): testing /home/blockchain/lightning/lightningd/lightning_hsmd 2018-02-12T12:34:40.315Z lightningd(14966): testing /home/blockchain/lightning/lightningd/lightning_onchaind 2018-02-12T12:34:40.316Z lightningd(14966): testing /home/blockchain/lightning/lightningd/lightning_openingd 2018-02-12T12:34:40.471Z lightningd(14966): Client: Received message 11 from client 2018-02-12T12:34:40.480Z lightningd(14966): Loaded 0 invoices from DB 2018-02-12T12:34:40.480Z lightningd(14966): Client: Received message 9 from client 2018-02-12T12:34:40.480Z lightning_gossipd(14974): pid 14974, msgfd 12 2018-02-12T12:34:40.481Z lightningd(14966): Loaded 0 channels from DB bitcoin-cli exited with code 1: error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/home/lightning/.bitcoin/bitcoin.conf)

2018-02-12T12:34:40.518Z lightningd(14966): bitcoin-cli exited with code 1: error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/home/lightning/.bitcoin/bitcoin.conf)

Log dumped in crash.log 2018-02-12T12:34:40.545Z lightningd(14966): FATAL SIGNAL 6 RECEIVED 2018-02-12T12:34:40.548Z lightningd(14966): backtrace: lightningd/log.c:486 (log_crash) 0x410b18 2018-02-12T12:34:40.561Z lightningd(14966): backtrace: (null):0 ((null)) 0x7fc0b7dc24af 2018-02-12T12:34:40.561Z lightningd(14966): backtrace: (null):0 ((null)) 0x7fc0b7dc2428 2018-02-12T12:34:40.561Z lightningd(14966): backtrace: (null):0 ((null)) 0x7fc0b7dc4029 2018-02-12T12:34:40.561Z lightningd(14966): backtrace: lightningd/log.c:575 (fatal) 0x410f52 2018-02-12T12:34:40.561Z lightningd(14966): backtrace: lightningd/bitcoind.c:723 (wait_for_bitcoind) 0x4056c9 2018-02-12T12:34:40.562Z lightningd(14966): backtrace: lightningd/chaintopology.c:723 (setup_topology) 0x407bd8 2018-02-12T12:34:40.562Z lightningd(14966): backtrace: lightningd/lightningd.c:331 (main) 0x40f258 2018-02-12T12:34:40.562Z lightningd(14966): backtrace: (null):0 ((null)) 0x7fc0b7dad82f 2018-02-12T12:34:40.562Z lightningd(14966): backtrace: (null):0 ((null)) 0x403248 2018-02-12T12:34:40.562Z lightningd(14966): backtrace: (null):0 ((null)) 0xffffffffffffffff Fatal signal 6. 0x410bfe log_crash lightningd/log.c:512 0x7fc0b7dc24af ??? ???:0 0x7fc0b7dc2428 ??? ???:0 0x7fc0b7dc4029 ??? ???:0 0x410f52 fatal lightningd/log.c:575 0x4056c9 wait_for_bitcoind lightningd/bitcoind.c:723 0x407bd8 setup_topology lightningd/chaintopology.c:723 0x40f258 main lightningd/lightningd.c:331 0x7fc0b7dad82f ??? ???:0 0x403248 ??? ???:0 0xffffffffffffffff ??? ???:0 Log dumped in crash.log Aborted (core dumped)

Can anybody please solve my issue and explain me what is exactly happening!

cdecker commented 6 years ago

lightningd internally relies on bitcoin-cli to talk to bitcoind. If bitcoin-cli cannot find the authentication information needed to talk to bitcoind it'll not work, which then causes lightningd to abort. Can you try and see if bitcoin-cli echo hi works from the user that is running lightningd?

Dhara-Openxcell commented 6 years ago

Thanks for your quick reply.

yes we are getting authentication error. error: incorrect rpcuser or rpcpassword (authorization failed) Can you tell me how to set this rpcuser and password ? Also why this credentials needed to to talk bitcoind?

Thanks.

lvaccaro commented 6 years ago

Hi, you can define the bitcoin datadir option (inside datadir there is bitcoin.conf file with your rpc credential, default: ~/.bitcoin for bitcoin/testnet/regtest network type):

--bitcoin-datadir <arg>        -datadir arg for bitcoin-cli

or define the rpc credential options:

--bitcoin-rpcuser <arg>        bitcoind RPC username
--bitcoin-rpcpassword <arg>    bitcoind RPC password
--bitcoin-rpcconnect <arg>     bitcoind RPC host to connect to
cdecker commented 6 years ago

Even when passing in --bitcoin-rpcuser and --bitcoin-rpcpassword you'll need to specify matching configs in bitcoinds config files.

Dhara-Openxcell commented 6 years ago

Hello Guys, Thanks for your quick answer.

We have configured rpc username and password in bitcoin configuration file. Is this rpc user name and password are of our testnet server right means we can set any username and password?

But now thing is like we have set up lightning charge node and while doing payment after creating an invoice request we are getting error like "This is not a valid bitcoin address".

We are following all the step as plugin explained. You can also check the same issue which we have generated here. https://github.com/ElementsProject/woocommerce-gateway-lightning/issues/12

Thanks in advance.

cdecker commented 6 years ago

That'd be an issue with eclair or ElementsProject/woocommerce-gateway-lightning, the WooCommerce plugin seems to prefix with lightning: while the eclair wallet doesn't recognize that. The spec says that the URI scheme should be added: Encoding Overview

molxyz commented 6 years ago

@lvaccaro hello, I have a question for this line:

--bitcoin-rpcconnect <arg> bitcoind RPC host to connect to

I have a c-lightning node on user B and a bitcoind node on user A, both on a same machine, what do you put in the <arg> to get c-lightning node connect to bitcoind? I have tried different ways but none works. Thank you.

cdecker commented 6 years ago

@molxyz you just need to make sure that bitcoin-cli executed by B is able to talk to bitcoind run by A. So it should be sufficient to copy /home/A/.bitcoin/bitcoin.conf to /home/B/.bitcoin/bitcoin.conf. Then test with bitcoin-cli echo hi from user B.

molxyz commented 6 years ago

@cdecker It works! Thank you. I didn't know it could be this easy! Only had to manually copy the bitcoin.conf of userA over to the bitcoin.conf of userB. 👍