Pages:
Author

Topic: Creating an iOS wallet for jailbroken devices using BitcoinJ (Read 3427 times)

full member
Activity: 216
Merit: 100
It looks like Zincwallet might be the way to go. I haven't had the time to try it out though.

https://github.com/voisine/zincwallet
full member
Activity: 216
Merit: 100
I think Apple's ban on Bitcoin clients in their app makes more people to jailbrake thier iPhone as I did to mine.

You are right! Have some problem with calling into Obj-C to update the GUI. I wish someone would help me as I am not capable to solve it by myself

Care to share what you've been doing so far? I've had to put this project on hold for the past few weeks but hope to get going again in a week or so.
member
Activity: 93
Merit: 10
I think Apple's ban on Bitcoin clients in their app makes more people to jailbrake thier iPhone as I did to mine.

You are right! Have some problem with calling into Obj-C to update the GUI. I wish someone would help me as I am not capable to solve it by myself
legendary
Activity: 1526
Merit: 1134
I don't think playing games like CoG will do any good. Besides, FWIW anything based on bitcoinjs on iOS is going to suck because the JS engine apps get is extremely slow, much slower than the one in mobile safari. The old blockchain.info app used to take several seconds to sign transactions.
full member
Activity: 216
Merit: 100
I hate when someone out to make a $ releases the same thing... Except closed source.

http://www.coindesk.com/coc-ios-bitcoin-wallet-apple/

I won't be making much progress for the next two weeks - vacation / roadtripping the US.

Anything Bitcoin-related going on in Vegas, Dallas or New Orleans the next few weeks?
full member
Activity: 216
Merit: 100
Quote from: Niklas Therning
Documentation is lacking at the moment I'm afraid. You could probably write your UI in ObjC and call into the Java code using JNI. Did you check out j2objc? It's more suited to this kind of requirements I think.
https://groups.google.com/forum/?nomobile=true#!topic/robovm/WJp-5byuNPs

That was a bit of a surprise... I will give j2objC a try but I'm pretty sure I'll run into some difficult problems with all the dependencies (+maven).
legendary
Activity: 1526
Merit: 1134
Yes, things do change. Opinions and decisions can change very fast. Having a wallet around can act like a forcing function anyway - if things do change inside Apple but there's no wallet that can force them to re-evaluate, we might never find out.
full member
Activity: 216
Merit: 100
Hive developer here. I've been thinking about this, but mostly as something for the future, since I think Apple isn't letting wallets back into the App Store anytime soon...

Java dependency is obviously a problem. I found an article comparing some Java-to-iOS tools, but I haven't tried any of these myself: http://www.javaworld.com/article/2078740/java-ios-developer/open-source-java-ios-tools-compared.html

I also found this lib linked on Reddit last week: https://github.com/oleganza/CoreBitcoin - looks promising, but probably not even close to bitcoinj's maturity and stability...

I've stumbled on that article as well but I agree with Mike that RoboVM is the obvious choice since it's gone through some serious development since the article. It compiles perfectly and the only exceptions I've encountered were due to my own bad UI code.

I haven't checked out the CoreBitcoin lib though - I take a look later today.

I also doubt Apple will accept wallets any time soon but considering how they suddenly decided to allow real money poker apps (like Pokerstars.com) who knows.

My main reason for trying this is for the millions of nerdy jailbreakers out there - if Apple opens up later then something will be ready and hopefully stable. The adoption potential is huge even when sticking to Cydia distribution.
full member
Activity: 145
Merit: 100
┗(°0°)┛
Hive developer here. I've been thinking about this, but mostly as something for the future, since I think Apple isn't letting wallets back into the App Store anytime soon...

Java dependency is obviously a problem. I found an article comparing some Java-to-iOS tools, but I haven't tried any of these myself: http://www.javaworld.com/article/2078740/java-ios-developer/open-source-java-ios-tools-compared.html

I also found this lib linked on Reddit last week: https://github.com/oleganza/CoreBitcoin - looks promising, but probably not even close to bitcoinj's maturity and stability...
legendary
Activity: 1526
Merit: 1134
Sure. And if you make a great GUI then it may inspire other people to help you.
full member
Activity: 216
Merit: 100
Thank you so much!

This project is starting to reach well beyond my skill level on both the objC side and the Java side but a project you really want to succeed seems like a good way to learn Smiley

I suppose a simplified process flow will be something like:

1) "Shell" boots up, updates the blockchain, fetches all needed data for the UI, simple "loading..." message etc
2) "Shell" starts the objC UI and feeds it initial data
3) User interaction that requires BitcoinJ (transactions etc.) returns to the Java side and runs transaction logic etc and sends output to the UI (or fails)

For now I think I'll work on prototyping the UI and hopefully I'll figure out how to glue it all together when Niklas Therning has some working examples.
legendary
Activity: 1526
Merit: 1134
Judging from the RoboVM source, if you can call into Objective-C then you should be able to provide callbacks. Obviously this must be possible, otherwise how would the UIKit bindings work?

https://github.com/robovm/robovm/blob/master/cocoatouch/src/main/java/org/robovm/cocoatouch/uikit/UIActivity.java

From this thread, I see that the devs are working on radically simplifying the boilerplate needed to bind:

https://groups.google.com/forum/m/#!topic/robovm/3ApzrPuQh4M

The new syntax looks a LOT simpler! In particular, note that you can call into Objective-C and pass blocks. So, you would:

1) Have the "shell" be in Java as I guess that's what RoboVM makes easiest. The shell would use WalletAppKit to configure and start up bitcoinj.

2) After that, or in parallel, construct an Objective-C class representing your application GUI. Call methods on it (or set properties) passing blocks into the Obj-C side that it can use to control bitcoinj.

3) Once the UI has all the callbacks it needs, call into a app.run() type method on the Obj-C side, and at that point the Obj-C code takes over and sets up and starts handling the GUI. Button event handlers and the like use the blocks provided earlier to pass control back into Java.

Now, the latest on that thread (from yesterday) is that it doesn't seem to be working yet, though the dev said he wanted to have something by next week. So you could jump on that thread and express your interest along with your use case.

At any rate, it looks like RoboVM is definitely the way to go: it seems to be actively developed and they're making the Java/Obj-C interop a lot cleaner and work better.

For now if you don't want to wait for the auto-binding stuff there's another way. Create two Objective-C (or maybe just plain C?) functions. Init bitcoinj on the Java side as before, then create a Java thread that calls the first GetCommand C function. On the native side, block the thread on a command queue of some kind (i.e. the iOS equivalent of a LinkedBlockingQueue). When it pops something off the queue, it's returned into the Java side as a byte array or struct that represents the "command". The command thread reads the command, converts it into Java calls and manually handles the marshalling back and forth. Once that thread is spun up, call into the second Objective-C function to pass control on the main thread to the native side: this function will return only when the app is about to quit.

In your position I would wait and see what the RoboVM guys come up with. Having their magic compiler generate the marshalling glue for you would be a lot more convenient and result in cleaner code. Whilst you're waiting, you could just mock out a bitcoinj adapter class on the Objective-C side and start work designing your UI.
full member
Activity: 216
Merit: 100
The Hive guys have managed to bridge it. From the Java side you should be able to call into Obj-C to update the GUI. For calling back, not sure how it works.

Yeah, that's my problem at the moment.. I've asked in the RoboVM group. It not too hard to call into objC archive files (.a) but doing the reverse doesn't seem possible. Or maybe I just can't wrap my head around the bridging right.

Here's my(unanswered) question on the RoboVM group: https://groups.google.com/forum/m/#!topic/robovm/WJp-5byuNPs

I've gone as far as considering to compile BitcoinJ as a standalone CLI and interfacing with it that way :/
legendary
Activity: 1526
Merit: 1134
The Hive guys have managed to bridge it. From the Java side you should be able to call into Obj-C to update the GUI. For calling back, not sure how it works.
full member
Activity: 216
Merit: 100
I think Apple's ban on Bitcoin clients in their app makes more people to jailbrake thier iPhone as I did to mine.

Indeed - and hopefully a native client might drag some of the millions of jailbreakers into Bitcoin.

Today I successfully ran the forwardingservice example, downloaded the blockchain etc.

Next step: A viable GUI strategy - it seems writing the GUI logic in objC might be harder than I thought.
full member
Activity: 150
Merit: 100
I think Apple's ban on Bitcoin clients in their app makes more people to jailbrake thier iPhone as I did to mine.
full member
Activity: 216
Merit: 100
Successfully compiled and ran "ForwardingService" on the iOS Simulator and got usage text.

Next step: Giving it some arguments...
full member
Activity: 216
Merit: 100
Great. Like I said, RoboVM seems like the more mature/well tested solution for iOS at this point.

It has an Objective-C bridge layer, so you can code the UI in Objective-C if you prefer.

RoboVM actually looks a lot easier to work with compared to what I was expecting. j2ObjC looks like it can get the job done too, but RoboVM is the obvious choice for now.

I'll absolutely be coding the UI using the native tools in Xcode - that'll make it easier to make the app universal. I hate looking at apps designed for a 4" screen on tablets so I'll try not to make that mistake again.

Thanks again for the tip about RoboVM - hopefully it'll have me running a java "hello world" on the iOS simulator by tomorrow.
legendary
Activity: 1526
Merit: 1134
Great. Like I said, RoboVM seems like the more mature/well tested solution for iOS at this point.

It has an Objective-C bridge layer, so you can code the UI in Objective-C if you prefer.
full member
Activity: 216
Merit: 100
Thank you so much for the reply.
The jailbreaker community might be small - but compared to Bitcoin it's HUGE Smiley

I'll do what I can to transpile it myself though I doubt I'll succeed on my own. I'll let it be my second pet project for a month or two and hopefully I'll stumble on something.

Please let me know if you (or anyone watching) get into it again,

Thanks,

Anders
Pages:
Jump to: