tutorialwip

Run a W3bstream node in Windows

This is a quick guide on how to run a W3bstream node on a Windows system.

Post Header Image

Updated:


TIPS COLLECTED

...loading

SHARE

Prerequisites

In order to run a W3bstream node on a Windows system, you will need to run a Linux system on Windows. The easiest and most efficient way is to install the Windows Subsystem for Linux (WSL) in your system.
  • Install WSL (this will also provide an Ubuntu system pre-installed)
  • Install Docker
  • Pull and run the W3bstream node docker images

Instructions

Install WSL

  1. Open a terminal with elevated privileges
Search for “Command” in your Windows menu, then right-click on the “Command Prompt” app and select “Run as Administrator”.
2. Install WSL
Inside the terminal, type the following:
wsl —install
and wait for the installation to complete.
3. Reboot and complete Ubuntu installation
Once the installation of WSL is completed, reboot your system and wait for the changes to be applied. The command prompt will open automatically and complete the installation of Ubuntu_ provide a username and a password to complete the process.

Install Docker

These instructions can be found at https://docs.docker.com/engine/install/ubuntu/

  1. Setup the repository
sudo apt-get update

$ sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release

2. Add Docker's official GPG key
sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

3. Setup the repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

4. Install Docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin


5. Add your user to the docker group
sudo usermod -aG docker $USER

6. Restart Ubuntu
Close the command prompt, look for “Ubuntu” in your Windows menu and open it again.

7. Test Docker installation
The command below should run without errors:
sudo docker run hello-world

Pull and run the W3bstream node


  1. Run the command below to pull all required docker images and run the W3bstream node
curl https://w3bstream.com/dc > docker-compose.yaml && docker-compose up -d

2. Wait for all docker images to be pulled, then access W3bstream Studio from your browser at
https://localhost:3000


Create WASM Modules for W3bstream

Now that you can run a W3bstream node, you will want to deploy the logic of the node in the form of a WASM (WebAssembly) module. If you need to create a new WASM module, you will have to decide what language to use to program the W3bstream logic. Keep in mind that the language should provide a compiler that can generate WASM binaries for the WASI target. This means that not all languages that support WASM can be used, but only those that can target the WASI interface (that W3bstream's virtual machine is based on).

A good choice is using Go Lang: thanks to the Tinygo compiler, you can generate a WASM module out of your go code and have WASI as the target of the compilation.

Install go

You can install go from inside your Ubuntu terminal by just following the instructions at: https://go.dev/doc/install
Basically, just fetch the archive:
and install it with:
sudo rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.3.linux-amd64.tar.gz

Finally, update your path by adding this line to your .profie file using your favorite editor:
code $HOME/.profile
// Paste the following at the end of the file
// export PATH=$PATH:/usr/local/go/bin

source $HOME/.profile
Verify that go is installed with:
go version


Install Tinygo

You can easily install Tinygo by following the instructions at https://tinygo.org/getting-started/install/
Inside your Ubuntu terminal, just type the following to fetch the package and install it:
wget https://github.com/tinygo-org/tinygo/releases/download/v0.26.0/tinygo_0.26.0_amd64.deb

sudo dpkg -i tinygo_0.26.0_amd64.deb


Tips for WSL on Windows

Open Vs Code

You can run any Windows command from inside the WSL Linux terminal. For example, if you need to edit some source code, and you have VS Code installed on your Windows system, you can just cd inside the folder and call VS Code like this:
cd MyProject/

code .


Access Linux files

If, for any reason, you want to access the files of your Linux home directory from your Windows system, you can just run Windows Explorer from inside your home directory. In the Ubuntu WSL terminal, type the following:
cd $HOME

explorer.exe .
This will run Windows Explorer inside your Linux home. Notice the path at the top of the window: it will look something like \\wsl$\Ubuntu-22.04. You can also copy it and use it to create a shortcut on your Desktop.

Docs

IoTeX Docs


IoTeX Developerslogo

[email protected]