-
Notifications
You must be signed in to change notification settings - Fork 354
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
Wasm compatible Database for bdk #450
Comments
I haven't tried implementing it yet, but I think the main issue is gonna be the fact that basically all JS APIs are async. And it's not just the fact that they are async, which can be worked around by waiting on the future: some APIs use callbacks to return the data, which probably makes it even trickier to implement. If I had to pick one method I would go for the one that has the easiest API to integrate: ideally something synchronous, or slightly worse something that uses Maybe before trying to write my own DB I would try to look for alternatives around, see if somebody has already made some kind of wrapper for the raw browser APIs and try to use those. |
Some recommended user friendly DB libraries built on IndexedDB are mentioned here: |
I can see this Another possibility is use localStorage through gloo-storage. We can save and retrieve any serializable object and it's in rust yet. Do you think it can be a good idea? |
Interfacing with JS library is not that easy, so I would just use |
Do you think it would be something interesting for the project, then? To have a database based on gloo_storage. |
I don't have much experience with rust wasm and haven't used any rust wasm storage crates but it looks like |
I implemented this using This however may not be entirely suitable for production we have found. Any read/write to the database and halt the thread and cause your browser to be slow. If we had an asynchronous database it would much better because we could use |
Thank for upstreaming your wasm storage work with #789 ! I hate to pin all our hopes on it but decoupling blockchain updates and database updates so they can run async I believe is one of the goal of the |
yeah I think that would be exactly good for this situation. in the meantime going to try and use the memory db + a method for "syncing" the memory db to indexed db asynchronously |
Hi, i find that i need to have a database on wasm and i think i'm not the first nor the last. I'm currently working in the browser and it's all great with bdk but it's very cumbersome for the (future) users to wait for the synchronization every time.
So i think in two options:
I really need this feature and I will have time for work on it, so what do you think is the best path and the requirements and niceties for this?
The text was updated successfully, but these errors were encountered: