tuheeden Posted July 10, 2013 Share Posted July 10, 2013 Everyone, For everyone who may be trying to explore the Bitcoin revolution, I wanted to share my VERY brief example that will hopefully get you started. Keep in mind that you MUST edit the bitcoin.conf file set these lines: # server=1 tells Bitcoin-QT to accept JSON-RPC commands. server=1 # You must set rpcuser and rpcpassword to secure the JSON-RPC api rpcuser=test rpcpassword=password Additionally, if you use the bitcoind.exe program, you must start it with these options: bitcoind.exe -daemon -conf=c:tempbitcoin.conf (or whereever your .conf file is) Enjoy: $URL = "http://127.0.0.1:8332/" Local $Data1='{"method":"getinfo","params":[],"id":"getinfo"}:' Dim $obj = ObjCreate ("WinHttp.WinHttpRequest.5.1") $obj.Open("POST", $URL, false) $obj.SetCredentials("test","password",0) $obj.SetRequestHeader("Content-Type", "application/json-rpc") $obj.Send($Data1) $oStatusCode = $obj.Status MsgBox(0,"Response",$oStatusCode & "---" & $obj.ResponseText) Link to comment Share on other sites More sharing options...
Jazkal Posted July 18, 2013 Share Posted July 18, 2013 (edited) great work! I changed it up to be able to pull the ballance of the client, which works. Local $Data1='{"method":"getbalance","params":[]}:' But I'm not sure how to getthe ballance to include the unconfirmed transactions. Do you know how to pass that option? EDIT: Here is a link, just scroll down to the getballance items: http://blockchain.info/api/json_rpc_api Edited July 18, 2013 by Jazkal Link to comment Share on other sites More sharing options...
tuheeden Posted July 28, 2013 Author Share Posted July 28, 2013 Sorry for the delay on responding, someone I did not have "follow" turned on. I recommend testing the commands here: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list Only because this may be more current that the Blockchain page (although this is a nice reference page) Let me test tomorrow and I will post what I find. Additionally I recommend using the Autoit JSON library found here: And I will post my sample script using the JSMN library, since it allows passing and receiving of JSON arrays much more easily. Stay tuned. Link to comment Share on other sites More sharing options...
jaberwacky Posted July 28, 2013 Share Posted July 28, 2013 K, sorry for the possibly dumb question. It takes me a while to get concepts. I understand bitcoin. From what I gather, JSON-RPC will allow you to control your wallet remotely? If so, then can you do things like turn your cellphone into a portable bitcoin wallet? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
tuheeden Posted August 1, 2013 Author Share Posted August 1, 2013 OK - Here is a sample script using JSMN library. #Include "JSMN.au3" #include <Array.au3> $URL = "http://127.0.0.1:8332/" Local $Data1='{"method":"getinfo","params":[],"id":"getinfo"}:' Dim $obj = ObjCreate ("WinHttp.WinHttpRequest.5.1") $obj.Open("POST", $URL, false) $obj.SetCredentials("test","password",0) $obj.SetRequestHeader("Content-Type", "application/json-rpc") $obj.Send($Data1) $oStatusCode = $obj.Status $results=Jsmn_decode($obj.ResponseText) $moreresults=Jsmn_ObjTo2DArray($results) local $test1=Jsmn_ObjGetKeys($results) Local $Json1=Jsmn_ObjGet($results, $test1[2]) _ArrayDisplay($test1) _ArrayDisplay($moreresults[1][1]) MsgBox(0,"Response",$Json1 & "+" &$oStatusCode & "---" & $obj.ResponseText) More to come Link to comment Share on other sites More sharing options...
tuheeden Posted August 2, 2013 Author Share Posted August 2, 2013 And here is the line for getting balances with 1 confirmation (just change the minconf=1 to 0) Local $Data1='{"method":"getbalance","params":["minconf=1"],"id":"bal-no-conf"}:' Link to comment Share on other sites More sharing options...
tuheeden Posted August 7, 2013 Author Share Posted August 7, 2013 Sorry I missed the question above: Bitcoin and JSON allow you to write your own interface to do things that the "basic" wallet supports, but does not have currently built into the GUI interface. You could build a completely functional local or remote wallet from AUTOIT if you wanted to (JSON provides you almost unlimited control of the daemon). That still may be vague, but think of Bitcoin like "electronic cash" and JSON as a way to programatically interact with that wallet. jaberwacky 1 Link to comment Share on other sites More sharing options...
jaberwacky Posted August 7, 2013 Share Posted August 7, 2013 That is really cool. I think things like this being made available to scripting languages like AutoIt will help to boost the public visibility of BitCoin. I don't have any BitCoins personally (too poor currently) but the idea is revolutionary. I can't wait to see what cool things could happen with this script. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now