Bitcoin Forum
April 25, 2024, 08:25:45 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How exactly does RPC calls work?  (Read 653 times)
Abiky (OP)
Legendary
*
Offline Offline

Activity: 3178
Merit: 1359


www.Crypto.Games: Multiple coins, multiple games


View Profile
October 21, 2016, 12:41:03 AM
 #1

I'm trying to figure out how to send remote RPC calls from within my PC to a remote BTC full node. All I know is that I can set the RPC port, username and password, but when I try to access it via a web browser (by typing its ip address) and put in the login details, I get an error message.

So how exactly does this work? I just want to be able to control a remote full node from my PC just by specifying the commands like: getpeerinfo and dumpprivkey.

Is there something that I may have missed? Please help, as I'm a little confused with this.  Huh

█████████████████████████
███████▄▄▀▀███▀▀▄▄███████
████████▄███▄████████
█████▄▄█▀▀███▀▀█▄▄█████
████▀▀██▀██████▀██▀▀████
████▄█████████████▄████
███████▀███████▀███████
████▀█████████████▀████
████▄▄██▄████▄██▄▄████
█████▀▀███▀▄████▀▀█████
████████▀███▀████████
███████▀▀▄▄███▄▄▀▀███████
█████████████████████████
.
 CRYPTOGAMES 
.
 Catch the winning spirit! 
█▄░▀███▌░▄
███▄░▀█░▐██▄
▀▀▀▀▀░░░▀▀▀▀▀
████▌░▐█████▀
████░░█████
███▌░▐███▀
███░░███
██▌░▐█▀
PROGRESSIVE
      JACKPOT      
██░░▄▄
▀▀░░████▄
▄▄▄▄██▀░░▄▄
░░░▀▀█░░▀██▄
███▄░░▀▄░█▀▀
█████░░█░░▄▄█
█████░░██████
█████░░█░░▀▀█
LOW HOUSE
         EDGE         
██▄
███░░░░░░░▄▄
█▀░░░░░░░████
█▄░░░░░░░░█▀
██▄░░░░░░▄█
███▄▄░░▄██▌
██████████
█████████▌
PREMIUM VIP
 MEMBERSHIP 
DICE   ROULETTE   BLACKJACK   KENO   MINESWEEPER   VIDEO POKER   PLINKO   SLOT   LOTTERY
1714033545
Hero Member
*
Offline Offline

Posts: 1714033545

View Profile Personal Message (Offline)

Ignore
1714033545
Reply with quote  #2

1714033545
Report to moderator
1714033545
Hero Member
*
Offline Offline

Posts: 1714033545

View Profile Personal Message (Offline)

Ignore
1714033545
Reply with quote  #2

1714033545
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
October 21, 2016, 12:45:45 AM
 #2

The RPC calls work in the same way other HTTP APIs work where you have to provide data. You must use HTTP post requests. It isn't something you access through the browser.

You can use the bitcoin-cli program which will do everything for you and you use it like you do with the debug console. Or you can get some program that can do HTTP post requests (e.g. curl) and then send a JSON encoded HTTP Post request to call an RPC command. The bitcoind will respond with the output.

OgNasty
Donator
Legendary
*
Offline Offline

Activity: 4718
Merit: 4225


Leading Crypto Sports Betting & Casino Platform


View Profile WWW
October 21, 2016, 02:02:19 AM
 #3

This video shows how easy it is to use the provided tools with python to handle calls locally.  I don't think using dumpprivkey from remote nodes would be considered the best security practice.

https://www.youtube.com/watch?v=3xAO4K7FC6E

..Stake.com..   ▄████████████████████████████████████▄
   ██ ▄▄▄▄▄▄▄▄▄▄            ▄▄▄▄▄▄▄▄▄▄ ██  ▄████▄
   ██ ▀▀▀▀▀▀▀▀▀▀ ██████████ ▀▀▀▀▀▀▀▀▀▀ ██  ██████
   ██ ██████████ ██      ██ ██████████ ██   ▀██▀
   ██ ██      ██ ██████  ██ ██      ██ ██    ██
   ██ ██████  ██ █████  ███ ██████  ██ ████▄ ██
   ██ █████  ███ ████  ████ █████  ███ ████████
   ██ ████  ████ ██████████ ████  ████ ████▀
   ██ ██████████ ▄▄▄▄▄▄▄▄▄▄ ██████████ ██
   ██            ▀▀▀▀▀▀▀▀▀▀            ██ 
   ▀█████████▀ ▄████████████▄ ▀█████████▀
  ▄▄▄▄▄▄▄▄▄▄▄▄███  ██  ██  ███▄▄▄▄▄▄▄▄▄▄▄▄
 ██████████████████████████████████████████
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
█  ▄▀▄             █▀▀█▀▄▄
█  █▀█             █  ▐  ▐▌
█       ▄██▄       █  ▌  █
█     ▄██████▄     █  ▌ ▐▌
█    ██████████    █ ▐  █
█   ▐██████████▌   █ ▐ ▐▌
█    ▀▀██████▀▀    █ ▌ █
█     ▄▄▄██▄▄▄     █ ▌▐▌
█                  █▐ █
█                  █▐▐▌
█                  █▐█
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀█
▄▄█████████▄▄
▄██▀▀▀▀█████▀▀▀▀██▄
▄█▀       ▐█▌       ▀█▄
██         ▐█▌         ██
████▄     ▄█████▄     ▄████
████████▄███████████▄████████
███▀    █████████████    ▀███
██       ███████████       ██
▀█▄       █████████       ▄█▀
▀█▄    ▄██▀▀▀▀▀▀▀██▄  ▄▄▄█▀
▀███████         ███████▀
▀█████▄       ▄█████▀
▀▀▀███▄▄▄███▀▀▀
..PLAY NOW..
franky1
Legendary
*
Offline Offline

Activity: 4200
Merit: 4442



View Profile
October 21, 2016, 03:12:07 AM
 #4

RPC calls are primarily used for your webserver or other applications to get data from YOUR bitcoin client.
if YOUR bitcoin client is not set up to accept the connection from an application, then it wont work

if you just want to get data from "the web". then use the API calls from some bitcoin explorers such as
blockchain.info/api
https://blockexplorer.com/api-ref
http://blockr.io/documentation/api
but this is not for full wallet access of those websites, just the block data stuff

but as someone said.
opening general access to things like dumpprivkey on YOUR client is bad due to hackers then possibly trying to get at your client to grab your keys.

however i have a strange feeling you are subtly asking this question in the OP, not learn how to set up YOUR client to allow a connection, but how to remotely 'hack' into any client to grab a privkey of a client without them having to open it up to full remote access.

thus subtly asking how to create a hacking tool

I DO NOT TRADE OR ACT AS ESCROW ON THIS FORUM EVER.
Please do your own research & respect what is written here as both opinion & information gleaned from experience. many people replying with insults but no on-topic content substance, automatically are 'facepalmed' and yawned at
CrazyCraig
Sr. Member
****
Offline Offline

Activity: 501
Merit: 340


Bye Felisha!


View Profile
October 21, 2016, 03:32:08 AM
Last edit: October 23, 2016, 04:29:05 AM by CrazyCraig
 #5

I'm trying to figure out how to send remote RPC calls from within my PC to a remote BTC full node. All I know is that I can set the RPC port, username and password, but when I try to access it via a web browser (by typing its ip address) and put in the login details, I get an error message.

So how exactly does this work? I just want to be able to control a remote full node from my PC just by specifying the commands like: getpeerinfo and dumpprivkey.

Is there something that I may have missed? Please help, as I'm a little confused with this.  Huh

Also make sure your firewall isn't blocking the RPC outbound port.
Abiky (OP)
Legendary
*
Offline Offline

Activity: 3178
Merit: 1359


www.Crypto.Games: Multiple coins, multiple games


View Profile
October 22, 2016, 10:43:52 PM
 #6

The RPC calls work in the same way other HTTP APIs work where you have to provide data. You must use HTTP post requests. It isn't something you access through the browser.

You can use the bitcoin-cli program which will do everything for you and you use it like you do with the debug console. Or you can get some program that can do HTTP post requests (e.g. curl) and then send a JSON encoded HTTP Post request to call an RPC command. The bitcoind will respond with the output.

Great! Thanks for the information. I thought that it was something that could be accessed via the web browser by simply adding the necessary details. Just wanted to know more about this since I want to make my own Bitcoin web application.  Smiley


This video shows how easy it is to use the provided tools with python to handle calls locally.  I don't think using dumpprivkey from remote nodes would be considered the best security practice.

https://www.youtube.com/watch?v=3xAO4K7FC6E

Thanks for the video, mate. It will be of great use to me since I'm very familiar with using Python. My purpose would be more of making a web application using JavaScript that would send RPC calls to the Bitcoin daemon in order to make wallet addresses, deposit BTC, and more (it would be more of like an RPG game). But still, the video above would be very useful for me in case I decide to make a local application from within Python.


@everyone  Thanks guys for all your help. All of this material has greatly helped me into clearing most of my doubts regarding making RPC calls remotely in order to make my own apps with them.  Wink

█████████████████████████
███████▄▄▀▀███▀▀▄▄███████
████████▄███▄████████
█████▄▄█▀▀███▀▀█▄▄█████
████▀▀██▀██████▀██▀▀████
████▄█████████████▄████
███████▀███████▀███████
████▀█████████████▀████
████▄▄██▄████▄██▄▄████
█████▀▀███▀▄████▀▀█████
████████▀███▀████████
███████▀▀▄▄███▄▄▀▀███████
█████████████████████████
.
 CRYPTOGAMES 
.
 Catch the winning spirit! 
█▄░▀███▌░▄
███▄░▀█░▐██▄
▀▀▀▀▀░░░▀▀▀▀▀
████▌░▐█████▀
████░░█████
███▌░▐███▀
███░░███
██▌░▐█▀
PROGRESSIVE
      JACKPOT      
██░░▄▄
▀▀░░████▄
▄▄▄▄██▀░░▄▄
░░░▀▀█░░▀██▄
███▄░░▀▄░█▀▀
█████░░█░░▄▄█
█████░░██████
█████░░█░░▀▀█
LOW HOUSE
         EDGE         
██▄
███░░░░░░░▄▄
█▀░░░░░░░████
█▄░░░░░░░░█▀
██▄░░░░░░▄█
███▄▄░░▄██▌
██████████
█████████▌
PREMIUM VIP
 MEMBERSHIP 
DICE   ROULETTE   BLACKJACK   KENO   MINESWEEPER   VIDEO POKER   PLINKO   SLOT   LOTTERY
CrazyCraig
Sr. Member
****
Offline Offline

Activity: 501
Merit: 340


Bye Felisha!


View Profile
October 23, 2016, 04:29:44 AM
 #7

The RPC calls work in the same way other HTTP APIs work where you have to provide data. You must use HTTP post requests. It isn't something you access through the browser.

You can use the bitcoin-cli program which will do everything for you and you use it like you do with the debug console. Or you can get some program that can do HTTP post requests (e.g. curl) and then send a JSON encoded HTTP Post request to call an RPC command. The bitcoind will respond with the output.

Great! Thanks for the information. I thought that it was something that could be accessed via the web browser by simply adding the necessary details. Just wanted to know more about this since I want to make my own Bitcoin web application.  Smiley


This video shows how easy it is to use the provided tools with python to handle calls locally.  I don't think using dumpprivkey from remote nodes would be considered the best security practice.

https://www.youtube.com/watch?v=3xAO4K7FC6E

Thanks for the video, mate. It will be of great use to me since I'm very familiar with using Python. My purpose would be more of making a web application using JavaScript that would send RPC calls to the Bitcoin daemon in order to make wallet addresses, deposit BTC, and more (it would be more of like an RPG game). But still, the video above would be very useful for me in case I decide to make a local application from within Python.


@everyone  Thanks guys for all your help. All of this material has greatly helped me into clearing most of my doubts regarding making RPC calls remotely in order to make my own apps with them.  Wink

Not a problem. If you need help with anything reach out.
Sorrowfox
Sr. Member
****
Offline Offline

Activity: 292
Merit: 250



View Profile
October 23, 2016, 06:08:08 AM
 #8

As an analogy, RPC works as a function call. Like a function call, when an RPC is made, the calling arguments are passed to the remote machine and the caller waits for a response to be returned from the remote machine.The client machine makes a procedure call that sends a request which included program number, version number, procedure number & etc to the server and waits. The thread is blocked from processing until either a reply is received, or it times out. When the request arrives, the remote machine calls a dispatch routine that performs the requested service, and sends the reply back to the client procedure. After the RPC call is completed, the client program continues.
Abiky (OP)
Legendary
*
Offline Offline

Activity: 3178
Merit: 1359


www.Crypto.Games: Multiple coins, multiple games


View Profile
October 24, 2016, 04:31:06 PM
 #9

As an analogy, RPC works as a function call. Like a function call, when an RPC is made, the calling arguments are passed to the remote machine and the caller waits for a response to be returned from the remote machine.The client machine makes a procedure call that sends a request which included program number, version number, procedure number & etc to the server and waits. The thread is blocked from processing until either a reply is received, or it times out. When the request arrives, the remote machine calls a dispatch routine that performs the requested service, and sends the reply back to the client procedure. After the RPC call is completed, the client program continues.

Good to know. Thanks a lot mate for this useful explanation about RPC calls. With this, I would be able to make my own Bitcoin apps that would use Bitcoin's functions like creating multi-sig addresses, viewing peer stats, and more. It would be more of like an RPG game where it pays you satoshi after a minimum amount has been reached. You could also choose to buy upgrades for your character, and many more using Bitcoin.

Basically, I find Python a lot easier for this but I would also look into making an online wallet for an altcoin, as most alts have the same RPC commands as Bitcoin.  Smiley

█████████████████████████
███████▄▄▀▀███▀▀▄▄███████
████████▄███▄████████
█████▄▄█▀▀███▀▀█▄▄█████
████▀▀██▀██████▀██▀▀████
████▄█████████████▄████
███████▀███████▀███████
████▀█████████████▀████
████▄▄██▄████▄██▄▄████
█████▀▀███▀▄████▀▀█████
████████▀███▀████████
███████▀▀▄▄███▄▄▀▀███████
█████████████████████████
.
 CRYPTOGAMES 
.
 Catch the winning spirit! 
█▄░▀███▌░▄
███▄░▀█░▐██▄
▀▀▀▀▀░░░▀▀▀▀▀
████▌░▐█████▀
████░░█████
███▌░▐███▀
███░░███
██▌░▐█▀
PROGRESSIVE
      JACKPOT      
██░░▄▄
▀▀░░████▄
▄▄▄▄██▀░░▄▄
░░░▀▀█░░▀██▄
███▄░░▀▄░█▀▀
█████░░█░░▄▄█
█████░░██████
█████░░█░░▀▀█
LOW HOUSE
         EDGE         
██▄
███░░░░░░░▄▄
█▀░░░░░░░████
█▄░░░░░░░░█▀
██▄░░░░░░▄█
███▄▄░░▄██▌
██████████
█████████▌
PREMIUM VIP
 MEMBERSHIP 
DICE   ROULETTE   BLACKJACK   KENO   MINESWEEPER   VIDEO POKER   PLINKO   SLOT   LOTTERY
katiecbell
Hero Member
*****
Offline Offline

Activity: 644
Merit: 500


View Profile
October 25, 2016, 05:23:13 AM
 #10

The RPC calls work in the same way other HTTP APIs work where you have to provide data. You must use HTTP post requests. It isn't something you access through the browser.

You can use the bitcoin-cli program which will do everything for you and you use it like you do with the debug console. Or you can get some program that can do HTTP post requests (e.g. curl) and then send a JSON encoded HTTP Post request to call an RPC command. The bitcoind will respond with the output.
Do yo mean we cannot access through browser at all ? This your explanation sounds too technical, I like request you to  put in more possible explanation so that everyone whether tech savvy or not will easily get how RPC calls work...
qwik2learn
Hero Member
*****
Offline Offline

Activity: 636
Merit: 505


View Profile
October 25, 2016, 05:33:39 AM
 #11

The RPC calls work in the same way other HTTP APIs work where you have to provide data. You must use HTTP post requests. It isn't something you access through the browser.

You can use the bitcoin-cli program which will do everything for you and you use it like you do with the debug console. Or you can get some program that can do HTTP post requests (e.g. curl) and then send a JSON encoded HTTP Post request to call an RPC command. The bitcoind will respond with the output.

Great! Thanks for the information. I thought that it was something that could be accessed via the web browser by simply adding the necessary details. Just wanted to know more about this since I want to make my own Bitcoin web application.  Smiley
Hey, what do you know! achow101 has written some code that you could re-use for your project!
https://bitcointalk.org/index.php?topic=1458929.0
It's great stuff, don't miss it!  Grin Maybe you could tip us both for the time that it saved you.  Wink
Abiky (OP)
Legendary
*
Offline Offline

Activity: 3178
Merit: 1359


www.Crypto.Games: Multiple coins, multiple games


View Profile
October 31, 2016, 06:49:09 PM
 #12

Hey, what do you know! achow101 has written some code that you could re-use for your project!
https://bitcointalk.org/index.php?topic=1458929.0
It's great stuff, don't miss it!  Grin Maybe you could tip us both for the time that it saved you.  Wink

Great. Thanks mate! This might be very useful for the little project I'm working on. It will consist of several Raspberry Pis with different power sources in order to determine the most efficient energy solution. Some of those Pis will be used for Bitcoin app development, but the majority would be for crypto currency mining and full nodes for them too. It is good to know about new stuff everyday.  Cheesy

P.S. If I had some BTC, I would send you a tip, but right now I'm all out since I have invested most of the BTC into ICOs.  Wink

█████████████████████████
███████▄▄▀▀███▀▀▄▄███████
████████▄███▄████████
█████▄▄█▀▀███▀▀█▄▄█████
████▀▀██▀██████▀██▀▀████
████▄█████████████▄████
███████▀███████▀███████
████▀█████████████▀████
████▄▄██▄████▄██▄▄████
█████▀▀███▀▄████▀▀█████
████████▀███▀████████
███████▀▀▄▄███▄▄▀▀███████
█████████████████████████
.
 CRYPTOGAMES 
.
 Catch the winning spirit! 
█▄░▀███▌░▄
███▄░▀█░▐██▄
▀▀▀▀▀░░░▀▀▀▀▀
████▌░▐█████▀
████░░█████
███▌░▐███▀
███░░███
██▌░▐█▀
PROGRESSIVE
      JACKPOT      
██░░▄▄
▀▀░░████▄
▄▄▄▄██▀░░▄▄
░░░▀▀█░░▀██▄
███▄░░▀▄░█▀▀
█████░░█░░▄▄█
█████░░██████
█████░░█░░▀▀█
LOW HOUSE
         EDGE         
██▄
███░░░░░░░▄▄
█▀░░░░░░░████
█▄░░░░░░░░█▀
██▄░░░░░░▄█
███▄▄░░▄██▌
██████████
█████████▌
PREMIUM VIP
 MEMBERSHIP 
DICE   ROULETTE   BLACKJACK   KENO   MINESWEEPER   VIDEO POKER   PLINKO   SLOT   LOTTERY
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!