Hello,
I can successfully execute the following curl command locally on a bitcoin-core/lightning node targeting the bitcoin daemon:
input:
curl --user username:password --data-binary '{"jsonrpc":"2.0","id":"curltest","method":"getblockchaininfo","params":[]}' -H 'content-type:text/plain;'
http://localhost:18332 -v
output:
:[]}' -H 'content-type:text/plain;'
http://localhost:18332 -v
* Trying 1.2.3.4:18332...
* TCP_NODELAY set
* Connected to localhost (1.2.3.4) port 18332 (#0)
* Server auth using Basic with user 'username'
> POST / HTTP/1.1
> Host: localhost:18332
> Authorization: Basic cnBjdXNlcjp3cm9uZ3Bhc312344
> User-Agent: curl/7.68.0
> Accept: */*
> content-type:text/plain;
> Content-Length: 74
>
* upload completely sent off: 74 out of 74 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Fri, 09 Dec 2022 04:11:58 GMT
< Content-Length: 480
<
{"result":{"chain":"test","blocks":2410457,"headers":===removed===="}
* Connection #0 to host localhost left intact
But when trying to target the lightning daemon the connection is being reset by the server:
input:
curl --user username:password --data-binary '{"jsonrpc":"2.0","id":"curltest","method":"listpeers","params":[]}' -H 'content-type:text/plain;'
http://localhost:19735 -v
output:
* Trying 1.2.3.4:19735...
* TCP_NODELAY set
* Connected to localhost (1.2.3.4) port 19735 (#0)
* Server auth using Basic with user 'username'
> POST / HTTP/1.1
> Host: localhost:19735
> Authorization: Basic cnBjdXNlcjpycGN1234
> User-Agent: curl/7.68.0
> Accept: */*
> content-type:text/plain;
> Content-Length: 66
>
* upload completely sent off: 66 out of 66 bytes
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
I'm using all default settings for lightningd (no config file)
What is the reason the host is resetting the connection?
Do I need to configure anything to make this work?
Can I use the same RPC credentials as the bitcoin-core node? Changing the credentials doesn't modify behaviour, same reset error.
Any tip or link to documentation would be greatly appreciated.
Martin