Installing TON Node

There are three types of nodes:

  • Lite node
  • Full node
  • Archive node

All node requires at least 16GB of RAM and 8-core CPU, but disk usage depends on node type. Only linux is well tested.

Lite Node

Lite node have only intermediate state and basically just proxy all requests to other nodes. This is useful for moderate workload. Lite node requires ~10GB of disk space.

Full node

Full node have full state (but not transaction history) of a blockchain, it is useful for stable access to a blockchain. Full node requires ~10GB of disk space at the begining but would grow ~10GB per week.

Archive node

Archive node is a full node but that have an access for whole history of a blockchain. Current recommendation is to have 6TB SSD.

Installing Lite or Full Node

The easiest way to install node is to use mytonctrl.

Execute in this command in bash replacing mode with lite or full:

wget https://raw.githubusercontent.com/igroman787/mytonctrl/master/scripts/install.sh
sudo bash install.sh -m <mode>

After installing you can get an access to mytonctrl. Execute in shell:

mytonctrl

Exposing Ports

Each node exposes random UDP port. To find it execute:

sudo netstat -tunlp

and find validator-engine process with UDP port and configure your firewalls and routers. Only this port is required for synchronization.

Connect to Lite Server

Lite server is component of TON node that serves client connections and performs various queries. If you want to use outside of local node you have to get lite client config.

Start mytonctrl:

mytonctrl

In mytonctrl execute:

installer

In installer execute:

plsc

You will get config for your lite client, like:

{
    "ip": "<ip>",
    "port": "<port>",
    "id": {
        "@type": "pub.ed25519",
        "key": "<key>"
    }
}

Open port on your router/firewalls to make lite server accessible from outside.

(Advanced) Installing Archive Node

First you need to have 6TB SSD on your server, but current method relies on ZFS and you can use 3TB if you enable ZFS compression.

  1. Install zfs, create new pool (data).
  2. Enable compression: zfs set compression=lz4 data
  3. Create volume: zfs create data/ton-work
  4. Install mytonctrl
  5. Stop validator process: systemctl stop validator
  6. Backup configs: mv /var/ton-work /var/ton-work.bak
  7. Apply dump (see below)
  8. Mount zfs: zfs set mountpoint=/var/ton-work data/ton-work && zfs mount data/ton-work
  9. Copy config.json, keys and db/keyring from backup to /var/ton-work
  10. Fix permissions: chown -R validator:validator /var/ton-work
  11. Start validator: systemctl start validator

Apply Dump

Request credentials at http://anode2.ton.swisscops.com.

After getting credentials, execute:

sudo apt-get instapp pv plzip
curl -u <username>:<password> -s http://anode2.ton.swisscops.com/dumps/<link_for_last_dump> | pv | plzip -d -n48 | zfs recv data/ton-work

Testnet Node

wget https://raw.githubusercontent.com/igroman787/mytonctrl/master/scripts/install.sh
sudo bash install.sh -m full -c https://newton-blockchain.github.io/testnet-global.config.json

License

MIT

DocsGitHubBounty ProgramDark Mode