First Smart Contract

Building your first smart contract

#include <eosio/eosio.hpp>
#include <eosio/name.hpp>

class [[eosio::contract]] hello : public eosio::contract {
      using eosio::contract::contract;

      void hi(eosio::name nm) {
         eosio::print_f("Hello, %\n", nm);
  • Navigate to the hello folder in examples (./examples/hello).
  • You should then see the hello.cpp file
  • Now run the compiler
$ eosio-cpp -abigen hello.cpp -o hello.wasm
  • Or with CMake
$ mkdir build
$ cd build
$ cmake ..
$ make

This will generate two files:

  • The compiled binary wasm (hello.wasm)
  • The generated ABI file (hello.abi)