-
Notifications
You must be signed in to change notification settings - Fork 24
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
ABI generation using wasmer #7
Comments
@AchalaSB thanks for reporting an issue! This project is a little different because we embed the wasmer runtime in a rust project. This is similar to the wasmer command line tool, except we do a few extra things that The wasm code that you run depends on a set of imports as explained in that error message:
This means that the WebAssembly is looking for an imported function called "print_str". These imports are like what we are calling an "ABI". The imports are simply a set of functions made available to the wasm code. This allows wasm to call those imported functions e.g. calling the This code can only work if wasmer runtime imports those functions. The This git repository contains two crates: the binary crate that loads webassembly with imports, and the a crate that builds webassembly file. Both are required.
Wasmer can support any rust code that the ABIs it supports allows. The wasm32-unknown-unknown target produces wasm with No ABI. This means it imports no additional functions from the environment. This means one can't build projects that do things like talk to the file system or make network calls. If one builds for the other ABIs like Emscripten or WASI, they will get more capabilities like use the file system or talk to the internet.
Absolutely! |
@xmclark Thanks for reverting.
My question is can we get a seperate ABI files (usually in .json format) so that we can use it for transaction. ( reffereing to ethereum where bytecode and ABI are required for transaction) Since you said we can use wasmer in blockchain. Need to know how can we use ? How the transaction happens? |
This repository has a cargo project which instantiates the wasmer runtime with those specific imports. If you want to import more functions (a different ABI), then you will need to pass more imports to the runtime. You can see how we create the imports in this bit of rust code: The
That is a cool feature request. Wasmer runtime does not use JSON to share and create imports. Are you interested in using custom ABIs to share native code (e.g. Rust or C++ code) with wasmer runtime? If you know that you will always import the same ABI, then you may not need JSON to help you do that. If you do have dynamic requirements, then you will need to build a dynamic import system on top of wasmer. This is the point I was alluding to earlier. The wasmer project does not support this kind of dynamic importing behavior yet. A few people in the community have explored how to make a plugin system with Wasmer.
There is no legal issue using wasmer in a blockchain application. Wasmer has an open source license. Wasmer is being used in other blockchain applications today. You may fork this repository and use it as starting point for your block chain application, if your block chain app is written in Rust. The implementation will be very similar. Wasmer also supports interoping with other languages like C/C++, PHP, Python, and recently Ruby. I recommend you report an issue on the wasmer repository with more specific questions about blockchain related features. A feature you may be interested in asking about is deterministic metering. |
How can we generate ABI using wasmer for rust lang code? Is it possible now? If yes what are the steps to generate ABI?
This blog https://medium.com/wasmer/webassembly-cloudabi-b573047fd0a9 shows that wasmer is going to support CloudABI. Is it done?
Can wasmer support any rust code or is there any simantics to write code in wasmer environment?
And can we use wasmer ( the ABI generated from wasmer) in blockchain?
When I run command
wasmer run wasm-sample-app/target/wasm32-unknown-unknown/release/wasm_sample_app.wasm
i'm getting
"Can\'t instantiate module: LinkError([ImportNotFound { namespace: \"env\", name: \"print_str\" }])"
what is is issue? how to fix it?
The text was updated successfully, but these errors were encountered: