Installing EOSFactory

The purpose of this tutorial is to demonstrate how to install EOSFactory on any operating system, including Ubuntu, MacOS and Windows.

We’ve tested EOSFactory on the following platforms:

  • Ubuntu 18.04 (Bionic)
  • MacOS 10.13 (High Sierra)
  • Windows 10 (version 1803)

NOTE: EOSFactory is compatible with EOSIO v1.5.x.

General prerequisites

We assume that you have successfully installed EOSIO v1.5.0 on your machine. Binary installation suffices.

EOSIO deployed in Docker is NOT supported.

Also, we assume that you have installed eosio.cdt v1.41. Binary installation suffices.

Prerequisites for Ubuntu & MacOS

  • We assume you have installed Python 3.5 (or higher).
  • We assume you have installed pip 18.1 (or higher).

Prerequisites for Windows

  • We assume that you have Windows Subsystem for Linux - Ubuntu 18.04 installed.
  • The only option you have regarding EOSIO installation is building it in the Ubuntu 18.04 bash (supplied by WSL), as it cannot be compiled directly on a Windows machine. What we recommend is clone the EOSIO source code in Windows and keep it in the Windows file structure, yet build it in WSL, taking advantage of the fact that the entire Windows file structure is fully accessible in WSL.
  • And finally, we assume you have Python 3.5 (or higher) available in your WSL, but this condition is likely to be already satisfied, as WSL ships with Python 3.6.5 by default. Also make sure your WSL has pip 18.1 (or higher) installed.

Install on Ubuntu & MacOS

Clone EOSFactory source code from the repository:

git clone https://github.com/tokenika/eosfactory.git

Open a bash terminal and navigate to the eosfactory folder:

cd eosfactory

Then run the install script by pointing it to the EOSIO source code:

./install.sh

When prompted, supply the path pointing to the location of your smart-contract workspace, e.g. ~/Workspaces/EOS/contracts. It has to be existent, so if you don’t have it already, you need to create it manually.

Install on Windows

Clone EOSFactory source code from the repository:

git clone https://github.com/tokenika/eosfactory.git

NOTE: We recommend keeping EOSFactory in the Windows file structure, not WSL.

Open a WSL bash terminal and navigate to the eosfactory folder:

cd /mnt/d/Workspaces/EOS/eosfactory

Then run the install script by pointing it to the EOSIO source code:

./install.sh

When prompted, supply the path pointing to the location of your smart-contract workspace, e.g. /mnt/d/Workspaces/EOS/contracts. It has to be existent, so if you don’t have it already, you need to create it manually.

Verify the installation

Now let’s verify that EOSFactory works and is properly hooked up to EOSIO.

First, make sure your working directory is switched to eosfactory:

cd eosfactory

And then run those three tests:

python3 tests/01_hello_world.py
python3 tests/02_eosio_token.py
python3 tests/03_tic_tac_toe.py

Troubleshooting specific errors

Case 1

If the test fails due to the can't open file 'tests/01_hello_world.py' error, make sure your current working directory is eosfactory.

Troubleshooting general problems

First, make sure EOSFactory configuration is correct by running this command:

python3 -m eosfactory.core.config

As a result, you should get data similar to this:

The current configuration of EOSFactory:
{
    "CONFIG_FILE": "/mnt/c/Workspaces/EOS/eosfactory/config.json",
    "EOSIO_ABIGEN": "/usr/local/eosio.cdt/bin/eosio-abigen",
    "EOSIO_CLI_EXECUTABLE": "/usr/bin/cleos",
    "EOSIO_CONTRACT_WORKSPACE": "/mnt/c/Workspaces/EOS/contracts",
    "EOSIO_CPP": "/usr/local/bin/eosio-cpp",
    "EOSIO_GENESIS_JSON": "/mnt/c/Workspaces/EOS/eosfactory/localnode/genesis.json",
    "EOSIO_KEY_PRIVATE": "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3",
    "EOSIO_KEY_PUBLIC": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
    "EOSIO_SHARED_MEMORY_SIZE_MB": "200",
    "EOS_FACTORY_DIR": "/mnt/c/Workspaces/EOS/eosfactory",
    "KEOSD_EXECUTABLE": "/usr/bin/keosd",
    "KEOSD_WALLET_DIR": "/home/cartman/eosio-wallet/",
    "LOCAL_NODE_ADDRESS": "127.0.0.1:8888",
    "LOCAL_NODE_CONFIG_DIR": "/mnt/c/Workspaces/EOS/eosfactory/localnode/",
    "LOCAL_NODE_DATA_DIR": "/mnt/c/Workspaces/EOS/eosfactory/localnode/",
    "LOCAL_NODE_EXECUTABLE": "/usr/bin/nodeos",
    "NODEOS_STDOUT": null,
    "NODE_IN_WINDOW": 0,
    "WALLET_MANAGER_ADDRESS": "127.0.0.1:8888",
    "WSL_ROOT": "C:/Users/cartman/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs"
}

You are free to overwrite the above settings with entries in the configuration file located here:
/mnt/c/Workspaces/EOS/eosfactory/config.json


There are undefined setting:
{
    "NODEOS_STDOUT": null
}


The current contents of the configuration file is:
{
    "EOSIO_CONTRACTS": "/mnt/c/Workspaces/EOS/eosio.contracts",
    "EOSIO_CONTRACT_WORKSPACE": "/mnt/c/Workspaces/EOS/contracts",
    "WSL_ROOT": " C:\\Users\\cartman\\AppData\\Local\\Packages\\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\\LocalState\\rootfs"
}

Next, verify that all the above paths are resolved.

Subsequent installations

If you want to upgrade to the latest version of EOSFactory:

cd eosfactory
git pull

And then just run:

./install.sh