Bitcoin Forum
May 08, 2024, 03:16:00 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bitcoind ideas  (Read 2033 times)
tcatm (OP)
Sr. Member
****
qt
Offline Offline

Activity: 337
Merit: 265


View Profile
April 19, 2011, 03:33:26 PM
 #1

Some ideas for bitcoind:

* rename bitcoind -> bitcoin-cli
* add an interactive readline RPC interface forking is disabled
* don't start TCP RPC by default if forking is disabled

Examples:
$ bitcoin-cli
> getinfo
{...}
> stop
$

$ bitcoin-cli -server
Starting ThreadRPC
> stop
$

$ bitcoin-cli -daemon
$ # same behaviour as bitcoind
1715181360
Hero Member
*
Offline Offline

Posts: 1715181360

View Profile Personal Message (Offline)

Ignore
1715181360
Reply with quote  #2

1715181360
Report to moderator
You can see the statistics of your reports to moderators on the "Report to moderator" pages.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715181360
Hero Member
*
Offline Offline

Posts: 1715181360

View Profile Personal Message (Offline)

Ignore
1715181360
Reply with quote  #2

1715181360
Report to moderator
1715181360
Hero Member
*
Offline Offline

Posts: 1715181360

View Profile Personal Message (Offline)

Ignore
1715181360
Reply with quote  #2

1715181360
Report to moderator
Luke-Jr
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
April 19, 2011, 04:00:10 PM
 #2

Sounds like a good idea, though I think for a real CLI client, output should be formatted for human consumption, not merely pretty-printed JSON.

Why not split bitcoin-cli out from bitcoind? It's not like they share much code (besides the JSON library, which can be dynamically linked as it should be).

tcatm (OP)
Sr. Member
****
qt
Offline Offline

Activity: 337
Merit: 265


View Profile
April 19, 2011, 04:14:28 PM
 #3

Good idea. Maybe the stdio CLI could accept JSON or RPC commands? JSON returns JSON, RPC prettyprints.

So a client like Spesmilo could just start bitcoin-cli as a subprocess and communicate via a pipe.

At the same time, bitcoin-cli could function as an interactive client to another bitcoin(-cli) running with -server.
Steve
Hero Member
*****
Offline Offline

Activity: 868
Merit: 1007



View Profile WWW
April 19, 2011, 05:50:25 PM
 #4

I mentioned it on IRC that I don't see a need for bitcoind to have any process forking behavior in it...interactively, you can fork the process easy enough to run in the background (and even detach it after starting).  And, if you're setting up a server, it's simple enough to run in the background (and if you're serious, you'll be using something along the lines of daemontools to manage it).

I could even be persuaded that the only command I/O interface it needs to support is over stdio (because that too is easy enough to redirect, could be put behind something like xinetd, etc).  Switches could be used to control whether it's JSON, or human readable, etc (or use separate executables for different formats).  (but there's also an argument to be made against over-doing the modularity)

(gasteve on IRC) Does your website accept cash? https://bitpay.com
Luke-Jr
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
April 19, 2011, 08:27:06 PM
 #5

I mentioned it on IRC that I don't see a need for bitcoind to have any process forking behavior in it...
Disagree. What if startup fails? Forking after startup has succeeded allows one to not only know if there was a problem, but also block until the server is running (and can therefore know a connect will immediately succeed).

tcatm (OP)
Sr. Member
****
qt
Offline Offline

Activity: 337
Merit: 265


View Profile
April 30, 2011, 03:20:54 AM
 #6

I started work on a patch that adds a CLI:

https://github.com/tcatm/bitcoin/tree/cli


Code:
$ ./bitcoind
Welcome to Bitcoin, the digital crypto currency. (0.3.22-beta)

Type:  'help' for help with commands
       'stop' to quit

> getinfo
{"result":{"version":32200,"balance":1.64048576,"blocks":120928,"connections":1,"proxy":"","generate":false,"genproclimit":1,"difficulty":92347.59095209,"hashespersec":0,"testnet":false,"keypoololdest":2465843123,"paytxfee":0.00000000,"errors":""},"error":null,"id":1}

> help sendmany
{"result":"sendmany <fromaccount> {address:amount,...} [minconf=1] [comment]\namounts are double-precision floating point numbers","error":null,"id":1}

> stop

Shutdown initiated. Thank you for using Bitcoin!
$
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!