Bible Pay

Read 23327 times

  • MIP
  • Sr. Member

    • 365


    • 47
    • February 13, 2018, 11:55:52 AM
    more
BiblePay mobile wallet (Android & iOS)
« on: March 29, 2018, 06:41:07 PM »
Hello all

I have been taking a deep look into Breadwallet app as a starting point for a Biblepay mobile wallet.

My conclusion is that it is possible to have it ported in a reasonable time, but it's not going to be trivial as changing some chainparams for others and get it rolling.

At first I wanted to "extend" the original app to support BTC, BCH (current Breadwallet version) and then add BBP at top.
But this is not possible now because the Breadwallet SPV client in C makes some hardwired assumptions to connect to a pure Bitcoin network.
The C library would require another abstraction layer that is not present and it's out of the scope at the moment.

The good news is that, even if only taylored for BBP, the library is used by both the Android and iOS version, so this makes things a bit easier once it's working.

SCOPE OF WORK

- Biblepay Mobile Wallet (Android and iOS) will be a fork of the respective BreadWallet apps.
Please bear in mind that it's a wallet based on a 12-word BIP39 Multibit HD, PIN protected brain wallet with a "safety-first" approach.
This means that it will not be possible to export its private keys, and it will not be able to import other wallets priv keys (although it will be able to sweep a priv key paper wallet balance)
Please read about BreadWallet app features to avoid confusions and misunderstandings.

https://www.cryptocompare.com/wallets/bread-wallet/

For me this is the absolutely right approach for a secure mobile online wallet, and changing this behavior for a more insecure one is out of the discussion.

- Wallet will be able to do exactly the same you can do with the original BreadWallet BTC/BCH wallet, feature wise, except buying and selling currency for fiat (external services are required for that).
- Wallet will NOT implement InstantSend or other Masternode-related protocol features at this stage.
- We will start with Android version first, and later on with the iOS one.

TASK BREAKDOWN

Android
- Fork breadwallet android and core submodule and setup dev environment (2h).
- Create BiblepayWallet java and C layer (chain params and basic behavior) (4h)
- Remove BTC/BCH wallet, change hardwired stuff (address prefixes, max difficulty, pow retarget interval...) (16h)
- Implement BBP Pow verification, block validation (20h).
- Other integrations (price, fee-per-kb?...) (8h)
- Basic testing (send/receive/sweep) (8h).
- Test camera reading addresses (4h).
- Publish app in Google Play (4h)

iOS
- Fork breadwallet iOS and setup dev environment (2h).
- Create XCode developer account and prepare a Macincloud virtual machine. (2h)
- Create BiblepayWallet iOS layer (chain params and basic behavior) (8h)
- Basic testing (send/receive/sweep) (8h).
- Test camera reading addresses (2h).
- Apple Dev paperwork, submitting app for approval, publish in App Store... (6h)

Total Budget:
66h Android + Breadwallet-Core @40€/h = 2640€
28h iOS     x 40€/h = 1120€
24€ Google Play license lic
44€ Macincloud VM (2 months)
99€ iOS developer license
= 3927€ = 0,704 BTC (@ 5575€) = 2348000 BBP (@30 sat)

I've been working hard for a week (I'm on holidays LoL) and here you are some teaser screenshots.

Home screen after creating the brain wallet:


Price showing is BTC a couple of days ago... we will have to create our own price API (perhaps taken from pool.biblepay.org)

Some activity log from the SPV client chatting with the peers...


Also, say "hello" to the first transaction received on our mobile wallet!
http://explorer.biblepay.org:3001/tx/a8af5365741aee8c7d8ed3d7b3c3c332c7eba5701e0c06a742780495e809f107

Breadwallet address:
http://explorer.biblepay.org:3001/address/BQWEt4Fj4gbn3jAqU5zueNV9jH8EvZDGj6



I will post more info as I make more progress. Please don't hesitate to ask whatever you may want.
« Last Edit: March 29, 2018, 06:46:41 PM by MIP »


  • T-Mike
  • Sr. Member

    • 375


    • 2
    • February 06, 2018, 06:12:58 PM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #1 on: March 29, 2018, 07:05:16 PM »
Cool man, keep up the good work.


  • Cryptoshot
  • Newbie

    • 32


    • 3
    • February 18, 2018, 03:19:44 PM
    • Ghana
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #2 on: March 30, 2018, 02:43:39 AM »
This is great, please keep the effort rolling, it will be more than necessary for this Android version wallet to be in use.


  • jaapgvk
  • Hero Member

    • 558


    • 31
    • September 01, 2017, 08:02:57 PM
    • Netherlands
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #3 on: March 30, 2018, 05:20:00 AM »
I'm so excited about this!  :D :D


  • Rob Andrews
  • Administrator

    • 4090


    • 97
    • June 05, 2017, 08:09:04 PM
    • Patmos, Island Of
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #4 on: March 30, 2018, 09:48:50 AM »
This is really exciting, and extremely worth it.

Thats probably fine if we dont have instantsend, even for a couple years.
I assume even though the wallet keys are stored in a proprietary format, you can send BBP from your pc to your phone and from phone to PC and empty wallet out that way correct?  (sounds like a dumb question lol).  So if I had an email on the android, could I copy the bbp address to the clipboard and paste it into the breadwallet to send BBP to someone random? 

On this item:
 Create BiblepayWallet java and C layer (chain params and basic behavior)

I was wondering, do we need to modify the core (the biblepay-qt) client at all, or what is the c layer you are modifying is this on the breadwallet side or on the core side?  Is breadwallet entirely java based?  If on the corewallet side, have you already forked biblepay and modified your version locally to handle the call, and that is how you got it running?

On block storage, how does the wallet on the android store the blocks?

Thanks a million for your efforts, they are astounding!





  • MIP
  • Sr. Member

    • 365


    • 47
    • February 13, 2018, 11:55:52 AM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #5 on: March 30, 2018, 12:16:16 PM »
I assume even though the wallet keys are stored in a proprietary format, you can send BBP from your pc to your phone and from phone to PC and empty wallet out that way correct?  (sounds like a dumb question lol).  So if I had an email on the android, could I copy the bbp address to the clipboard and paste it into the breadwallet to send BBP to someone random? 

Sure you can. Take a look at the interface, it's pretty cool!



Then you can click on the amount and a num pad shows.



What you can't do is export the mobile wallet private keys and take them elsewhere, nor import external private keys (although you can sweep them into the mobile wallet with QR scan)

On this item:
 Create BiblepayWallet java and C layer (chain params and basic behavior)

I was wondering, do we need to modify the core (the biblepay-qt) client at all, or what is the c layer you are modifying is this on the breadwallet side or on the core side?  Is breadwallet entirely java based?  If on the corewallet side, have you already forked biblepay and modified your version locally to handle the call, and that is how you got it running?

The C layer I mention is the SPV thin client from breadwallet. It doesn't use code from BiblePay at all (except hash functions, of course), so it acts as a whole independent BiblePay client.

https://github.com/breadwallet/breadwallet-core.

This breadwallet-core C library is then imported as Java classes using a JNI layer, and then it can be used from Android Studio. The GUI stuff, wallet management, block database,  etc. uses pure Java in Android version.
https://github.com/breadwallet/breadwallet-android

I guess that a similar setup is then applied for the iOS version, I didn't see it yet but it sounds logical. This way, the "hard" part which is the SPV client, is shared between projects.

On block storage, how does the wallet on the android store the blocks?

It uses a SQLLite database, via Java client.

On the Android x86 Emulator, with a crappy country DSL (1-10 Mbps) it takes about 1 minute to download all BBP chain headers. Very fast.

Thanks a million for your efforts, they are astounding!

The more I progress the cooler it seems.

I step upon some subtle protocol differences that are the ones that block me for a few hours, but with a bit of hex debugging I advance step by step.

Now I'm stuck sending BBP, mempool is rejecting the transaction with "error parsing message". I'll get some coffee now...
« Last Edit: March 30, 2018, 01:06:20 PM by MIP »


  • T-Mike
  • Sr. Member

    • 375


    • 2
    • February 06, 2018, 06:12:58 PM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #6 on: March 30, 2018, 02:33:16 PM »
Quick question, did you submit your proposal through the pool? I did mine manually and it's not showing up.


  • MIP
  • Sr. Member

    • 365


    • 47
    • February 13, 2018, 11:55:52 AM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #7 on: March 30, 2018, 02:54:20 PM »
Quick question, did you submit your proposal through the pool? I did mine manually and it's not showing up.

I did about 10 hours ago, and it's showing in the pool. I think it's also in the chain already.


  • T-Mike
  • Sr. Member

    • 375


    • 2
    • February 06, 2018, 06:12:58 PM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #8 on: March 30, 2018, 04:16:19 PM »
I did about 10 hours ago, and it's showing in the pool. I think it's also in the chain already.

OK thank. I made mine with cli commands and it looks like it worked and I even voted on it but it's not showing up in the pool.


  • jaapgvk
  • Hero Member

    • 558


    • 31
    • September 01, 2017, 08:02:57 PM
    • Netherlands
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #9 on: March 30, 2018, 04:33:06 PM »
OK thank. I made mine with cli commands and it looks like it worked and I even voted on it but it's not showing up in the pool.

Yeah, I voted on MIP's, but I still can't see yours... Don't know if it has anything to do with the cli-commands, I only know how to do it in the pool.

Did you also do it with cli-commands the previous time?


  • T-Mike
  • Sr. Member

    • 375


    • 2
    • February 06, 2018, 06:12:58 PM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #10 on: March 30, 2018, 04:42:30 PM »
Yeah, I voted on MIP's, but I still can't see yours... Don't know if it has anything to do with the cli-commands, I only know how to do it in the pool.

Did you also do it with cli-commands the previous time?

No, last time Togo submitted it for me because I don't have BBP in the pool.


  • Rob Andrews
  • Administrator

    • 4090


    • 97
    • June 05, 2017, 08:09:04 PM
    • Patmos, Island Of
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #11 on: March 31, 2018, 10:19:49 AM »
No, last time Togo submitted it for me because I don't have BBP in the pool.

It should have been submitted through the pool UI, not from the cli commands.  As non-devs have no idea what timestamp to use or what timestamps fall between the trigger time, and it also makes the proposal miss the necessary hashes the pool needs to create the budget.

Please enter all proposals through the pool.



  • T-Mike
  • Sr. Member

    • 375


    • 2
    • February 06, 2018, 06:12:58 PM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #12 on: March 31, 2018, 11:58:07 AM »
It should have been submitted through the pool UI, not from the cli commands.  As non-devs have no idea what timestamp to use or what timestamps fall between the trigger time, and it also makes the proposal miss the necessary hashes the pool needs to create the budget.

Please enter all proposals through the pool.

Understood but is there a way to send BBP to the pool? I don't have enough BBP on the pool.


  • MIP
  • Sr. Member

    • 365


    • 47
    • February 13, 2018, 11:55:52 AM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #13 on: March 31, 2018, 12:07:57 PM »
Understood but is there a way to send BBP to the pool? I don't have enough BBP on the pool.

I asked Rob via PM and he helped me quicky.


  • MIP
  • Sr. Member

    • 365


    • 47
    • February 13, 2018, 11:55:52 AM
    more
Re: BiblePay mobile wallet (Android & iOS)
« Reply #14 on: April 02, 2018, 06:43:54 AM »
Today is a great day!, we sent the first BBPs using a real mobile device (to be precise, my daughter's android tablet)

https://explorer.biblepay-central.org/tx/9cf80040ab44972c8968207a08d5a8573719779da1e2f1ce48ae66f3557ea8da



I was stuck for a couple of days because Breadwallet was not storing the extra message data (not present in Bitcoin original protocol). But finally after some hard debugging we made it!!

I think that the most difficult part is done. I will go on with the QR address scan and other cosmetic changes.