Author

Topic: Command Line and JSON-RPC (Read 34330 times)

member
Activity: 92
Merit: 10
July 01, 2011, 02:53:33 AM
#46
Unknown key type: bestblock
This error is not related to your problem. It's just that the wallet contain a new type of data that the bitcointools is not aware of. (namely, the most recent block that this wallet was synchronized with)

Do you have a thread where you describe the scenario that led to hung transactions ?
edit: I assume this is the one. My advice would be to wait a bit for the import/export private keys feature to be formally released in an official version. Then you can dump your keys to a text file and import back the relevant ones to a fresh wallet.

Yup, that's the one, and yes, those are the features I need.  I found the github branch with a download of stuff that supposedly patches those RPC commands into bitcoin, but, after extracting it nothing was installed or patched, and I don't know what to do.  I want to dump my wallet, and only have the stuff I want, not the hung or damaged stuff, and then import the good stuff into a new wallet, a fresh start.  Please please please, someone put it into the main branch so it gets included in the next official release!
jr. member
Activity: 56
Merit: 1
June 30, 2011, 06:21:26 PM
#45
Unknown key type: bestblock
This error is not related to your problem. It's just that the wallet contain a new type of data that the bitcointools is not aware of. (namely, the most recent block that this wallet was synchronized with)

Do you have a thread where you describe the scenario that led to hung transactions ?
edit: I assume this is the one. My advice would be to wait a bit for the import/export private keys feature to be formally released in an official version. Then you can dump your keys to a text file and import back the relevant ones to a fresh wallet.
member
Activity: 92
Merit: 10
June 30, 2011, 02:29:31 PM
#44
bitcointools has a fixwallet.py that can often fix broken wallet.dat files.
  https://github.com/gavinandresen/bitcointools/


If that works, I'll be very very happy, OMG!!  You're the best Gavin. Smiley

I finally managed to figure out how to run it, and then it spouted an error I don't understand.  Here is the text:

Code:
C:\Program Files\Bitcoin\bitcointools>fixwallet.py --datadir=m:\bitcoin --out=walletFixed.dat
Unknown key type: bestblock

Well, it didn't fix the wallet the way I wanted it to, it still had the hung transactions on it.  I want to Remove those hung transactions, and fix whatever caused them, Or fix whatever is causing it so that they will stop being hung. 
legendary
Activity: 1652
Merit: 2300
Chief Scientist
June 29, 2011, 07:12:38 PM
#43
bitcointools has a fixwallet.py that can often fix broken wallet.dat files.
  https://github.com/gavinandresen/bitcointools/
member
Activity: 92
Merit: 10
June 29, 2011, 03:53:48 PM
#42

Yay, thanks. Smiley  Now I just need to figure out how to dump my broken wallet, and import only the good stuff into a new wallet.  Grrr!
full member
Activity: 147
Merit: 100
June 27, 2011, 08:16:26 AM
#41
Look at rpc.cpp for the list of commands.

Seriously?  So, everyone knows C++ but me?  I don't understand where this list of commands is in this file.  *sigh* I have tried to understand C++ for years, things just are not clicking in my head for some reason.  Do you mean this stuff?
Code:
        //
        // Special case non-string parameter types
        //
        if (strMethod == "setgenerate"            && n > 0) ConvertTo(params[0]);
        if (strMethod == "setgenerate"            && n > 1) ConvertTo(params[1]);
        if (strMethod == "sendtoaddress"          && n > 1) ConvertTo(params[1]);
        if (strMethod == "settxfee"               && n > 0) ConvertTo(params[0]);
        if (strMethod == "getamountreceived"      && n > 1) ConvertTo(params[1]); // deprecated
        if (strMethod == "getreceivedbyaddress"   && n > 1) ConvertTo(params[1]);
        if (strMethod == "getreceivedbyaccount"   && n > 1) ConvertTo(params[1]);
        if (strMethod == "getreceivedbylabel"     && n > 1) ConvertTo(params[1]); // deprecated
        if (strMethod == "getallreceived"         && n > 0) ConvertTo(params[0]); // deprecated
        if (strMethod == "getallreceived"         && n > 1) ConvertTo(params[1]);
        if (strMethod == "listreceivedbyaddress"  && n > 0) ConvertTo(params[0]);
        if (strMethod == "listreceivedbyaddress"  && n > 1) ConvertTo(params[1]);
        if (strMethod == "listreceivedbyaccount"  && n > 0) ConvertTo(params[0]);
        if (strMethod == "listreceivedbyaccount"  && n > 1) ConvertTo(params[1]);
        if (strMethod == "listreceivedbylabel"    && n > 0) ConvertTo(params[0]); // deprecated
        if (strMethod == "listreceivedbylabel"    && n > 1) ConvertTo(params[1]); // deprecated
        if (strMethod == "getbalance"             && n > 1) ConvertTo(params[1]);
        if (strMethod == "move"                   && n > 2) ConvertTo(params[2]);
        if (strMethod == "move"                   && n > 3) ConvertTo(params[3]);
        if (strMethod == "sendfrom"               && n > 2) ConvertTo(params[2]);
        if (strMethod == "sendfrom"               && n > 3) ConvertTo(params[3]);
        if (strMethod == "listtransactions"       && n > 1) ConvertTo(params[1]);
        if (strMethod == "listtransactions"       && n > 2) ConvertTo(params[2]);
        if (strMethod == "listaccounts"           && n > 0) ConvertTo(params[0]);
        if (strMethod == "sendmany"               && n > 1)
        {
            string s = params[1].get_str();
            Value v;
            if (!read_string(s, v) || v.type() != obj_type)
                throw runtime_error("type mismatch");
            params[1] = v.get_obj();
        }
        if (strMethod == "sendmany"                && n > 2) ConvertTo(params[2]);

Well, there are comments throughout, so that's good, I really get annoyed by spaghetti code.

Are you looking for this list? https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list
member
Activity: 92
Merit: 10
June 26, 2011, 10:47:21 AM
#40
Look at rpc.cpp for the list of commands.

Seriously?  So, everyone knows C++ but me?  I don't understand where this list of commands is in this file.  *sigh* I have tried to understand C++ for years, things just are not clicking in my head for some reason.  Do you mean this stuff?
Code:
        //
        // Special case non-string parameter types
        //
        if (strMethod == "setgenerate"            && n > 0) ConvertTo(params[0]);
        if (strMethod == "setgenerate"            && n > 1) ConvertTo(params[1]);
        if (strMethod == "sendtoaddress"          && n > 1) ConvertTo(params[1]);
        if (strMethod == "settxfee"               && n > 0) ConvertTo(params[0]);
        if (strMethod == "getamountreceived"      && n > 1) ConvertTo(params[1]); // deprecated
        if (strMethod == "getreceivedbyaddress"   && n > 1) ConvertTo(params[1]);
        if (strMethod == "getreceivedbyaccount"   && n > 1) ConvertTo(params[1]);
        if (strMethod == "getreceivedbylabel"     && n > 1) ConvertTo(params[1]); // deprecated
        if (strMethod == "getallreceived"         && n > 0) ConvertTo(params[0]); // deprecated
        if (strMethod == "getallreceived"         && n > 1) ConvertTo(params[1]);
        if (strMethod == "listreceivedbyaddress"  && n > 0) ConvertTo(params[0]);
        if (strMethod == "listreceivedbyaddress"  && n > 1) ConvertTo(params[1]);
        if (strMethod == "listreceivedbyaccount"  && n > 0) ConvertTo(params[0]);
        if (strMethod == "listreceivedbyaccount"  && n > 1) ConvertTo(params[1]);
        if (strMethod == "listreceivedbylabel"    && n > 0) ConvertTo(params[0]); // deprecated
        if (strMethod == "listreceivedbylabel"    && n > 1) ConvertTo(params[1]); // deprecated
        if (strMethod == "getbalance"             && n > 1) ConvertTo(params[1]);
        if (strMethod == "move"                   && n > 2) ConvertTo(params[2]);
        if (strMethod == "move"                   && n > 3) ConvertTo(params[3]);
        if (strMethod == "sendfrom"               && n > 2) ConvertTo(params[2]);
        if (strMethod == "sendfrom"               && n > 3) ConvertTo(params[3]);
        if (strMethod == "listtransactions"       && n > 1) ConvertTo(params[1]);
        if (strMethod == "listtransactions"       && n > 2) ConvertTo(params[2]);
        if (strMethod == "listaccounts"           && n > 0) ConvertTo(params[0]);
        if (strMethod == "sendmany"               && n > 1)
        {
            string s = params[1].get_str();
            Value v;
            if (!read_string(s, v) || v.type() != obj_type)
                throw runtime_error("type mismatch");
            params[1] = v.get_obj();
        }
        if (strMethod == "sendmany"                && n > 2) ConvertTo(params[2]);

Well, there are comments throughout, so that's good, I really get annoyed by spaghetti code.
full member
Activity: 202
Merit: 109
GCC - Global cryptocurrency
June 14, 2010, 10:25:58 PM
#39
Here's an article about cross domain scripting: http://www.ibm.com/developerworks/library/wa-aj-jsonp1/

It seems that direct remote calling from javascript might not be possible after all. I wonder if calling localhost:8332 is possible from pages stored on your hard disk.

I didn't try that, but I did try two servers on the same machine.  One on 127.0.0.1:8332 and the other on 127.0.0.1:8080.  Neither browser script could make a request to the opposite server.  I was using Firefox 3.6
sr. member
Activity: 429
Merit: 988
June 14, 2010, 06:26:45 PM
#38
Here's an article about cross domain scripting: http://www.ibm.com/developerworks/library/wa-aj-jsonp1/

It seems that direct remote calling from javascript might not be possible after all. I wonder if calling localhost:8332 is possible from pages stored on your hard disk.
full member
Activity: 199
Merit: 2384
June 14, 2010, 04:14:29 PM
#37
Is this really true for modern web browsers, or would the web page have to be loaded from localhost as well?  Can you make an HTTP call from javascript to the localhost if the page was loaded from an internet host?
sr. member
Activity: 429
Merit: 988
June 14, 2010, 03:16:28 PM
#36
Note: Running the server/daemon on a computer that you use for Internet browsing is unsafe. A malicious page could host javascript that calls your local API and sends your coins out.
administrator
Activity: 5222
Merit: 13032
June 11, 2010, 03:55:33 PM
#35
You need to recompile your kernel with support for "owner match support" for netfilter. I was always running into this problem (wanting exotic iptables filters), so I have all of the netfilter modules enabled, even though most of them seem useless to me right now.

I agree that proper authentication would be good, but it's not very important right now. Very few people are running BitCoin on actual multi-user machines, I think.

Quote
if I were root, couldn't I just...

Of course. But packets that originate from the "root" account will still be blocked unless you remove the iptables rule.
full member
Activity: 210
Merit: 104
June 11, 2010, 03:22:14 PM
#34
Code:
FATAL: Module xt_owner not found.
It's not a big problem at the moment. I'd still like to see authentication and wallet encryption in bitcoin in the future. Also, if I were root, couldn't I just
sudo su -
and evade the owner check in iptables?
administrator
Activity: 5222
Merit: 13032
June 11, 2010, 02:56:41 PM
#33
Try loading the "xt_owner" kernel module.

Quote
Setting the UID to my username will block the packet for everyone but me (and root, obviously), right?

Yes. Root will also be blocked unless you add that user as well.
full member
Activity: 210
Merit: 104
June 11, 2010, 02:15:40 PM
#32
iptables -A OUTPUT -o lo -p tcp --dport 8332 -m owner --uid-owner root -j ACCEPT
iptables -A OUTPUT -o lo -p tcp --dport 8332 -j REJECT
Oh sweet. I didn't know you could do that. Setting the UID to my username will block the packet for everyone but me (and root, obviously), right?
Not working for me. It gives the error:
Code:
iptables: No chain/target/match by that name.
administrator
Activity: 5222
Merit: 13032
June 11, 2010, 01:06:59 PM
#31
iptables -A OUTPUT -o lo -p tcp --dport 8332 -m owner --uid-owner root -j ACCEPT
iptables -A OUTPUT -o lo -p tcp --dport 8332 -j REJECT
full member
Activity: 199
Merit: 2384
June 11, 2010, 12:49:36 PM
#30
I don't think you can do that with iptables.. is there some module that lets you match a locally generated packet against the UID of a process?
administrator
Activity: 5222
Merit: 13032
June 11, 2010, 12:46:09 PM
#29
You can block it for everyone but your intended users with iptables.
full member
Activity: 210
Merit: 104
June 11, 2010, 10:54:57 AM
#28
Is there some way this might be recast as a file socket (I suppose Windows would be an issue) or with some sort of security?

At the moment, the lowliest user on any of my machines can happily make a completely unauthenticated SendToAddress call and empty my wallet.
full member
Activity: 185
Merit: 121
April 29, 2010, 06:04:36 AM
#27
This sounds very promising. Is there anyway to carve it out as a stand alone binary? My very rudimentary programming skills might not cut the cheese, but I would like to try to make a Firefox bitcoin wallet plugin. If anybody wants to hack at that and leave me in the dust then I gladly eat dust, otherwise I will plod along and see what I can't do (I refuse to do the impossible, but merely resist the inevitable Cheesy). If there were a way to just get the extra files for the JSON and such like (for web only), working with the bitcoin 0.2.0 version and save having to compile, then the target user would not have to install anything other than the plugin itself, that what I'm fishing for really. Is that a tall order?

I would aim to have bitcoin built into Firefox as a standard. Since no third party is being given preference here, can't it be standard browser code, or even built into the HTML or JavaScript, to parse dedicated scripting code and streamline development of online banking and financial utilities? Perhaps even deposits and withdrawals from banks could then finally be done online without their greedy charges. The plugin would demonstrate the idea for now though and save some user hassle as installing is easy, standard and the plugin repository has wide exposure. Then people may want to email and invite their friends to get the new electronic cash standard. The Paypal tactic of being able to email cash to somebody without an account, and have them login to make an account (to get their money), will translate to, having them load Firefox and/or open the plugin window from the email and install. Guaranteed - satisfaction or your money back, (to the sender of course). Go viral bitcoin. Wink


EDIT: "can't it be standard browser code, or even built into the HTML or JavaScript"  -- And now with a little research, I realize that is just what the JSON stuff does. Yikes! you can't fall asleep for 5 minutes without finding yourself out of the loop.
jr. member
Activity: 34
Merit: 1
April 14, 2010, 02:15:08 PM
#26
Thanks for that! The JSON interface is very easy to use.
full member
Activity: 202
Merit: 109
GCC - Global cryptocurrency
April 06, 2010, 06:58:08 PM
#25

Well, you could just install python-json-rpc (http://json-rpc.org/wiki/python-json-rpc) and do:

Code:
from jsonrpc import ServiceProxy
s = ServiceProxy("http://127.0.0.1:8332")
s.getinfo()

Returns a python dict. It's that easy Wink

D***, haha...  Well... at least I got sirius-m to share some of his mojo.    Tongue

I'll check it out.
sr. member
Activity: 429
Merit: 988
April 06, 2010, 06:06:57 PM
#24
Here is code for a simple Python API.  Each method connects to the server, sends a request, gets a response, then returns a Python dictionary equivalent of the JSON.  It uses standard Python modules.  No error checking is done and only three functions from rpc.cpp are implemented.  If there's interest I can write more.

Well, you could just install python-json-rpc (http://json-rpc.org/wiki/python-json-rpc) and do:

Code:
from jsonrpc import ServiceProxy
s = ServiceProxy("http://127.0.0.1:8332")
s.getinfo()

Returns a python dict. It's that easy Wink
full member
Activity: 202
Merit: 109
GCC - Global cryptocurrency
April 06, 2010, 03:07:05 AM
#23
Here is code for a simple Python API.  Each method connects to the server, sends a request, gets a response, then returns a Python dictionary equivalent of the JSON.  It uses standard Python modules.  No error checking is done and only three functions from rpc.cpp are implemented.  If there's interest I can write more.

To use it, the Python code should be something like...
access =  BitcoinAPI()
access.getInfo()
access.getAmountReceived("1JyEmxiMso2RsFVfBcCa616npBvGgxiBX")
access.sendToAddress("1JyEmxiMso2RsFVfBcCa616npBvGgxiBX", 100.00)    # Send 100 Bitcoins to my Address  Grin

This will be the base for automatic transactions on my site.  If there are any questions or concerns let me know.  If there is something severely wrong, feel free to school me.

Code:
import httplib, simplejson


class BitcoinAPI(object):

    def __init__(self, host = "127.0.0.1", port = 8332, timeout = 3):
        self.host = host
        self.port = port
        self.timeout = timeout
        self.httpHeader = {"Content-type": "application/json"}    # I don't know what needs to be in the header, but this works
        return

    def connect(self):
        self.connection = httplib.HTTPConnection(self.host, self.port, timeout = self.timeout)
        return

    def disconnect(self):
        self.connection.close()
        return

    # Functions return a python dictionary which should be equivalent to the JSON syntax received from the server
    # ident or "id" is a constant 1, but can be overridden when calling.  E.g. getAmountReceived(address, ident = 23)
    def getInfo(self, ident = 1):
        self.connect()
        params = simplejson.dumps({"method": "getinfo", "params": [], "id": ident})
        self.connection.request("POST", "/", params, self.httpHeader)
        response = self.connection.getresponse()
        #print response.status, response.reason    # Use for troubleshooting
        dictionary = simplejson.loads(response.read())
        self.disconnect()
        return dictionary

    def getAmountReceived(self, address, ident = 1):
        self.connect()
        params = simplejson.dumps({"method": "getamountreceived", "params": [address], "id": ident})
        self.connection.request("POST", "/", params, self.httpHeader)
        response = self.connection.getresponse()
        #print response.status, response.reason    # Use for troubleshooting
        dictionary = simplejson.loads(response.read())
        self.disconnect()
        return dictionary

    def sendToAddress(self, address, amount, ident = 1):
        self.connect()
        params = simplejson.dumps({"method": "sendtoaddress", "params": [address, amount], "id": ident})
        self.connection.request("POST", "/", params, self.httpHeader)
        response = self.connection.getresponse()
        #print response.status, response.reason    # Use for troubleshooting
        dictionary = simplejson.loads(response.read())
        self.disconnect()
        return dictionary
founder
Activity: 364
Merit: 7065
March 04, 2010, 09:46:25 PM
#22
This is strange... When I start Bitcoin as a daemon on my 64 bit Linux server, it eats up all the 250MB of remaining RAM, 700MB of swap and eventually crashes. On my 32 bit Ubuntu desktop, it works fine and stays at 15MB of memory usage. The server is running a 64 bit build of Bitcoin. Maybe there's something wrong with the build or something.
sirius-m debugged this, it was 64-bit related. 

The fix is now available on SVN, file util.cpp.
hero member
Activity: 490
Merit: 511
My avatar pic says it all
March 02, 2010, 11:46:42 AM
#21
That wchar thing was what I was stuck on for the OSX build. Cheesy

Glad to see it is ironed out. I'll keep hacking away now.
administrator
Activity: 5222
Merit: 13032
February 27, 2010, 03:18:31 AM
#20
Cool; it works! Grin Thanks for your help!

I am using 2.9.0.

(No memory issues for me.)
hero member
Activity: 489
Merit: 504
February 26, 2010, 11:21:23 PM
#19
The headless mode is incredibly usefull. Finally I can start generating on my servers in the night Cheesy
founder
Activity: 364
Merit: 7065
February 26, 2010, 07:48:44 PM
#18
Are you using wxWidgets 2.9.0?  I don't recommend using anything other than 2.9.0.

It looks like they've got a reference in the wx headers (arrstr.h) to something outside of wxBase.

Removing -D__WXDEBUG__ from bitcoin's makefile would probably solve it.

If that doesn't work and you just want to get it working, you could edit wxWidgets include/wx/arrstr.h, line 167 and comment out the wxASSERT_MSG.
administrator
Activity: 5222
Merit: 13032
February 26, 2010, 03:37:50 PM
#17
Using DB-4.7.25 fixed that problem.

I'm now getting this error, though:
Code:
g++ -O0 -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -D__WXGTK__ -DNOPCH -I"/usr/include" -I"/opt/tdep/include" -o bitcoind -L"/usr/lib" -L"/usr/local/lib" -L"/opt/tdep/lib" obj/nogui/util.o obj/nogui/script.o obj/nogui/db.o obj/nogui/net.o obj/nogui/irc.o obj/nogui/main.o obj/nogui/rpc.o obj/nogui/init.o obj/sha.o -l wx_baseu-2.9 -Wl,-Bstatic -l boost_system -l boost_filesystem -l db_cxx -Wl,-Bdynamic -l crypto -l gthread-2.0
obj/nogui/init.o: In function `wxArrayString::Item(unsigned int) const':
init.cpp:(.text._ZNK13wxArrayString4ItemEj[wxArrayString::Item(unsigned int) const]+0x7): undefined reference to `wxTheAssertHandler'
init.cpp:(.text._ZNK13wxArrayString4ItemEj[wxArrayString::Item(unsigned int) const]+0x42): undefined reference to `wxOnAssert(char const*, int, char const*, char const*, wchar_t const*)'
collect2: ld returned 1 exit status
make: *** [bitcoind] Error 1
administrator
Activity: 5222
Merit: 13032
February 26, 2010, 12:58:54 PM
#16
I'm using Berkeley DB 4.5.20.
founder
Activity: 364
Merit: 7065
February 26, 2010, 12:29:21 PM
#15
wx/clipbrd.h isn't used, move it inside the #if wxUSE_GUI.

Updated headers.h on SVN.

Sorry, I linked to wxbase but I had full wxWidgets on my computer.

The db.h:140 class Db no member named "exisits" is stranger.  pdb->get, pdb->put, pdb->del compiled before that.  Do you have version 4.7.25 of Berkeley DB?

Db::exists()
http://www.oracle.com/technology/documentation/berkeley-db/db/api_reference/CXX/frame_main.html
http://www.oracle.com/technology/documentation/berkeley-db/db/api_reference/CXX/dbexists.html

I suppose they might have added exists recently, using get before that.
administrator
Activity: 5222
Merit: 13032
February 26, 2010, 05:18:32 AM
#14
I'm getting errors when trying to compile with just wxBase.

Code:
g++ -c -O0 -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -D__WXGTK__ -DNOPCH -I"/opt/tdep/include" -I"/usr/include" -DwxUSE_GUI=0 -o obj/nogui/util.o util.cpp
In file included from util.cpp:5:
headers.h:22:24: error: wx/clipbrd.h: No such file or directory
In file included from headers.h:100,
                 from util.cpp:5:
db.h: In member function 'bool CDB::Exists(const K&)':
db.h:140: error: 'class Db' has no member named 'exists'
make: *** [obj/nogui/util.o] Error 1

Clipbrd.h isn't installed with wxBase. Moving wxWidgets-2.9.0/include/wx/clipbrd.h to my include directory just eliminates those two "no such file" lines.
founder
Activity: 364
Merit: 7065
February 25, 2010, 06:54:17 PM
#13
OK, I made a build target bitcoind that only links wxBase and does not link GTK.  Version 0.2.7 on SVN.

I split out the init and shutdown stuff from ui.cpp into init.cpp, so now ui.cpp is pure UI.  ui.h provides inline stubs if wxUSE_GUI=0.  We only have four functions that interface from the node to the UI.  In the bitcoind build, we don't link ui.o or uibase.o.

It started increasing right away. I'll see if valgrind can help me.
Sure feels like it could be something in wxWidgets retrying endlessly because some UI thing failed or something wasn't inited correctly.  Our hack to ignore the initialize failure and run anyway means we're in uncharted territory.  We're relying on the fact that we hardly use wx in this mode.  We do still use a few things like wxGetTranslation and wxMutex.

Another way to debug would be to run in gdb, wait until everything is quiet and all threads should be idle, and break it and see which thread is busily doing something and what it's doing.

I suspect bitcoind will probably work fine, but I hope you can still debug the problem.
sr. member
Activity: 429
Merit: 988
February 25, 2010, 12:32:17 PM
#12
It started increasing right away. I'll see if valgrind can help me.
founder
Activity: 364
Merit: 7065
February 24, 2010, 06:08:55 PM
#11
When and how fast did memory usage increase?  Right away, slowly over a long time, or starting at some later event?

I have -daemon running on ubuntu 9.10 64-bit and memory usage is steady.

It has to be something about the difference on the server besides 64-bit.  Maybe some malfunction from the lack of GUI.  A memory leak debug tool could give a clue.
sr. member
Activity: 429
Merit: 988
February 24, 2010, 02:17:35 PM
#10
This is strange... When I start Bitcoin as a daemon on my 64 bit Linux server, it eats up all the 250MB of remaining RAM, 700MB of swap and eventually crashes. On my 32 bit Ubuntu desktop, it works fine and stays at 15MB of memory usage. The server is running a 64 bit build of Bitcoin. Maybe there's something wrong with the build or something.
hero member
Activity: 490
Merit: 511
My avatar pic says it all
February 24, 2010, 03:56:18 AM
#9
Why would you install them? Because you currently have to. I know the feeling. I run minimalist FreeBSD servers and to clutter them with X libraries is a pain.

However, installing them onto a X workstation is totally fine -- you usually have all of the correct dependancies already. Tongue
administrator
Activity: 5222
Merit: 13032
February 24, 2010, 02:51:40 AM
#8
I'm using Linux From Scratch, so installing a dependency-ridden package like GTK would be a bit of a pain. Why should I add a dozen additional packages and hundreds of megabytes to my system when BitCoin doesn't even use them?
hero member
Activity: 490
Merit: 511
My avatar pic says it all
February 24, 2010, 02:38:37 AM
#7

*NIX peoples are "purists" of sorts. They don't like to pollute their OS installs with libraries that shouldn't be necessary.

A million ifdefs are not the answer either. Hmm.. more thought to this may be required.

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.
founder
Activity: 364
Merit: 7065
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: 511
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: 988
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: 5222
Merit: 13032
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: 511
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: 7065
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.
Jump to: