freedomlayer / offset_mobile

Offset mobile application
https://www.offsetcredit.org
GNU Affero General Public License v3.0
9 stars 1 forks source link

iOS app? #15

Open philip-wernersbach opened 4 years ago

philip-wernersbach commented 4 years ago

I discovered offsetcredit via Hacker News. This solves a real need for me and my group of friends, who have an informal system of trading IOUs, which quickly gets complicated fast.

The only problem is I have an iPhone, and offsetcredit has no advertised iOS app or web app.

Is there an iOS app in development? If not, how can I get involved in making one? I have made small iOS apps in the past.

Agnohendrix commented 4 years ago

As long as the app is created using Flutter i guess it will work on iOS devices. You can follow this guide to install Flutter and then build and install the app. Otherwise you can wait for official news or releases.

philip-wernersbach commented 4 years ago

I followed the steps in the link, and when running flutter run on the latest offset_mobile revision, I get many build errors: https://gist.github.com/philip-wernersbach/a7e386ba0433e77bfc934cab25f248c9

Is this a known issue?

realcr commented 4 years ago

Hi @philip-wernersbach, thanks for opening this issue. For me the most important bit of information here is that Offset solves a real world issue for you.

About the ios app: I have no experience at all with making ios apps, and have no Apple devices myself at home, so I don't have any way to check compilation for iphone, but I will be happy to make this app run on ios. Theoretically, we are using Flutter, which should be cross platform, so maybe this should work.

There are some issues though. First thing to check is this issue: https://github.com/freedomlayer/offset_mobile/issues/13 by @bltavares

The most important obstacle to making the Offset app work on ios is how to run the stcompact binary. On android we can just chmod and run it using dart's Process.run. You can see the relevant code part here: https://github.com/freedomlayer/offset_mobile/blob/master/lib/process.dart#L61 According to @bltavares doing the same on ios might not work, but I have no equipment to check this at this point in time.

Thanks to @kamyuentse stcompact already compiles and runs on macOS.

About the errors you shown above: you are getting those errors because you are skipping the build_runner step. To compile the project, I recommend to run tool/presubmit

I am very interested to know about your progress with this. Please tell me if you hit any issues that I might be able to help with.

philip-wernersbach commented 4 years ago

Thanks everyone. Offset only provides benefits if you can create a network effect in your circle of peers. IOUs are only useful if you have people to trade them with. Because of this, I think creating a functioning iOS app is essential for Offset adoption.

I ran tool/presubmit, which got rid of the compile errors. The app immediately crashed when trying to start the stcompact process, because I don't have stcompact compiled for iOS, and because executing external binaries is not supported in iOS apps.

I was able to get Offset running on the iOS simulator by removing all of the code that handles stcompact I/O: https://gist.github.com/philip-wernersbach/9bc5eee1d68d4d0ef16e9202789bd7c5. I verified that the app's logic works in iOS!

The next step here is to create a functional stcompact-Flutter FFI integration, per #13. Fortunately, since the code exchanges messages with stcompact via stdin/stdout, a simple integration is possible. The simplest integration would be to wrap stcompact's stdin/stdout code, redirect the stdin reads and stdout writes to in-memory buffers, and then create a C ABI function in Rust that allows Flutter to read and write the buffers.

Unfortunately, I don't know Rust. @realcr, are you interested in implementing the Rust portions of this?

philip-wernersbach commented 4 years ago

stcompact-Flutter FFI would work on both Android and iOS, so we would not need to maintain the existing stdin/stdout message passing code.

realcr commented 4 years ago

I am interested in implementing this, but it might take me a while. I don't have any experience with implementing this kind of FFI, and have no ios devices to test if it works at this point. I am busy at the moment at the core protocol parts of the project, hope to be able to get to this issue soon.

philip-wernersbach commented 4 years ago

Great! Let me know if you need help with the FFI layer. I’ve worked on a lot of Nim language projects that use FFI with C, so I can lend some non-Rust lang assistance.

dsernst commented 3 years ago

Hi— I'm interested in this as well, and can contribute code to help. I have a lot of experience with shipping Typescript / React-native codebases for iOS, but happy to help in other languages where possible.

Is the offset algorithm itself written out in pseudocode / some reference source, so it can be evaluated independently?

realcr commented 3 years ago

@dsernst : Hey, thanks for the willingness to help! I recommend against working on the frontend part of Offset at this time, because right now work is being done on the new Offset protocol. This means breaking changes to the API. I will be sure to tell you when there is a more stable core protocol and API.

Is the offset algorithm itself written out in pseudocode / some reference source, so it can be evaluated independently?

The old protocol is roughly documented here: https://docs.offsetcredit.org/en/latest/theory/mutual_credit_protocol.html I hope to write an even more detailed description for the new protocol. In the current implementation, the Offset mobile app is written in Flutter (Dart), but it is merely used as a UI wrapper around the internal binary, called stcompact, as mentioned in the comments above.

When there is a more stable API I will get to work on externing a reasonable FFI layer, so that anyone can write a mobile application around it.