đŖKLY-WVM
WASM-based amazing virtual machine by KLY
Intro
KLYNTAR WVM is based on WebAssembly which allows you to write in any language, then compile it into .wasm bytecode and run it in a secure environment.
WebAssembly is secure thanks to
Lack of network access
Lack of access to the file system
Lack of access to the random number generator
Other stuff
Thus, it is possible to locally (in your development environment, if you are a developer) create compressed and compiled .wasm files, and then publish them to the KLYNTAR network for execution.
You will be able to write in any language that you know well and compile into WASM modules, as well as use advanced features such as requests to the network or external storage of big data and much more.
More about WebAssembly
Today, WebAssembly is becoming popular all over the world and in various areas - from small modules for working in the browser to cloud FaaS services and blockchains (Cosmos, Near, etc.).
Below is a list of languages that can already be used to compile to WASM and work safely on KLYNTAR symbiotes
Not all langs will be supported by KLY
WebAssembly is not exactly a language, it's more of a low-level bytecode that executes quickly and safely. For an illustrative example, we can consider the .wat file format - these are the files of the so-called WebAssemblyText. It can also be compiled to wasm and vice versa. So for example you can repeat this procedure using the tools wat2wasm (obviously .wat => .wasm) and wasm2wat (vice versa). Just the same, .wat files allow us to see WASM opcodes, understand that there is work with the stack like low-level languages, and so on. For example, here is the implementation of a simple function that takes 2 parameters and returns their sum
File add.wat
Next, we use the wat2wasm tool that comes with the wat-wasm package.
We compile (with the help of flags -O3z we compress as much as possible and carry out optimization)
And use in Node.js
This was a simple use case and you learned a little more about its format by looking at the code of the .wat file.
Of course, it is difficult to write in pure WAT and therefore you will most likely use high-level languages such as AssemblyScript (an add-on on TypeScript), Rust, C ++, Go and others.
Since there are several tools for turning source code into WASM modules, we will try to use the most popular, documented and convenient ones in order to create the best working conditions for users and developers on KLY
Links
Last updated