Part 1: Installation & setup

This section explains how to prepare your computer for the workshop.



  • Computer.

  • Raspberry Pi Zero W, (running a headless Raspbian Buster lite).

  • Class 10 SD Card.

  • A generic analog light sensor based on an LDR.

  • Jumper cables.

  • USB <→ Micro-USB cable.

Software pre-requisites

Basic requirements for all machines, (Installation guide by Lisk):

  • A code editor such as Visual Studio Code.

  • Git.

  • Python 2.

  • Node.js v12 (use nvm for easy switching between versions in case a different version is installed).

  • Postgres 10.

1.0 Setup

Set up the applicable software and hardware and the installation of the dependencies.

Clone the repo and install the dependencies

The following steps listed below describe how to create the initial files for this tutorial:

  1. Clone the Lisk-SDK-examples repository locally by executing the following commands:

    git clone
    cd lisk-sdk-examples/archive/3.x/transport

    The basic file structure is listed below:

    Contents of lisk-sdk-examples/transport
    ├── README.adoc
    ├── Workshop.adoc
    ├── client                                          (1)
    │   ├── accounts.json
    │   ├── app.js
    │   ├── package.json
    │   ├── scripts
    │   └── views
    ├── iot                                             (2)
    │   ├──
    │   ├── light_alarm
    │   │   ├── package.json
    │   │   └── index.js
    ├── node                                            (3)
    │   ├── index.js
    │   └── package.json
    └── transactions                                    (4)
        ├── finish-transport.js
        ├── light-alarm.js
        ├── register-packet.js
        └── start-transport.js
    1 Contains the code for the client application.
    2 Contains the code for the IoT application.
    3 Contains the code for the node application.
    4 Contains the custom transactions that are used by the node and client app.
  2. Navigate inside the transport/transactions and transport/node folders, and then run npm install to install the required dependencies for the node application as shown below:

    cd transactions
    npm install
    cd ../node
    npm install
  3. Setup the database as listed below:

    1. If a previous database was created then it will be necessary to delete it and re-create a new one using the following command: dropdb lisk_dev && createdb lisk_dev --owner lisk.

  4. To verify if the setup is correct, try to run the application with the following command:

    node index.js | npx bunyan -o short

This command will run the index.js file and pipe the outputted logs to the preferred log formatting tool Bunyan. Please be aware that when starting the node for the first time, this may require a few minutes.

If everything is running correctly, the node can be stopped by pressing CTRL+C.

In case the node crashes or does not function correctly, follow this guide to set up a dedicated development environment using Docker and Docker-Compose. The script will set up the whole environment. If the instructions in this guide are followed correctly, the remainder of this section can be skipped.

Prepare the IoT device

Reference: Raspberry Pi set up.
Sensor wiring

RPI Wiring

Preparing the Operating System

The operating system for the Raspberry needs to be copied from a computer into an SD card for this we recommend using etcher, (a good tutorial can be found at medium).

For preparing the Raspberry for ssh and wifi access follow this guide: Pi tutorial.

As it is necessary to run the Raspberry in headless mode, (i.e. no keyboard, mouse and monitor) we need to also enable ssh through the USB. To do so follow this guide ssh over usb. Once all those steps are completed, the SD card can be unmounted and inserted into the Raspberry SD card reader.

Already installed libraries for accessing sensor data

The pins in the Raspberry need some libraries before they can be used for communicating with different sensors. For installing the required libraries run:

  • sudo apt-get install wiringpi

  • sudo apt-get install pigpio

  • Node.js can be installed with nvm

Connecting / Logging in to the Pi

For logging in into the Pi plug it using the usb port labeled usb, and wait approximately one minute for it to boot, (the green light in the Pi will stop flashing when it’s done booting) and then open a terminal and perform the following: