Author

Topic: JSON-RPC step-by-step, help? (Read 212 times)

sr. member
Activity: 860
Merit: 423
October 24, 2019, 01:56:47 PM
#6
Hello everyone.

Is there any step-by-step for JSON-RPC?

I have set up the .conf file:
server=1
rpcuser=bitcoin
rpcpassword=bitcoin

but I am completly lost what to do next, how to connect to it etc. Anyone?

If you are using PHP, then make a JSON-RPC call to your node through cURL.
copper member
Activity: 1666
Merit: 1901
Amazon Prime Member #7
October 21, 2019, 07:13:03 PM
#5
I wrote a script in python to help you get started. You should be able to extrapolate the below into whatever you are trying to do

Code:
#warning: use at your own risk

#dependencies
import requests
import json
import pandas as pd #this is technically not needed, but will probably be if you are to do any kind of analysis

#copy your rpcusername and rpcpassword from your bitcoin.conf file, and keep them inside the 'quotes'
rpcusername = ''
rpcpassword = ''
url = ('http://{0}:{1}@127.0.0.1:8332').format(rpcusername, rpcpassword)

#put the command you want to run here inside 'quotes'
command =

#put any parameters here, if you have none, put 'quotes' with no text ''
#if the parameter is an integer, do not use quotes, otherwise the parameters need to be in 'quotes'
params = ''

data = {'method':command, 'params':[params]}
result = requests.post(url, json=data).json()['result']
print(result)
legendary
Activity: 3374
Merit: 3095
Playbet.io - Crypto Casino and Sportsbook
October 21, 2019, 06:36:09 PM
#4
There is a step by step tutorial on youtube that I think you can follow but it is Linux Based OS but you can follow the steps on how to do it.

Here's the videos: https://www.youtube.com/watch?v=cMM-t7azzJE&list=PLhWIQKZKupCawKJQBAEJc-Y4I30HQ6KBH


Also, check this for more guide on JSON-RPC from here https://bitcoin.org/en/developer-examples#testing-applications
copper member
Activity: 1666
Merit: 1901
Amazon Prime Member #7
October 21, 2019, 05:59:26 PM
#3

I have set up the .conf file:
server=1
rpcuser=bitcoin
rpcpassword=bitcoin
You need to change your rpcpassword to something random, and you should do the same for your rpcuser as well. If you don't, you will get robbed if you have any coin in your wallet used by bitcoin core.
legendary
Activity: 1463
Merit: 1886
October 20, 2019, 10:52:44 AM
#2
How are you trying to connect to it? Most programming language have a easy to use jsonrpc library, or even wrapper for bitcoin core api calls.
newbie
Activity: 6
Merit: 0
October 20, 2019, 03:35:15 AM
#1
Hello everyone.

Is there any step-by-step for JSON-RPC?

I have set up the .conf file:
server=1
rpcuser=bitcoin
rpcpassword=bitcoin

but I am completly lost what to do next, how to connect to it etc. Anyone?
Jump to: