Developing on Golem #1 — Installing Yagna and running an example

figurestudios
5 min readFeb 25, 2022

--

In this guide, you will learn everything that’s necessary to install Yagna and all required software on Windows 10. In the end, we will also run an example application.

Disclaimer: This guide is strictly for Windows 10. If you’re on Linux, the process will be different. Feel free to take inspiration, but take it with a grain of salt or use the official handbook instead.

1 - Installing required software on Windows 10

For this chapter, we will be installing Python, Git, and Yagna.

Python will be used later on for both controlling our yagna instance with all its communication, and running our own Python applications.

Git will be used to help clone some repositories which will be helpful in making it easy to follow some examples in this guide.

Installing Python

  • Press “Install Now”.
  • Restart all command prompts to update your shell.
  • Verify your installation with this command: python --version .
  • It should match the version downloaded:

Installing Git

  • Visit https://git-scm.com/download/win.
  • Press “64-bit Git for Windows Setup”.
  • Save & open the installer.
  • Go through with the installation process.
  • Restart all command prompts to update your shell.
  • Verify your installation with this command: git --version
  • It should look something like this:

Installing Yagna

At the time of writing, this is the one you should download.
  • Save it somewhere.
  • Right click and extract the contents to a folder:
  • Open the extracted folder.
  • Copy the entire path to the folder:
  • Press the Windows Key, search for “PATH”, and open it:
  • Go to “Environment Variables”:
  • Press “Path”, “Edit…”, “New” and paste your path to the extracted folder:
  • Press “OK” on everything and exit all windows you just opened
  • Verify your installation with these commands: yagna --version & gftp --version
  • It should look something like this:

2 - Setting up the Environment

For this chapter, we will be starting up Yagna, creating an app key, and set everything up for our wallet.

Yagna is the backbone of everything on Golem, and you need to use it for all communication between you (the requestor) and the provider.

The app key is used to differentiate between different identities and wallets in Yagna.

Running Yagna

  • Run yagna service run and keep the command prompt open. For other commands, open another command prompt.

Generating and storing your app key

  • Create your app key with yagna app-key create requestor and write this down or save it somewhere, as you need it to initialize the requestor.

Request testnet tokens from the faucet

  • Run yagna payment fund and wait for a bit to receive tGLM.
  • If you don’t get any output indicating that you have received funds, you can check the status with yagna payment status .

Enable requestor payments

  • Everytime you start the daemon, you need to run yagna payment init --sender to enable outbound payments as a requestor.

3 - Running an example application

In this chapter, we will set up a virtual environment for running a task.

Then we’ll download some example code and run it.

And we will take a look at how we can verify and track payments.

Set up your virtual environment

Enter these two commands individually:

python -m venv --clear %HOMEDRIVE%%HOMEPATH%\.envs\yagna-python-tutorial%HOMEDRIVE%%HOMEPATH%\.envs\yagna-python-tutorial\Scripts\activate.bat

It should look like this:

Install the required Python dependencies

Enter these two commands individually:

pip install -U pippip install yapapi

Clone and navigate to our example

Enter these commands individually:

git clone https://github.com/golemfactory/yapapi.gitcd yapapigit checkout b0.8

Setting our app key

Now we need our app key that we generated earlier and wrote down or saved.

If you forgot to write it down, you can always find it by writing yagna app-key list .

Now run this command to let the yagna service know which app key we’re using:

set YAGNA_APPKEY=your-32-char-app-key

Running the example app

Navigate to our examples/blender folder:

cd examples/blender

And run the example:

python blender.py

Now wait, and you’ll see some details regarding the computations made.

Verifying our ingoing and outgoing transactions

If you run yagna payment status you can see details for each platform:

What’s next?

Now we have run our environment set up, but we don’t know how to run our commands yet. In the following guides you will be:

--

--