WAX Hello World Contract
Ivan Montiel
Posted on July 25, 2023
Introduction
In this section, we will go over using the tools we covered in the previous sections to create a new Smart Contract, and compile it.
Connecting to Docker
We previously created a Docker container. If you have been following along, you may already have a terminal that is connected to your environment. If not, let’s sh
into the Docker container as we did before:
docker run -it --name wax-tutorial--publish 8888:8888 -v $(pwd):/wax waxteam/dev bash
Creating a WAX project
Now that we are in the container, we can create a new project. We’ll call this one hello-world:
cd wax # This is the folder mount point we specified in the above commands
eosio-init -project helloworld
The three important files here are:
-
helloworld/include/helloworld.hpp
- contains the definitions for our contract -
helloworld/src/helloworld.cpp
- contains the implementation of our contract -
helloworld/ricardian/helloworld.contracts.md
- contains the Ricardian contract - human readable version of the methods our contract exposes to the world
Compiling the project
Let’s ensure that our environment is setup correctly by compiling this Smart Contract. Typically, I will use a one-liner to compile since we need to change directories to compile the code:
( cd helloworld/build ; cmake .. ; make )
When this command completes, you will have successfully compiled the contract!
We won’t bother publishing this contract since it doesn’t do much, but now we are ready to get into the details of WAX Smart Contract development!
Wrapping up
When we were building Dark Emblem NFT, this was our humble starting point. Many projects just begin by making sure the basics are understood and taken care of before moving onto more complex functionality.
Next post: WAX Guestbook Smart Contract
E-book
Get this entire WAX tutorial as an e-book on Amazon.
Additional links
Posted on July 25, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.