Bitcoin Forum
November 15, 2024, 03:46:25 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: JSON RPC help  (Read 1832 times)
KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 12:00:41 AM
 #1

Hi, I am a complete newbie in using any JSON RPC API, I looked a bit in the several APIs out there and decided I would use the Blockchain.info RPC host.

But then I'm now stuck on how exactly do we connect to this host. I am using a windows 7, should I have another OS? I can put a linux on a virtual machine, but only if it's completely necessary.

I also downloaded Ruby, but I didn't understand how exactly I can connect.

Can anyone give me a short procedure on how to you connect to the blockchain rpc host? I would be really glad, thank you.

Beep boop beep boop
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
November 03, 2014, 02:43:17 AM
 #2

Have you tried everything BC told? If not, do it! Smiley https://blockchain.info/api/json_rpc_api . Let me know what happens. By the way,I am not sn expert. Wink

P.S. Its not a good idea to use it as the private keys will be shared with the server. So it is better to stick eith Java wallet if you are sticking with BC wallet.

P.S.(2) See this topic too : https://bitcointalk.org/index.php?topic=622994.0

   ~~MZ~~

KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 09:50:20 AM
 #3

Have you tried everything BC told? If not, do it! Smiley https://blockchain.info/api/json_rpc_api . Let me know what happens. By the way,I am not sn expert. Wink

P.S. Its not a good idea to use it as the private keys will be shared with the server. So it is better to stick eith Java wallet if you are sticking with BC wallet.

P.S.(2) See this topic too : https://bitcointalk.org/index.php?topic=622994.0

   ~~MZ~~

I did a little improvement and now instead of not knowing at all how this works, I only get this error "error: could not parse reply from server". It's funny how there is only one post in here with the exact same problem as mine, but absolutely nobody cared about this guy.

I was trying to get bitcoind v0.8.1 hooked up  to the blockchain.info JSON-RPC and I kept getting:
Code:
$ bitcoind getinfo
error: couldn't parse reply from server

My ~/bitcoin/bitcoin.conf file:
Code:
rpcconnect=blockchain.info
rpcport=443
rpcssl=1
rpcuser=MyWalletGUID
rpcpassword=MyS00perS3cretPassword
printtoconsole=1
debug=1

I can't figure out what is wrong, I can get curl to work fine and it returns results as expected.  I know I had this working some months ago, which makes me think that maybe it is a problem with the newer bitcoind (which I just installed from apt this morning: Bitcoin version v0.8.1.0-g34d62a8-beta)?

Beep boop beep boop
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
November 03, 2014, 10:33:51 AM
Last edit: November 03, 2014, 10:45:34 AM by Muhammed Zakir
 #4

I did a little improvement and now instead of not knowing at all how this works, I only get this error "error: could not parse reply from server". It's funny how there is only one post in here with the exact same problem as mine, but absolutely nobody cared about this guy.

Some may have not seen the post or they couldn't get what was the problem, this maybe the reason there was no reply.


Anyway, lets come to the problem! Smiley

The config file isn't correct, rpc host must be set to rpc.blockchain.info, i.e., rpcconnect=rpc.blockchain.info .

Connecting using Bicoind:
Code:
$ ./bitcoind -rpcconnect=rpc.blockchain.info -rpcport=443 -rpcssl -rpcuser=YourWalletIdentifier -rpcpassword=YourPassword getinfo

P.S.

Bitcoind Commands Not Available:

getwork setgenerate getmininginfo getmemorypool - Not intended for bitcoin mining
keypoolrefill - blockchain.info wallets have no keypool
stop
walletpassphrasechange - Disabled for security reasons
dumpprivkey - Disabled for security reasons
encryptwallet - All blockchain.info wallets are encrypted by default. Password change is disabled for security reasons

P.S.(2) You probably want to read 'Methods' in https://blockchain.info/api/json_rpc_api for API calls and its description. Smiley

   ~~MZ~~

KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 10:44:00 AM
 #5


Some may have not seen the post or they couldn't get what was the problem, this maybe the reason there was no reply.


Anyway, lets come to the problem! Smiley

The config file isn't correct, rpc host must be set to rpc.blockchain.info, i.e., rpcconnect=rpc.blockchain.info .

Connecting using Bicoind:
Code:
$ ./bitcoind -rpcconnect=rpc.blockchain.info -rpcport=443 -rpcssl -rpcuser=YourWalletIdentifier -rpcpassword=YourPassword getinfo

P.S.

Bitcoind Commands Not Available:

getwork setgenerate getmininginfo getmemorypool - Not intended for bitcoin mining
keypoolrefill - blockchain.info wallets have no keypool
stop
walletpassphrasechange - Disabled for security reasons
dumpprivkey - Disabled for security reasons
encryptwallet - All blockchain.info wallets are encrypted by default. Password change is disabled for security reasons

   ~~MZ~~

Oh I aready set it to rpc.blockchain.info, sorry if the other person didn't. Here is everything on my bitcoin.conf, I looked for a pre-set one, and edited it removing what was useless, should I remove anything else?

Quote
server=1
rpcuser=xxxxxx-xxx-xxxx-xxxx-xxxxxx
rpcpassword=password
rpctimeout=30
rpcport=443
rpcconnect=rpc.blockchain.info
rpcsslciphers=TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH
rpcsslcertificatechainfile=server.cert
rpcsslprivatekeyfile=server.pem

Beep boop beep boop
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
November 03, 2014, 10:50:03 AM
 #6

Oh I aready set it to rpc.blockchain.info, sorry if the other person didn't.

Grin

Here is everything on my bitcoin.conf, I looked for a pre-set one, and edited it removing what was useless, should I remove anything else?

Quote
server=1
rpcuser=xxxxxx-xxx-xxxx-xxxx-xxxxxx
rpcpassword=password
rpctimeout=30
rpcport=443
rpcconnect=rpc.blockchain.info
rpcsslciphers=TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH
rpcsslcertificatechainfile=server.cert
rpcsslprivatekeyfile=server.pem


These are the important ones, others are optional:

-rpcuser - Should be set to your wallet identifier. This is a 36 character random string which can be found on your wallet login page.
-rpcpassword - Should be set to your main wallet password. If double encryption is enabled your second password will need to be set using walletpassphrase
-rpcport - Should be set to 443 for https:// (when the -rpcssl is provided) or 80 for plain text http://
-rpcssl - Set to use a secure connection (Recommended)

   ~~MZ~~

Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
November 03, 2014, 11:06:17 AM
 #7

Have you enabled double encryption? If yes, you will have to change config file.
Quote
-rpcpassword -- Should be set to your main wallet password. If double encryption is enabled your second password will need to be set using walletpassphrase

You probably want to read 'Methods' in https://blockchain.info/api/json_rpc_api for API calls and its description. Smiley

   ~~MZ~~

KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 11:22:21 AM
 #8

Have you enabled double encryption? If yes, you will have to change config file.
Quote
-rpcpassword -- Should be set to your main wallet password. If double encryption is enabled your second password will need to be set using walletpassphrase

You probably want to read 'Methods' in https://blockchain.info/api/json_rpc_api for API calls and its description. Smiley

   ~~MZ~~

No I haven't :/

I don't understand, when I run the bitcoind with no method/command, It starts downloading random blockchain data, but when I send the getinfo command, it gives me this error

Beep boop beep boop
KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 11:24:14 AM
 #9


These are the important ones, others are optional:

-rpcuser - Should be set to your wallet identifier. This is a 36 character random string which can be found on your wallet login page.
-rpcpassword - Should be set to your main wallet password. If double encryption is enabled your second password will need to be set using walletpassphrase
-rpcport - Should be set to 443 for https:// (when the -rpcssl is provided) or 80 for plain text http://
-rpcssl - Set to use a secure connection (Recommended)

   ~~MZ~~

Maybe the ssl certificate is not there? Where can I find server.pem / server.cert

Beep boop beep boop
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
November 03, 2014, 11:46:16 AM
 #10

Maybe the ssl certificate is not there? Where can I find server.pem / server.cert

You just want to write rpcssl. Try removing ssl related contents.

From Blockchain.info , read this too:

Quote
Security:
This api is currently incompatible with two factor authentication and it must therefore be disabled. We HIGHLY recommend you enable double encryption which can be found on the My Wallet account details page.

If you will be accessing this API from a server with a static ip address is recommended you enable the IP Lock found in the Security Section of your My Wallet account.

P.S. Try:

Code:
$ ./bitcoind -rpcconnect=rpc.blockchain.info -rpcport=443 -rpcssl -rpcuser=YourWalletIdentifier -rpcpassword=YourPassword getinfo

    ~~MZ~~

KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 12:05:17 PM
 #11

Maybe the ssl certificate is not there? Where can I find server.pem / server.cert

You just want to write rpcssl. Try removing ssl related contents.

From Blockchain.info , read this too:

Quote
Security:
This api is currently incompatible with two factor authentication and it must therefore be disabled. We HIGHLY recommend you enable double encryption which can be found on the My Wallet account details page.

If you will be accessing this API from a server with a static ip address is recommended you enable the IP Lock found in the Security Section of your My Wallet account.

P.S. Try:

Code:
$ ./bitcoind -rpcconnect=rpc.blockchain.info -rpcport=443 -rpcssl -rpcuser=YourWalletIdentifier -rpcpassword=YourPassword getinfo

    ~~MZ~~

Waaaaaaaah finally Cheesy



Thaanks!

Beep boop beep boop
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
November 03, 2014, 12:08:50 PM
 #12

Waaaaaaaah finally Cheesy

[img ]http://puu.sh/cBz12/da258a6c55.png[/img]

Thaanks!

Congrats, friend! First time, I am getting involved in API related issue which I don't know anything. Cheesy Because of you, I studied some! Smiley Thanks! Wink

   ~~MZ~~

KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 12:12:57 PM
 #13

Waaaaaaaah finally Cheesy

[img ]http://puu.sh/cBz12/da258a6c55.png[/img]

Thaanks!

Congrats, friend! First time, I am getting involved in API related issue which I don't know anything. Cheesy Because of you, I studied some! Smiley Thanks! Wink

   ~~MZ~~

Well, I guess you know enough to help me out! I doubt I'd have ever thought of ssl settings before a loong search Smiley Thanks again and have a great day

Beep boop beep boop
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
November 04, 2014, 01:10:11 PM
 #14

Help Me!!! Grin Something wrong? Huh Sad

Code:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\usrname>cd "C:\Program Files\Bitcoin\daemon"

C:\Program Files\Bitcoin\daemon>bitcoind getinfo
error: You must set rpcpassword=<password> in the configuration file:
C:\Users\usrname\AppData\Roaming\Bitcoin\bitcoin.conf
If the file does not exist, create it with owner-readable-only file permissions.


C:\Program Files\Bitcoin\daemon>

I can connect using:
Code:
$ ./bitcoind -rpcconnect=rpc.blockchain.info -rpcport=443 -rpcssl -rpcuser=YourWalletIdentifier -rpcpassword=YourPassword getinfo

The password is same but still not working!

My config:

Code:
rpcconnect=rpc.blockchain.info
rpcport=443
rpcssl
rpcuser=XXXXXX
rpcpassword=XXXXX

   ~~MZ~~

KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 05, 2014, 12:24:41 AM
 #15

Help Me!!! Grin Something wrong? Huh Sad

Code:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\usrname>cd "C:\Program Files\Bitcoin\daemon"

C:\Program Files\Bitcoin\daemon>bitcoind getinfo
error: You must set rpcpassword=<password> in the configuration file:
C:\Users\usrname\AppData\Roaming\Bitcoin\bitcoin.conf
If the file does not exist, create it with owner-readable-only file permissions.


C:\Program Files\Bitcoin\daemon>

I can connect using:
Code:
$ ./bitcoind -rpcconnect=rpc.blockchain.info -rpcport=443 -rpcssl -rpcuser=YourWalletIdentifier -rpcpassword=YourPassword getinfo

The password is same but still not working!

My config:

Code:
rpcconnect=rpc.blockchain.info
rpcport=443
rpcssl
rpcuser=XXXXXX
rpcpassword=XXXXX

   ~~MZ~~


I think it's rpcssl, change it to rpcssl=1

Other than that, I'd check for extra spaces in the password maybe? When you're pasting it?

Beep boop beep boop
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
November 08, 2014, 09:13:47 AM
 #16

I think it's rpcssl, change it to rpcssl=1

Other than that, I'd check for extra spaces in the password maybe? When you're pasting it?

Thanks! Smiley The config file wasn't 'read-only', so I changed it and also added '=1' , now it works! Smiley

   ~~MZ~~

KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 952
Merit: 452


Check your coin privilege


View Profile
November 10, 2014, 11:40:32 PM
 #17

I think it's rpcssl, change it to rpcssl=1

Other than that, I'd check for extra spaces in the password maybe? When you're pasting it?

Thanks! Smiley The config file wasn't 'read-only', so I changed it and also added '=1' , now it works! Smiley

   ~~MZ~~

Smiley No problem!

Beep boop beep boop
gadgetcoin
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 11, 2014, 03:35:46 AM
 #18

Many useful posts, thanks for this.
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!