Author

Topic: bitcoinj JSON-RPC interface [bounty] (Read 1644 times)

newbie
Activity: 48
Merit: 0
September 03, 2012, 08:07:19 PM
#10
No worries. I have some time this week, but will be out of commission next week for a work trip. I will slowly add to it as I can....but feel free to jump in when / if you can. I need this anyway for a project so will likely continue even if no one else needs

Also, as a note to a mod / admin. I just realized we are in "Devel & Tech Discussion" which is probably the wrong place for this....can someone move us to "Project Devel"? Or if not I will just create a new thread there....



Nice work freetx! I'm glad to see someone coordinating an effort. My time is maxed out right now, but since you've set this all up, I might be able to contribute some coding.
full member
Activity: 216
Merit: 100
September 03, 2012, 07:53:34 PM
#9
Nice work freetx! I'm glad to see someone coordinating an effort. My time is maxed out right now, but since you've set this all up, I might be able to contribute some coding.
newbie
Activity: 48
Merit: 0
September 03, 2012, 06:04:36 PM
#8
That does not return valid JSON-RPC, that just returns JSON

http://json-rpc.org/wiki/specification

Yep, I know. Was just literally slapping the first bit of code I had up there to get this rolling.

I've added a proper rpc interface now. Plan is to offer both REST and JSON-RPC to give widest possible options.

RPC can be accessed via (python example):

>>import jsonrpc
>>s = jsonrpc.ServiceProxy("http://localhost:8333/rpc")
>>s.getAddress()
"1F2dx5Bzz5yXksWgddw7bMQLgr9wfrho9L"

>>s.listAddresses()
["1F2dx5Bzz5yXksWgddw7bMQLgr9wfrho9L", "13ZC6VnNV4GBNePfcTZcc4Pg52KzPgaeqr"]

If it would help I can share the source of http://blockchain.info/api/json_rpc_api. It might be useful as a template to get started. However it does use blockchain.info specific database code which would need convert to BitcoinJ lookups.

What is that written in? If its not too much trouble it may be interesting to see. If nothing else it will provide an easy way to maintain consistency of method names.

hero member
Activity: 910
Merit: 1005
September 03, 2012, 01:52:28 PM
#7
If it would help I can share the source of http://blockchain.info/api/json_rpc_api. It might be useful as a template to get started. However it does use blockchain.info specific database code which would need convert to BitcoinJ lookups.
newbie
Activity: 48
Merit: 0
September 03, 2012, 01:26:42 PM
#6
I'll submit my personal project here as a way to help kickstart this off:

https://github.com/jposse/PosseWallet/

This is nowhere near being ready for this bounty, but the skeleton is there.

Its based on bitcoinj-0.5.2 and utilizes Jetty as an embedded Web / JSP / Servlet container.

Hopefully, I can entice some other people (Nyhm, etc) into helping.

As of now its only minimally functional, but does work.

Short list of how to get working:

(preface: you need java installed, obviously)

1. git clone https://github.com/jposse/PosseWallet.git
2. cd PosseWallet/
3. ant jar
4. cd dist/
5. java -jar PosseWallet.jar &
6. tail -f PosseWallet.log

At first it will need to download the headers, which normally takes about 15 mins or so.

After the chain is downloaded (or actually anytime, since Jetty starts right away), open a web-browser and check the following:

http://localhost:8333/getAddress             - (will generate a new address, return in JSON format, and save in wallet).
http://localhost:8333/listAddresses          - (will list all addresses in JSON format)

Its fairly easy and straight forward to extend this. To do so, do following:

1. Write a new servlet (look at existing getAddressServlet for idea).
2. Declare your new servlet in JettyWs like the others (ie. context.addServlet(new ServletHolder(new YourNewServlet()), "/yourNewCommand");.

I will continue working on this, so please check back at github occasionally to watch for changes. I'm not super worried about the Bounty for this (sure, feel free to contribute if you think its worth something). However, more than anything I would like to entice other devs to use and contribute. I think a lightweight custom wallet webservice is something lots of people need, so instead of us all duplicating so much effort, lets pitch in to build the things we need).

For my part, the bits I'm going to be adding is custom triggers. For instance, I want to be able to auto-update database tables based on transaction events that affect my wallet. So if coins come in for an address in my wallet, I want to be able to instantly update a JDBC (or NoSQL) row. This will get away from the need to constantly poll - which is how the traditional bitcoind solution must function.

Regards.

hero member
Activity: 533
Merit: 501
September 02, 2012, 12:38:47 PM
#5
Technically, I can do this, and your technical requirements are not far off from something I have already partially designed for myself (no code yet). However, I'm not keen on "racing" other devs for the bounty (this just leads to sloppy work).

If someone picks up your offer, that's great. If not, please contact me directly. I have strong Java and Bitcoin experience, and I am interested in establishing my professional reputation in the Bitcoin software development field.

Sounds good, thanks. If the expiration expires on the bounty I will contact you. Also, keep in mind, this doesn't have to be a race between independent developers. Working as a team with others is also an option.
hero member
Activity: 533
Merit: 501
September 02, 2012, 12:36:08 PM
#4
yea for 5btcs I don't think anyone would do this, because it would just take a while to do and test.

Yep, this was just my personal value to myself. I was hoping that some others would have piled on more to the bounty that would have equally valued it.
full member
Activity: 216
Merit: 100
September 02, 2012, 12:28:14 PM
#3
Technically, I can do this, and your technical requirements are not far off from something I have already partially designed for myself (no code yet). However, I'm not keen on "racing" other devs for the bounty (this just leads to sloppy work).

If someone picks up your offer, that's great. If not, please contact me directly. I have strong Java and Bitcoin experience, and I am interested in establishing my professional reputation in the Bitcoin software development field.
hero member
Activity: 533
Merit: 501
September 02, 2012, 12:09:40 PM
#2
I am surprised by the lack of interest (no replies). bitcoind seems like a pain to run on a little server instance, and figured many others see it as an equal pain point.

Let me know if you are a developer that is about to start on this bounty. Otherwise I might just have to dust off my java knowledge hack it up myself.
hero member
Activity: 533
Merit: 501
September 01, 2012, 10:47:27 AM
#1
I am thinking that it should be implemented in such a way that it would respond in the same ways as the bitcoind interface so that web services would use the same libraries for accessing them. I would drop the account feature though as it doesn't seem needed.

Top commands that need to be created:

getbalance, getnewaddress, getreceivedbyaddress, sendmany, settxfee

ideally this would all be done in a simple class that others could add too. minconf needs to be implemented as well since the use case of this is web services. The JSON-RPC system should be set up by default to be locally accessible only, and basic password security to prevent being hacked.

If anyone has the chops to just build it themselves, I am putting up a 5 BTC bounty on the first to complete a fully working version. The project should be open source so that the community can continue to grow it.

Feel free to ask any questions before developing if what I wrote needs clarification.

This bounty expires after 30 days.

If multiple people work on it, just have a lead that can divide up the bounty appropriately.

Anyone else want to kick into this bounty?

Bounty Balance:
RobKohr: 5BTC
....

----------------
5 BTC
Jump to: