Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS app? #15

Open
philip-wernersbach opened this issue Jun 20, 2020 · 9 comments
Open

iOS app? #15

philip-wernersbach opened this issue Jun 20, 2020 · 9 comments

Comments

@philip-wernersbach
Copy link

philip-wernersbach commented Jun 20, 2020

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
Copy link

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
Copy link
Author

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
Copy link
Member

realcr commented Jun 22, 2020

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:
#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
Copy link
Author

philip-wernersbach commented Jun 23, 2020

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
Copy link
Author

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
Copy link
Member

realcr commented Jun 24, 2020

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
Copy link
Author

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
Copy link

dsernst commented Sep 24, 2020

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
Copy link
Member

realcr commented Sep 26, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants