Lamden Setup on Windows

Performing development on Windows can sometimes be tricky. Nix based operating systems have a build in C++ compilers and Windows does not. Some Lamden developers have exprienced issues because of this. Additionally, many of the tools and programs come preinstalled on Linux like Python and Git!

Luckily Microsoft has a solution! Windows Subsystem for Linux. Which is basically a Linux virtual machine that you access through terminal. There is no GUI, but some really nice tools Visual Studio Code can reach inside WLS and it is like you are developing natively on Windows.

Prequisites

  • Must be running Windows 10

Installation Guide

  1. Install and configure WSL (Windows Subsystem for Linux) 2
  2. Choose Unbuntu as the Linux distribution 20.04
  3. Install Visual Studio Code (VS Code)
  4. Install the VS Code WSL Extenstion
  5. Install the VS Code Python Extenstion
  6. Download and install the Linux kernel update package
  7. Install Docker
  8. Follow the Docker WLS 2 Backend guide,*Note: The prerequisites were completed in the above steps
  9. Open a terminal: Start > Ubuntu
  10. Run docker run -d -p 27017:27017/tcp --name mongodb mongo:latest to create and start a Docker containter for Mongo DB (in the future you can delete this containter and use this command to reset the database or change the name --name argument to create multiple containers for different projects)
  11. Create a mongo db startup script
  12. Run echo "docker start mongodb" > ~/startmongo.sh
  13. Run chmod 755 ~/startmongo.sh to grant execute permissions
  14. Run pip3 install contracting to install the Lamden Contracting Python Library

Usage

  1. Open a terminal: Start > Ubuntu
  2. Run ~/startmongo.sh to start mongo in Docker from Ubuntu if the 'mongodb' Docker containter is not running
  3. Run cd ~ to change directory to your home directory
  4. Clone the repo using git clone https://github.com/JeffWScott/my_token_lamden_tutorial.git
  5. Run code my_token_lamden_tutorial to open the tutorial folder in VS Code 1 Under the server folder select contracting_server.py and in the top right corner hit the play button
  6. The results should be something like below in the termimal window:

[email protected]:~/my_token_lamden_tutorial$ /usr/bin/python3 /home/onlyluck/my_token_lamden_tutorial/server/contracting_server.py [2020-09-24 00:23:50 -0400] [1990] [INFO] Goin' Fast @ http://0.0.0.0:3737 [2020-09-24 00:23:50 -0400] [1990] [INFO] Starting worker [1990]

  1. Open http://localhost:3737/contracts and if everything is working you should see:

{"contracts":["submission","my_token"]}

With everything running you should be all set to go through the tutorials on Smart Contracting