Introduction
Search…
Remote Control App

Requirements

  • Node.js 8 (not higher) and npm
  • make
  • cmake
  • g++
You should create a new terminal session before following steps. The previous session you used has been customised for the DIGI toolchain and cannot be used to build a Node.js application.

Installation

  1. 1.
    install requirements
    1
    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - && sudo apt-get install -y nodejs
    2
    sudo apt-get install -y make cmake g++
    Copied!
  2. 2.
    from the root of the project dev-demos
    1
    cd app/server
    Copied!
  3. 3.
    install package
    1
    npm install
    Copied!
  4. 4.
    download and install latest Litecoin TestNet headers database (more information)
    1
    npx ltc-backup install testnet -t nodeHome
    Copied!

Run the application

  1. 1.
    set and export an environment variable with the information needed from the application. This information was prepared by the UniquID CLI when you run the uniquid deploy aws command. The information was stored on the file ~/aws_device_cfg.json Run the command:
    1
    export AWS_AGENT_CONFIG=$(cat ~/aws_device_cfg.json)
    Copied!
  2. 2.
    check the correct setup with:
    1
    echo $AWS_AGENT_CONFIG
    Copied!
  3. 3.
    start the application
    1
    npm start
    Copied!
  4. 4.
    deploy a contract between the board (provider) and the application (user) with the following functions enabled:
    • 34 set led status (on/off)
    • 35 read led status (on/off)
    contract.json
    1
    [
    2
    {
    3
    "provider": "tpubXXXXX",
    4
    "user": "tpubYYYYY",
    5
    "functions": [34, 35]
    6
    }
    7
    ]
    Copied!
  5. 5.
    interact with the device
    1. 1.
      if you are working on the EC2 instance
      1. 1.
        create a security group to open port 3000
      2. 2.
        open browser to http://<ec2-ip-address>:3000
    2. 2.
      if you are working on your local machine
      1. 1.
        open your browser on http://localhost:3000