From f3be6fe83e53cf1cd96873f8dec82ee5f2aa5021 Mon Sep 17 00:00:00 2001 From: wakgill <76528604+wakgill@users.noreply.github.com> Date: Thu, 7 Jan 2021 13:48:09 -0600 Subject: [PATCH] Create 67.md --- docs/forum/bitcoin-forum/67.md | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 docs/forum/bitcoin-forum/67.md diff --git a/docs/forum/bitcoin-forum/67.md b/docs/forum/bitcoin-forum/67.md new file mode 100644 index 0000000..f615186 --- /dev/null +++ b/docs/forum/bitcoin-forum/67.md @@ -0,0 +1,43 @@ +--- +layout: forum +title: 'Command Line and JSON-RPC' +grand_parent: Forum Posts +parent: Bitcoin Forum +nav_order: 67 +date: 2010-02-23 22:15:41 UTC +original: https://bitcointalk.org/index.php?topic=63.msg452#msg452 +--- + +# Command Line and JSON-RPC + +--- + +``` +Command Line and JSON-RPC +February 23, 2010, 10:15:41 PM + +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. +```