WebAssembly Virtual Machine written in Elixir. Currently used as the Wasm VM in the Elixium Network
{:ok, ref} = AlchemyVM.start() # Start AlchemyVM
AlchemyVM.load_file(ref, "path/to/wasm/file.wasm") # Load a module
AlchemyVM.execute(ref, "some_exported_function") # Call a function
# => {:ok, total_gas_cost, :function_return_value}
For Gas Limit use:
AlchemyVM.execute(ref, "some_exported_function", [:gas_limt, 100])
For Trace use:
AlchemyVM.execute(ref, "some_exported_function", [:trace, true])
For Trace & gas limit use:
AlchemyVM.execute(ref, "some_exported_function", [gas_limit: 100, trace: true])
More detailed usage instructions can be found on HexDocs.
Add alchemy_vm
to your list of dependencies in mix.exs
:
def deps do
[
{:alchemy_vm, "~> 0.7"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/wasp_vm.