Bible Pay

Read 6923 times

  • Rob Andrews
  • Administrator

    • 4090


    • 97
    • June 05, 2017, 08:09:04 PM
    • Patmos, Island Of
    more
MAC home PC biblepaycore Wallet - 3.5 Million BBP
« on: April 28, 2021, 01:27:53 PM »
Hi everyone--

This bounty is for an enhancement to the MAC OSX biblepaycore home wallet.

The github source for the program is here:
https://github.com/biblepay/biblepay
(See our mainnet branch, building for MAC OSX).

Note that we have RandomX as our mining algorithm, so we differ from bitcoin in that respect.
See the specific section in our Build BiblePay doc on how to compile RandomX on the MAC:
https://github.com/biblepay/biblepay/blob/master/BuildBiblePay.txt


So for a long time we were able to build the MAC version with RandomX support, and release this finished build as a DMG file.
However recently we started running into some new troubles.  We can still Compile our code for mac, and run it without a problem, however, when we build our DMG, and the user runs this as an official DMG:  They can do most things like load the wallet, see the overview page in QT, and sync up to a certain block number.

We notarize the file and set up the DMG (as an apple developer) so that the DMG is approved by gatekeeper to run it (it runs as an authorized dmg file).

But the specific problem is when RandomX hash library is called for certain hashes, a memory access violation occurs in the MAC OS, and it bubbles up to the user and crashes the program.  (Specifics:  This crash did not occur until approx Feb 2021, after some apple updates to MAC OS that made it more strict!).

Our mac developer, MIP can provide more information on this - please ask us more questions.  When we run the DMG in jailbroken mode (with gatekeeper disabled), no crash occurs during any hashing and the whole wallet works.

So I believe his opinion is that MAC is protecting a certain area of memory.

Now the randomx virtual machine executes machine language specifically for the hash, so it needs unprotected access to a chunk of RAM.

MIP has tried setting the compile flags that make the librandomx.a file statically linked, and he set the flag to allow full access to the RAM but his particular flag did not work (I believe he is not completely sure if this option was passed in 100% correctly or if the dmg honors it or not). 

If we have an expert out there that would like to take this on we would appreciate it so that we can have our home MAC-OS wallet run without disabling gatekeeper!

Thank you in advance.


BOUNTY OFFER:
See Subject line for amount






« Last Edit: May 11, 2021, 08:14:17 AM by Rob Andrews »


  • sunk818
  • Global Moderator

    • 521


    • 36
    • April 24, 2018, 02:02:20 PM
    more
Re: MAC home PC biblepaycore Wallet - 3 Million BBP
« Reply #1 on: April 29, 2021, 12:46:22 AM »
This person said they were able to build an unofficial build of xmrig on macOS
https://github.com/mydicebot/xmrig-macos-build


And some alternative steps for Apple on xmrig:
https://xmrig.com/docs/miner/build/macos


Not that the wallet miner is xmrig, but I thought it might help with the flags or parameters.
« Last Edit: April 29, 2021, 12:48:30 AM by sunk818 »
BH6oxjLkyz3z8FYpvU3ZR7PTZ31Xt9DkXZ


  • MIP
  • Sr. Member

    • 365


    • 47
    • February 13, 2018, 11:55:52 AM
    more
Re: MAC home PC biblepaycore Wallet - 3 Million BBP
« Reply #2 on: April 29, 2021, 05:32:55 AM »
Thanks Sun I will check the links.

It is not a problem of compiling Biblepay for Mac, which is working right now and allows you to execute the client in your device, but the process of running it from a signed DMG.

Those DMGs run under a hardened environment that does not allow the library librandomx to create the internal VM required to generate RandomX hashes.

But if you self compile the binary and run it from terminal the environment is more relaxed and the librandomx GetHash function is allowed to function without restrictions.


  • MIP
  • Sr. Member

    • 365


    • 47
    • February 13, 2018, 11:55:52 AM
    more
Re: MAC home PC biblepaycore Wallet - 3 Million BBP
« Reply #3 on: April 29, 2021, 05:37:07 AM »
My best guess so far is to compile librandomx as Mac dynamic library (.dy file) and not statically into the wallet as now.

Then pack and sign both Biblepay and library binaries in the same DMG file and expect this is permitted by the hardened environment.

This is where my current research is now.


  • Rob Andrews
  • Administrator

    • 4090


    • 97
    • June 05, 2017, 08:09:04 PM
    • Patmos, Island Of
    more
Re: MAC home PC biblepaycore Wallet - 3 Million BBP
« Reply #4 on: May 02, 2021, 10:32:54 AM »
My best guess so far is to compile librandomx as Mac dynamic library (.dy file) and not statically into the wallet as now.

Then pack and sign both Biblepay and library binaries in the same DMG file and expect this is permitted by the hardened environment.

This is where my current research is now.
Sweet, Im glad you have another 'nugget' to look at that might work also before we raise the bounty even higher.

I also wanted to mention, I think from my perspective, as I really want to see a non-jailbroken DMG by the time Harvest is released, which is due out July 2021, Ill add a todo item to make the mac wallet work without RandomX in Harvest if we start to approach the June deadline and we can release harvest without RandomX, then increase the bounty even higher to get Harvest fixed.  As we spoke of on our weekly call.  And at that point it will "function" as an SPV wallet mostly (since our mac base is small enough to not pose any block security threat) although at that point I think we should still ramp up the efforts to fix the problem and not leave our Mac community out with an SPV wallet  :) as a long term solution but just for a temporary fix etc.



  • Rob Andrews
  • Administrator

    • 4090


    • 97
    • June 05, 2017, 08:09:04 PM
    • Patmos, Island Of
    more
Re: MAC home PC biblepaycore Wallet - 3 Million BBP
« Reply #5 on: May 11, 2021, 08:15:16 AM »
My best guess so far is to compile librandomx as Mac dynamic library (.dy file) and not statically into the wallet as now.

Then pack and sign both Biblepay and library binaries in the same DMG file and expect this is permitted by the hardened environment.

This is where my current research is now.

Have you had a chance to debug further?

In the mean time, I am increasing the bounty to 3.5 MM.




  • Rob Andrews
  • Administrator

    • 4090


    • 97
    • June 05, 2017, 08:09:04 PM
    • Patmos, Island Of
    more
Re: MAC home PC biblepaycore Wallet - 3.5 Million BBP
« Reply #6 on: June 28, 2021, 03:35:03 PM »
I have removed RandomX from the MAC wallet, so this should resolve the problem.

Now when we notarize the code it should not step into unsafe code.