ethereumjs / ultralight

Ethereum Portal Network TypeScript implementation
https://github.com/ethereum/portal-network-specs
104 stars 25 forks source link

Explore porting ultralight to mobile #139

Closed acolytec3 closed 2 years ago

acolytec3 commented 2 years ago

The current setup for the Ultralight project doesn't allow for easy usage on mobile without jumping through the same hoops as we do in the browser where an app running on mobile would have to run in a webview and maintain a websocket connection with a proxy. Since there are a variety of cross-platform mobile development frameworks out there that target Javascript development, it seems fruitful to explore adding support within the discv5 fork for one or more of these frameworks. Two candidates are:

While I personally lean towards CapacitorJS due to it enabling a broad set of webdev frameworks to be leveraged for native mobile development, React Native is surely the market leader right now in Javascript enabled mobile dev so either of these could be a good candidate.

The main task here would be to clone the existing udp transport service and integrate the native UDP plugin into its backend and then add this as a new transport option for discv5 the way that the websocket service was done.

holgerd77 commented 2 years ago

Ok, do I read this correctly that we would - at least on these platforms - reach native portal network integration without a proxy need or something? 🎉

(still scratching my head around this whole browser setup a bit)

acolytec3 commented 2 years ago

Ok, do I read this correctly that we would - at least on these platforms - reach native portal network integration without a proxy need or something? 🎉

Theoretically. I've done some mobile development in the past but never touched the networking stack before so I'm not sure how difficult it would be to integrate one of these plugins into the discv5 library. I'm partial to capacitorjs so was going to experiment with it at some point and see if the referenced plugin works well enough to warrant to effort to do the integration.

acolytec3 commented 2 years ago

179 lays the groundwork for this by adding a new transport layer for discv5 for native UDP sockets with CapacitorJS. I have a prototype of a mobile app built locally and will add it to the monorepo once the scaffolding for our rewired browser client setup is finished.

acolytec3 commented 2 years ago

I'm going to call this done for now since we have Android builds working all the way to the APK level with #184 and iOS building and running on the iOS emulator from #190.