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

[FR]: Add capability to target building a WASM library from cardano-ledger #4806

Open
stevenj opened this issue Dec 18, 2024 · 1 comment
Open

Comments

@stevenj
Copy link

stevenj commented Dec 18, 2024

It's difficult to use cardano-ledger as a library from languages other than Haskell.
It could be done via FFI, but that also has its challenges.

This feature request is to add a supported webasm library target for cardano-ledger.
This would allow any language that has a wasm runtime to load the ledger and use it as a library, without requiring FFI bindings.
I believe it would improve the re-usability of the core ledger.

If possible, it would be even better if the library supported the wasm component model: https://component-model.bytecodealliance.org/
As this would allow cardano-ledger wit files to universally define the interface to the library, for easy machine generated interfacing with other languages, and lower overall maintenance. This would also help track any breaking changes in the library interface, as the wit interface would change, and this would help prevent consuming projects using incompatible versions of the library.

@stevenj stevenj changed the title Feature Request: Add capability to target building a WASM library for cardano-ledger Feature Request: Add capability to target building a WASM library from cardano-ledger Dec 18, 2024
@stevenj stevenj changed the title Feature Request: Add capability to target building a WASM library from cardano-ledger [FR]: Add capability to target building a WASM library from cardano-ledger Dec 18, 2024
@lehins
Copy link
Collaborator

lehins commented Dec 18, 2024

There is a WASM backend in GHC, so it is theoretically possible to target WAS when compiling ledger, I suspect. There was an issue with template-haskell and the fact that Plutus libraries, which Ledger depends on, use quite a bit of it. WASM backend historically did not support template-haskell, which would have prevented us from targeting WASM. However, the most recent release of ghc-9.12.1, that happened two days ago, now has support for template-haskell when targeting WASM.

So, this means that people should be able to compile Ledger as a library into WASM. I am far from an expert on this topic, since I try to stay away from web development as possible. But, if there is real desire for this feature and it gets approved by Intersect, then I am all in favor of trying to figure it out.

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

2 participants