joaodealmeida / woocommerce-gateway-lightning

Plugin to accept Bitcoin Lightning payments at WooCommerce stores, using LND.
MIT License
38 stars 10 forks source link

Is this still receiving support? #14

Closed muhepd closed 5 years ago

muhepd commented 5 years ago

I'm having issues processing a payment, I'm getting an "Service Unavailable" after clicking "Proceed to Lightning Payment".

I followed the instructions and have tried different configurations:

Endpoint with open port in my router (because I'm running a hosted wordpress site) https://mypublicip:8080 and in my lnd.conf I have restlisten=0.0.0.0:8080.

I also have these settings in my lnd.conf for the lnd functionality: listen=0.0.0.0:9735 rpclisten=0.0.0.0:10009 tlsextraip=mypublicip

Macaroon, I have tested with both admin or invoice en hex, no working.

TLS file, I copied the file to the plugin folder, I had to create the tls folder and copy the tls file there, I then put the exact path (/var/www/wptbox/wp-content/plugins/woocommerce-gateway-lightning-master/tls/tls.cert)

Any idea why it would not work?

Thanks. M.

githorray commented 5 years ago

Can you test connectivity from your wordpress server?

curl -s -kX GET --header "Grpc-Metadata-macaroon: __" "https://_mypublicip_:8080/v1/getinfo"

muhepd commented 5 years ago

I'm using a hosted wordpress instance, so I ran that command from another Ubuntu in my LAN, it worked, I got the getinfo:

{"identity_pubkey":"02bf6d95daee87980beed24ccdf45c6b7faf78a3f6....., etc...

I don't know if the problem then is not with the plugin itself but with wordpress...

muhepd commented 5 years ago

Deleted the website and created it again, to start with a clean one, install woocommerce plugin with its storefront theme, then installed gateway lightning, created a product, added it to shopping cart, went to checkout, wrote all required fields, agreed with conditions, paid with lightning, service unavailable...

Endpoint: https://mypublicip:8080/ (I have port 8080 opened in my router pointed to the lightning node) TLS.cert path: /wp-content/plugins/woocommerce-gateway-lightning-master/tls/tls.cert (I had to create the tls folder myself because it was not there and upload the tls.cert file) Macaroon used: admin in hex format (the one I tested with the command above).

Don't know what else to try.

muhepd commented 5 years ago

In case anybody read this, I made it work, I successfully created and paid 4 orders... However, for some unknown reason that I can't figure out, I'm getting an Error: EOF after I click Proceed to Lightning Payment.

I can see the order is created in Woocommerce plugin, but can't create the invoice...

I tested the following from my Wordpress server to my lnd node, all worked good: curl -s -kX GET --header "Grpc-Metadata-macaroon: " "https://lndIP:8080/v1/payreq/... curl -s -kX GET --header "Grpc-Metadata-macaroon: " "https://lndIP:8080/v1/getinfo curl -s -kX GET --header "Grpc-Metadata-macaroon: " "https://lndIP:8080/v1/invoices

Does anybody knows what error means?

Thanks in advance.

githorray commented 5 years ago

Are you testing from your hosted Wordpress instance or your local server?

muhepd commented 5 years ago

I am testing from my local server, which is the one that was working but now it doesn't. I was checking the LND node logs to see if I had a connection being refused, but I don't have anything in the log about that.

I thought about those reject connections for two reasons:

  1. EOF errors related to Go, in the link below the speak about the server is closing the connection. Rate limiting is one possible reason for this. I had fail2ban installed in the server and I just removed it, but still doesn't work. https://stackoverflow.com/questions/17714494/golang-http-request-results-in-eof-errors-when-making-multiple-requests-successi

  2. I saw in this lnd github issue a part of a log that talked about EOF errors: 2019-04-08 14:18:35.138 [ERR] CMGR: Can't accept connection: unable to accept connection from 192.168.1.1:52460: EOF I was trying to find something similar in my lnd logs, but no success. https://github.com/lightningnetwork/lnd/issues/2911

I don't know what to do now, I really like this plugin because there is no middle man, no API with anybody, I know Joao created Opennode but I really would like to avoid using an API, the idea is to avoid any kind of trust, right?

What is really puzzling is that all the curl GET commands work from anywhere... I can create invoices with ZAP app or RTL without any issues.

muhepd commented 5 years ago

Found the errors in the Apache2 logs: 172.16.1.1 is my "Wan" IP. I use two routers, I wonder why the client is my first router... It seems this problem is related to the getLivePrice function, however, I can use the link in browser with the ticker and it works... Thinking...

Nobody here is helping, but I still want to document my case just in case somebody experiences the same.

Sat Aug 10 00:57:47.619246 2019] [:error] [pid 1211] [client 172.16.1.1:44206] PHP Warning: file_get_contents(): SSL operation failed with code 5. OpenSSL Error messages:\nerror:0200100D:system library:fopen:Permission denied\nerror:20074002:BIO routines:file_ctrl:system lib\nerror:0B06F002:x509 certificate routines:X509_load_cert_file:system lib\nerror:0200100D:system library:fopen:Permission denied\nerror:20074002:BIO routines:file_ctrl:system lib\nerror:0B06F002:x509 certificate routines:X509_load_cert_file:system lib\nerror:0200100D:system library:fopen:Permission denied\nerror:20074002:BIO routines:file_ctrl:system lib\nerror:0B06F002:x509 certificate routines:X509_load_cert_file:system lib\nerror:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /var/www/wordpress/wp-content/plugins/woocommerce-gateway-lightning-master/Lnd_wrapper.php on line 148, referer: https://www.mydomain/checkout/

[Sat Aug 10 00:57:47.619300 2019] [:error] [pid 1211] [client 172.16.1.1:44206] PHP Warning: file_get_contents(): Failed to enable crypto in /var/www/wordpress/wp-content/plugins/woocommerce-gateway-lightning-master/Lnd_wrapper.php on line 148, referer: https://www.mydomain/checkout/

[Sat Aug 10 00:57:47.619488 2019] [:error] [pid 1211] [client 172.16.1.1:44206] PHP Warning: file_get_contents(https://apiv2.bitcoinaverage.com/indices/global/ticker/BTCUSD): failed to open stream: operation failed in /var/www/wordpress/wp-content/plugins/woocommerce-gateway-lightning-master/Lnd_wrapper.php on line 148, referer: https://www.mydomain/checkout/

[Sat Aug 10 00:57:47.619545 2019] [:error] [pid 1211] [client 172.16.1.1:44206] PHP Warning: Division by zero in /var/www/wordpress/wp-content/plugins/woocommerce-gateway-lightning-master/woocommerce-gateway-lightning.php on line 135, referer: https://www.mydomain/checkout/

muhepd commented 5 years ago

Fixed, permission issues on the certificates copied to the etc/ssl/certs folder in the wordpress local server.