Pages:
Author

Topic: Command Line and JSON-RPC - page 3. (Read 34276 times)

founder
Activity: 364
Merit: 6472
February 24, 2010, 02:17:23 AM
#6
On Linux it needs libgtk2.0-0 installed
Will this requirement be removed sometime? I'd rather not have to deal with GTK.
How much "dealing with" does GTK actually require?  Is it just a matter of "sudo apt-get install libgtk2.0-0" and having some extra libraries sitting around?  GTK doesn't have to do anything, just be there for bitcoin to link to when it loads up, have the gtk-init-check call fail because no GUI present, then it's done. 

It saves us butchering everything with ifdefs and a separate compile and binary to use wxBase just to try to avoid linking GTK.
hero member
Activity: 490
Merit: 509
My avatar pic says it all
February 24, 2010, 01:00:45 AM
#5
* madhatter2 pulls out razor sharp hex editor
sr. member
Activity: 429
Merit: 919
February 23, 2010, 11:18:54 PM
#4
Gtk is required by the GUI, so it must be linked if you want to use the same binary. Making a separate binary is another option, dunno how much code tweaking and ifdeffing that would take.
administrator
Activity: 5166
Merit: 12850
February 23, 2010, 11:07:37 PM
#3
On Linux it needs libgtk2.0-0 installed

Will this requirement be removed sometime? I'd rather not have to deal with GTK.
hero member
Activity: 490
Merit: 509
My avatar pic says it all
February 23, 2010, 10:29:17 PM
#2
Oh thank you!

You have no idea how badly I needed something like this.

I will have a payment library built in no time. Cheesy
founder
Activity: 364
Merit: 6472
February 23, 2010, 06:15:41 PM
#1
Version 0.2.6 on SVN can now run as a daemon and be controlled by command line or JSON-RPC.

On Linux it needs libgtk2.0-0 installed, but does not need a GUI running.  Hopefully gtk can be installed without having a windowing system installed.

The command to start as a daemon is:
bitcoin -daemon [switches...]

Or, to run the UI normally and also be able to control it from command line or JSON-RPC, use the "-server" switch.
bitcoin -server [switches...]

With either switch, it runs an HTTP JSON-RPC server that accepts local socket connections on 127.0.0.1:8332.  The port is bound to loopback and can only be accessed from the local machine, but from any account, not just the user it's running under.

To control it from the command line, the interface is a command name without any switches, followed by parameters if any.
bitcoin [params...]

For example:
bitcoin getinfo
bitcoin getdifficulty
bitcoin setgenerate true
bitcoin stop

It's a simple JSON-RPC client and prints the JSON result.  Look at rpc.cpp for the list of commands.

Web apps or anything automated will normally use JSON-RPC directly, not command line.  There are JSON-RPC libraries for all the major languages.  In script languages like PHP and Python the syntax is as natural as calling a local function.
Pages:
Jump to: