Blockchain Development: How to Write an EOS Hello World Smart Contract

0

If you’re not familiar with EOS, it’s a smart contract platform similar to Ethereum.  In this tutorial we’ll be deploying a hello world smart contract to your own local EOS test net. To follow along with the video below, you’ll need to have the EOS software installed, which can be done by following this link. Currently, only releases for Linux and Mac are available (sorry Windows users!).

To start EOS blockchain development, you will need:

nodeos — The EOS node software to run your own node and create your test net. A node plays a key role in connecting to and interacting with the EOSIO network (main net), or in this case, your own private testnet for development purposes.

cleos — The EOS command-line utility you will use to create/manage your EOS account and deploy your smart contract.

eosiocpp — A command-line utility to compile your smart contract down to Web Assembly (WASM).

If you are using Ubuntu 16.04 or higher, Fedora 27, macOS Mojave, or macOS High Sierra, you won’t have to build EOSIO from source. If you don’t: clone the EOS repository with Git and run the eosio_build.sh and then eosio_install.sh shell scripts at a command prompt. The resulting installation will provide nodeos and cleos.

After the EOS installation is complete, you should be able to run your own node using the command below:

nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::wallet_api_plugin --delete-all-blocks --contracts-console

The ‘-e’ argument instructs it to enable block production even if the chain is stale, and the ‘-p’ refers to the producer name.

When your local node is working (you’ll see what to expect when your node is running in the video below), go here to download the EOS contract development toolkit (CDT). This will give you access to the command line tool eosio-cpp which is what you’ll use to deploy your smart contract to the blockchain (see the comptract.sh script in the video below).

When you’re done with all the prerequisite set up, you’ll be ready to follow along with the video!