Skip to content

Running lamassu‐machine on Windows

CrypticaScriptura edited this page Aug 9, 2024 · 1 revision

Note: Lamassu provides support to machine operators for the installation of our software on supported environments. We do not offer assistance for installation of the lamassu-machine or lamassu-server software on local environments, or for their custom development. The notes below are provided as a courtesy and do not come with support.


Pre-reqs

Download Windows Terminal.

In Windows Terminal, open PowerShell. Run:

wsl --install

(See: https://learn.microsoft.com/en-us/windows/wsl/install)

After success, download and install Ubuntu 20.04 LTS for WSL.

Open Ubuntu in Windows Terminal, and set up a Linux user and password.

Installing dependencies and lamassu-machine

In the terminal, install dependencies, clone and install lamassu-machine:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential cmake curl git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libpcsclite-dev libv4l-dev libasound2-dev libssl-dev libjpeg-dev libpng-dev ruby

Next, install node v22.4.1:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install 22.4.1

Clone lamassu-machine (into your Ubuntu user's home directory):

cd ~
git clone https://github.com/lamassu/lamassu-machine.git
cd lamassu-machine
git checkout release-10.0

Remove the contents in the optionalDependencies section of package.json with:

nano package.json

Save the file, then continue with:

npm install
bash ./setup.sh
npm run build

Note!

Do not subsequently access the Ubuntu filesystem via Windows Explorer, as doing so will rename certain files using Windows' supported naming convention. This will break files which the lamassu-machine install relies upon, and you may need to clone and install the repo again.

Add crypto addresses for the mockCam

Since we'll be mocking out the camera, we'll want to pre-load crypto addresses (that you own) to be automatically scanned in lieu of a QR code.

Run nano device_config.json and add the following mockCryptoQR block within brain (containing your own addresses for whichever coins you plan to test with):

{
  "brain": {
    "freeMemRatio": 0.01,
    "powerStatus": null,
    "dataPath": "data",
    "wifiConfigPath": null,
    "mockCryptoQR": {
      "BTC": "bc1...",
      "ETH": "0x...",
      "ZEC": "u1...",
      "DASH": "X...",
      "LTC": "ltc1...",
      "BCH": "bitcoincash:q..."
    },
    "mockCameraImage": "mock_data/compliance/license.jpg"
  },
[...]

Running the mockBillValidator

Open a second Ubuntu tab in Windows Terminal, one which will remain open and running to control virtual bill inserts. Do:

cd ~/lamassu-machine
node bin/fake-bills.js

After running lamassu-machine and pairing in the next steps, you can use this window to virtually insert bills when you're on the appropriate bill accepting screens. Typing 5 and hitting Enter will insert a 5 denomination note in your currency, for example.

Running

Set up your server and admin if you haven't already done so.

Click '+ Add Machine' in the admin, name the machine, and generate a QR code. On that page, scan the QR code with your phone, and send the decoded result to your computer.

Then, in the first Ubuntu tab, run the following. Replace code with that which you obtained from the admin's console, also contained within single quotes:

node bin/lamassu-machine --mockBillValidator --mockBillDispenser --mockCam --mockPair 'code'

Within Windows, open within the following URL in a browser (Brave, Edge, Chromium), replacing linux-user with the Ubuntu username you created:

file://wsl%24/Ubuntu/home/linux-user/lamassu-machine/ui/start.html?debug=dev

Click 'INIT', then 'Pair'. (Pairing codes expire after an hour, so generate a new one if it's been some time between steps.)