WinDeveloper Coin Tracker

Running TON OS on Windows

Alexander Zammit

Alexander Zammit Photo

Software Development Consultant. Involved in the development of various Enterprise software solutions. Today focused on Blockchain and DLT technologies.

  • Published: Aug 05, 2020
  • Category: Free TON
  • Votes: 5.0 out of 5 - 9 Votes
Cast your Vote
Poor Excellent

Born from Telegram's blockchain ashes, Free TON inherited a feature-rich codebase. Today we look at how Free TON came about. Next, I will show you how to run TON OS on Windows 10.

Last May I learned about the launch of the Free TON blockchain. Thus far, I had not followed the news about the original TON project from Telegram. However, as soon as I started learning about how Free TON was born, I got hooked and set myself to learn more.

This is about my learning journey. Today I will show you how I got the blockchain running on my Windows 10 development machine.

 

What is Free TON?

Telegram was the original developer of the TON blockchain. In early 2018 they made an ICO that raised $1.7 billion. However, the launch of the blockchain got stuck with the SEC classifying the ICO as a security.

With Telegram blocked from launching, Free TON was born. A community effort has been put together to fork the source code and launch the blockchain without involving Telegram. That's a source code fork, not to be confused with a blockchain fork.

The main thing that struck me with Free TON, is their community focus. Unlike Telegram, they do not plan to have an ICO, they rather want to be community driven. TON Crystals, their currency, is distributed to anyone helping them to build the blockchain in various ways.

TON Crystals distribution is done through contests. There is a mechanism for proposing contests which can cover anything, from running a validator node, software development and even writing articles about it. If interested, take a look at the contest listing page. Note: this article is not taking part in any contest for earning TON Crystals!

 

Running TON OS on Windows

A good starting point for developers is the TON OS. This gives us a local blockchain for us to play with. I started off from the installation documentation. But as often happens, things do not just work. So, I will show you how I got this to run on Windows 10.

 

1. Install Docker Desktop

On Windows we need Docker Desktop. I know a few colleagues that had problems with running Docker on Windows in the past and today still try to avoid it.

The good news is that most of the problems you encountered/heard about, are now solved! In the last few months, I installed and ran Docker Desktop multiple times without issues.

 

2. Install TON OS - Option 1

The official instructions will next tell you to complete installations by simply installing the node.js ton-dev-cli package and start TON OS as follows:
> npm install -g ton-dev-cli
> tondev start

In my case, after agreeing with the License terms, the second command ended with an error:
Pulling [tonlabs/local-node:latest]...
Creating tonlabs-local-node-alex...
Starting tonlabs-local-node-alex...
(HTTP code 500) server error - Ports are not available: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

We will fix this in a moment. Let's first have a look at what was installed. The installation basically pulls the node docker image. We can see this by running:
> docker images

REPOSITORY          TAG           IMAGE ID            CREATED             SIZE
tonlabs/local-node  latest        1605bc24b8c2        22 hours ago        1.41GB

and:
> docker ps -a

CONTAINER ID IMAGE                     COMMAND                  CREATED            
f1ee55989546 tonlabs/local-node:latest "/require-user-agree..." About a minute ago 

STATUS  PORTS NAMES
Created       tonlabs-local-node-alex

Getting back to the error, this was caused since port 80 is already busy on my machine. Thus, starting the node with the default port, fails. I fixed this by changing the port to another value (8033) with the command:
> tondev set --port 8033

This recreates the docker container, solving the problem:
Removing [tonlabs-local-node-alex]...
Creating tonlabs-local-node-alex...
Starting tonlabs-local-node-alex...

 

3. Install TON OS - Option 2

An alternative method to install TON OS is by pulling the docker images manually. However I found that the provided commands didn't work straight away either. Correcting these commands is easy, once you know what to look for.

Again, start by installing ton-dev-cli:
> npm install -g ton-dev-cli

Next, pull the docker image and create the container. Here are the commands I used. Watch-out, you need to make some adjustments before using these commands!
> docker pull tonlabs/local-node
> docker create -e USER_AGREEMENT=yes --name tonlabs-local-node-alex -i -p 8033:80 tonlabs/local-node
> docker start tonlabs-local-node-alex

The highlighted parameters show the changes I made to the set of commands provided in the docs. Let us look at these changes:

  • Changed the docker container name from tonlabs-local-node to tonlabs-local-node-alex

    Here I am appending my Windows account name to the container name. You should do the same, since this is how the tondev tool expects it to be.

  • Changed the -p parameter such that to set the port to 8033. You will need to do something like this if port 80 is busy.

 

4. Test the Installation

If everything goes well, we can open the GraphQL interface at the browser. If like me you had to change the default port, make sure to set this at the URL:
http://127.0.0.1:8033/graphql

 

Ton-Dev-Cli

In the previous section we installed ton-dev-cli and started working with the tondev command line tool. It is a good idea to become friends with this tool at an early stage. It helps us with managing the docker images/containers, configuring ports and with running the solidity compiler (in another docker container). For details, just run:
> tondev -h

 

References

Free TON Homepage

Free TON Contests

TON OS

Ton-Dev-Cli Documentation

 

Copyright 2024 All rights reserved. BlockchainThings.io