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

Proper native use of rusty kaspa wasm #1

Open
colinfran opened this issue Apr 18, 2023 · 3 comments
Open

Proper native use of rusty kaspa wasm #1

colinfran opened this issue Apr 18, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@colinfran
Copy link
Owner

colinfran commented Apr 18, 2023

With the release of rusty kaspa comes its compiled wasm library for node and for web.


Within a React Native mobile app, I am not able to natively use rusty kaspa wasm js pacakge. So that leaves us with a few options:

  1. use a node express server to securely gather wallet data and transact for users. wasm js files are ran by node server and server is able to correctly perform wallet functions for user safely and securely.
  2. Use webview in background and inject wasm js libaries (needs more research)
  3. Rewrite js libraries to work with react native.
  4. more possible solutions to be listed in the future

Currently, the best and easiest solution is option 1 which is to use a node express server, so that is what we are currently using. Note that no user or wallet data is stored on the server. Each time a user's app makes a POST request to the Server API, it will include your encrypted seed and your password, make a connection to a Kaspa node, perform the necessary function, and then close the connection.

We would like to move away from using the express server solution, so hopefully in the future, we can figure out a better solution.

@colinfran colinfran changed the title Proper use of rusty kaspa wasm Proper native use of rusty kaspa wasm Apr 18, 2023
@colinfran colinfran added enhancement New feature or request help wanted Extra attention is needed labels Apr 18, 2023
@colinfran colinfran moved this to Todo in kwallet Apr 18, 2023
@colinfran
Copy link
Owner Author

colinfran commented Apr 30, 2023

this looks something that might be worth looking into https://www.npmjs.com/package/node-libs-react-native

when I tried to previously install the wasm js packages into this react native app, I was hoping to use the browser-based wallet package it has. But when trying to run the wasm js packages in react native, the wasm code for node (instead of the browser) would try to run. It errors on certain code where it expects node-based-packages to be available (ie "path", "assert"). This package could potentially help with this.

@colinfran
Copy link
Owner Author

Additional possible solutions:

@colinfran
Copy link
Owner Author

colinfran commented Jun 16, 2023

after talking with @aspectron (https://github.com/aspectron), i have learned that both the old golang kaspa js package and the new rust kaspa js package import a web assembly file.

after learning this, I can conclude that the main issue here is that both the old and new packages are not compatible with react native.

this means that the most plausible solution right now is to implement a webview that is able to import this kaspa pacakge (with web assembly file) and communicate back to the react native app.

def huge effort for this. will add more updates as they come.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: Todo
Development

No branches or pull requests

1 participant