Quick Start

In this quick-start tutorial we will create a simple EOSIO smart contract in Rust that accepts an account name and prints a greeting message.

Create a new Rust library:

cargo new hello --lib

Edit Cargo.toml:

name = "hello"
version = "0.1.0"
edition = "2018"
publish = false

crate-type = ["cdylib"]
doc = false

eosio = { path = "../../crates/eosio" }
eosio_cdt = { path = "../../crates/eosio_cdt" }

Edit src/lib.rs:

fn hi(name: eosio::AccountName) {
    eosio_cdt::print!("Hello, ", name, "!");


Compile with the following command:

RUSTFLAGS="-C link-args=-zstack-size=48000" \
cargo build --release -target=wasm32-unknown-unknown

The smart contract should now be built at target/wasm32-unknown-unknown/release/hello.wasm


Create a new file called abi.json (in future versions this will be automatically generated):

    "version": "eosio::abi/1.0",
    "structs": [
            "name": "hi",
            "base": "",
            "fields": [
                    "name": "name",
                    "type": "name"
    "actions": [
            "name": "hi",
            "type": "hi"

Assuming you have cleos setup and have created the hello account:

cleos set abi hello abi.json
cleos set code hello target/wasm32-unknown-unknown/release/hello.wasm

Say Hello

Finally, say hello:

cleos push action hello hi '["world"]' -p 'hello@active'

If all went well you should see Hello, world in the console. Otherwise, if the transaction was sent successfully but you don't see any output, you may need to use the --contract-console option with nodeos.