Bitcoin Forum
April 26, 2024, 12:59:36 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why is it empty when sending rpc via curl?  (Read 139 times)
HoBzY (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 2


View Profile
October 10, 2022, 03:35:40 PM
Last edit: December 06, 2022, 05:04:41 PM by HoBzY
 #1

None
1714136376
Hero Member
*
Offline Offline

Posts: 1714136376

View Profile Personal Message (Offline)

Ignore
1714136376
Reply with quote  #2

1714136376
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714136376
Hero Member
*
Offline Offline

Posts: 1714136376

View Profile Personal Message (Offline)

Ignore
1714136376
Reply with quote  #2

1714136376
Report to moderator
shinohai
Full Member
***
Offline Offline

Activity: 267
Merit: 109



View Profile
October 10, 2022, 03:49:18 PM
 #2

Why is it empty when sending rpc via curl?
Code:
curl --user x:x --data-binary '{"jsonrpc":"1.0","id":"curltest","method":"getrpcinfo","params":[]}' -H 'content-type:text/plain;' http://95.216.35.227:8332/

Either 1) The listed IP does not have the RPC port exposed, or 2) You are trying to do this to your own node from within NAT.

serhack
Member
**
Offline Offline

Activity: 107
Merit: 168

Security Researcher and Writer


View Profile WWW
October 10, 2022, 03:50:17 PM
 #3

Why is it empty when sending rpc via curl?
Code:
curl --user x:x --data-binary '{"jsonrpc":"1.0","id":"curltest","method":"getrpcinfo","params":[]}' -H 'content-type:text/plain;' http://95.216.35.227:8332/

Add flag --verbose to see the actual response from the server. You're sending a wrong username or password.

Code:
*   Trying 95.216.35.227...
* TCP_NODELAY set
* Connected to 95.216.35.227 (95.216.35.227) port 8332 (#0)
> POST / HTTP/1.1
> Host: 95.216.35.227:8332
> User-Agent: curl/7.52.1
> Accept: */*
> content-type:text/plain;
> Content-Length: 67
>
* upload completely sent off: 67 out of 67 bytes
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Basic realm="jsonrpc"
< Date: Mon, 10 Oct 2022 15:49:26 GMT
< Content-Length: 0
< Content-Type: text/html; charset=ISO-8859-1
<
* Curl_http_done: called premature == 0
* Connection #0 to host 95.216.35.227 left intact

serhack
Member
**
Offline Offline

Activity: 107
Merit: 168

Security Researcher and Writer


View Profile WWW
October 10, 2022, 03:59:42 PM
Merited by ABCbits (1)
 #4


Exactly, look at HTTP status code. 401 means Unauthorized, you need to supply valid username and password to be able to use RPC interface for that node.

serhack
Member
**
Offline Offline

Activity: 107
Merit: 168

Security Researcher and Writer


View Profile WWW
October 10, 2022, 04:14:01 PM
 #5


Exactly, look at HTTP status code. 401 means Unauthorized, you need to supply valid username and password to be able to use RPC interface for that node.
The funny thing is that I don't know where to get them from.(
IP I took from the seeds
In curl, I specify any login and password, but I don’t know where to get which one is needed (

Why should you have the username/password if the node is not yours? Anyone can start a node, and can restrict the json API interface.

DaveF
Legendary
*
Offline Offline

Activity: 3458
Merit: 6235


Crypto Swap Exchange


View Profile WWW
October 10, 2022, 05:05:53 PM
 #6

You should only talk to your own nodes through RPC. In the conf file you need to specify a user and password and IP range for RPC to talk to.

If you need to pull other information there are various services that allow for API calls, but since access to RPC more or less means you have access to the wallet that is there you are probably not going to be able to find anyplace that allows remote calls. It's just basic bitcoin security and security in general.

-Dave



█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5814


not your keys, not your coins!


View Profile WWW
October 10, 2022, 07:07:29 PM
 #7

Then how to be? Out of 100 ip 6-8 ips give out 401 and the rest are not working at all
Wait, why are you trying to connect to 100 IP addresses? Did you get IP addresses of random Bitcoin nodes and try to query them? That doesn't work. Especially since they most likely do not expose their RPC interface to the internet. That would be highly insecure.

Do you even have your own Bitcoin node?

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
DaveF
Legendary
*
Offline Offline

Activity: 3458
Merit: 6235


Crypto Swap Exchange


View Profile WWW
October 10, 2022, 08:01:15 PM
 #8

You should only talk to your own nodes through RPC. In the conf file you need to specify a user and password and IP range for RPC to talk to.

If you need to pull other information there are various services that allow for API calls, but since access to RPC more or less means you have access to the wallet that is there you are probably not going to be able to find anyplace that allows remote calls. It's just basic bitcoin security and security in general.

-Dave




Can you link to documentation and examples?

Take a look at: https://riptutorial.com/bitcoin/example/26000/node-configuration that more or less gives all the options that are available in the conf file.

You also have this file generator: https://jlopp.github.io/bitcoin-core-config-generator/ I have not used it so I can't comment on how accurate it is, but I know people who have used it that say it does generate valid files.

Keep in mind when running this against your own node that it does have to be fully synced for some things. I know some (most?) commands will not work until your node has finished the IBD and if you re-start it until it finishes whatever housekeeping it has to do at startup.

What are you trying to do anyway?

-Dave


█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
NotATether
Legendary
*
Offline Offline

Activity: 1582
Merit: 6682


bitcoincleanup.com / bitmixlist.org


View Profile WWW
October 11, 2022, 05:47:40 AM
 #9

Note that you can also rent your own Bitcoin node with JSON-RPC access from GetBlock. Never used them myself, but they seem pretty good.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!