Currently I've written a rust program to print "5" and converted the same into wasm using the the rust tool (target add wasm32-unknown-unknown). I want this wasm to be executed on the local blockchain as a basic contract. I've create account and trying to execute the contract specifying the .wast file. (I manually converted wasm to wast) but I have not Idea how can I create ABI (application binary interface) required by EOSIO to run the contract on the blockchain. Please help.

Here is the exact code: rustup install nightly rustup default nightly rustup target add wasm32-unknown-unknown cargo install -f cargo-web

switch to EOS directory.


Create new Cargo Project:

$ cargo new eos

Modify the Cargo.toml contents with the following:

name = "eos"
version = "0.1.0"
authors = ["[email protected]"]
path = "src/lib.rs"
crate-type = ["cdylib"]

Create another file src/lib.rs and put the following content:


use core::panic::PanicInfo;

extern "C" {
    fn printi(c: u64);
pub extern "C" fn init() {
    unsafe { printi(5); }
pub extern "C" fn apply(_: u64, _: u64) {}
fn panic(pi: &PanicInfo) -> ! {

Once the source is ready, do: cargo +nightly build --target wasm32-unknown-unknown --release

Also, I've followed this blogenter link description here for rust reference.


1 Answer 1


There are currently no recommended tools for generating ABI automatically. However, there's an article in the documentation about how to write an ABI file yourself.

From the article:

As of v1.2.0, the eosio.wasmsdk was decoupled from the core repository. This change has introduced an eosiocpp regression where the legacy eosio-abigen is no longer bundled with eosio-cpp. Until a new ABI generator is introduced, you will need to hand-write your ABI files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.