Skip to content

Blockchain nodes #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/participate/network-maintenance/nominator-pool.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **Recommended providers include:** [Amazon](https://aws.amazon.com/), [DigitalOcean](https://www.digitalocean.com/), [Linode](https://www.linode.com/), [Alibaba Cloud](https://alibabacloud.com/), [Latitude](https://www.latitude.sh/).

2. Install and synchronize **mytonctrl** as described in the guide [here](/participate/run-nodes/full-node).
2. Install and synchronize **mytonctrl** as described in the guide [here](/participate/run-nodes/full-node#how-to-run-a-node-video).

You can also refer to this [Video Instruction](https://ton.org/docs/#/nodes/run-node) for additional help.

Expand Down
2 changes: 2 additions & 0 deletions docs/participate/network-maintenance/single-nominator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ If user doesn't want to take part in validating anymore:

```bash
MyTonCtrl> disable_mode validator
```

2. [Withdraw](/participate/network-maintenance/single-nominator#withdraw-funds) all funds from the Single Nominator contract to the owner wallet.

## Transitioning a Regular Validator to Nominator Pool Mode
Expand Down
4 changes: 2 additions & 2 deletions docs/participate/nodes/node-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ Running a Validator Node

`Liteservers` enable swift communication with Lite Clients, facilitating tasks like retrieving balance or submitting transactions without necessitating the full block history.

Actually, there are two public `Liteservers`, that already have been provided by the TON Foundation. They are accessible for universal use.
Actually, there are two public `Liteservers` configs both for mainnet and testnet, that already have been provided by the TON Foundation. They are accessible for universal use. But it's not recommended to use public `Liteservers` in production since they are not stable because of permanent high load.

- [Public Liteserver Configurations - mainnet](https://ton.org/global-config.json)
- [Public Liteserver Configurations - testnet](https://ton.org/testnet-global.config.json)

These endpoints, such as those used by standard wallets, ensure that even without setting up a personal liteserver, interaction with the TON Blockchain remains possible.

If your project requires a high level of _security_, you can run your own `Liteserver`. To run a `full node` as a `Liteserver`, simply enable the `Liteserver` mode in your node's configuration file.
If you want to have more stable _connection_, you can run your own `Liteserver`. To run a `full node` as a `Liteserver`, simply enable the `Liteserver` mode in your node's configuration file.

<Button href="/participate/run-nodes/full-node#enable-liteserver-mode"
colorType="primary" sizeType={'sm'}>
Expand Down
8 changes: 5 additions & 3 deletions docs/participate/run-nodes/become-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Read about [Full Node](/participate/run-nodes/full-node) before this article
:::

Check that validator mode is enabled using `status_modes` command. If it's not, refer [mytonctrl enable_mode command](https://google.com).

## View the List of Wallets

Check out the list of available wallets in the **MyTonCtrl** console using the `wl` command:
Expand All @@ -14,7 +16,7 @@ wl

During the installation of **mytonctrl**, the **validator_wallet_001** wallet is created:

![wallet list](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/manual-ubuntu_mytonctrl-wl_ru.png)
![wallet list](/img/docs/nodes-validator/manual-ubuntu_mytonctrl-wl_ru.png)


## Activate the Wallets
Expand All @@ -39,7 +41,7 @@ During the installation of **mytonctrl**, the **validator_wallet_001** wallet is
aw [wallet name]
```

![account history](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/manual-ubuntu_mytonctrl-vas-aw_ru.png)
![account history](/img/docs/nodes-validator/manual-ubuntu_mytonctrl-vas-aw_ru.png)

## Your Validator is Now Ready

Expand All @@ -51,4 +53,4 @@ set stake 50000

`set stake 50000` — this sets the stake size to 50k coins. If the bet is accepted and our node becomes a validator, the bet can only be withdrawn in the second election (according to the rules of the electorate).

![setting stake](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/manual-ubuntu_mytonctrl-set_ru.png)
![setting stake](/img/docs/nodes-validator/manual-ubuntu_mytonctrl-set_ru.png)
83 changes: 39 additions & 44 deletions docs/participate/run-nodes/enable-liteserver-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,32 @@ Hetzner and OVH are forbidden to run a validator, but you can use them to run a

## Installation of liteserver

1. Complete the previous steps to install [MyTonCtrl](/participate/run-nodes/full-node#run-a-node-text).
If you don't have mytonctrl, install it with `-m lightserver` flag:

2. Create a config file
<Tabs groupId="operating-systems">
<TabItem value="ubuntu" label="Ubuntu">

```bash
MyTonCtrl> installer
MyTonInstaller> clcf

Local config file created: /usr/bin/ton/local.config.json
```
```bash
wget https://raw.githubusercontent.com/ton-blockchain/mytonctrl/blob/mytonctrl2_dev/scripts/install.sh
sudo bash install.sh -m lightserver -d
```

3. This file will help you to connect to your liteserver. Copy the config file located on the specified path to your home to save it.
</TabItem>
<TabItem value={'debian'} label={'Debian'}>

```bash
cp /usr/bin/ton/local.config.json ~/config.json
```
```bash
wget https://raw.githubusercontent.com/ton-blockchain/mytonctrl/blob/mytonctrl2_dev/scripts/install.sh
su root -c 'bash install.sh -m lightserver -d'
```

4. Create an empty `config.json` file on your local machine.
</TabItem>
</Tabs>

5. Copy the content from the console to your local machine `config.json` file.
If you already have mytonctrl installed, run:

```bash
cat ~/config.json
user@system:~# mytonctrl
MyTonCtrl> enable_mode liteserver
```

## Check the firewall settings
Expand Down Expand Up @@ -116,7 +119,7 @@ This way, you can open the port in the firewall settings of your server.

## Interaction with Liteserver (Lightclient)

0. Create an empty project on your machine and paste `config.js` in the project directory.
0. Create an empty project on your machine and paste `config.json` in the project directory.

1. Install libraries.

Expand Down Expand Up @@ -199,35 +202,27 @@ Create `index.js` file with the following content:
<TabItem value="python" label="Python">

```python
import asyncio
from pytonlib import TonlibClient
from pathlib import Path
import json


async def get_client() -> TonlibClient:
with open('config.json', 'r') as f:
config = json.loads(f.read())

keystore_dir = '/tmp/ton_keystore'
Path(keystore_dir).mkdir(parents=True, exist_ok=True)

client = TonlibClient(ls_index=0, config=config, keystore=keystore_dir, tonlib_timeout=10)
await client.init()

return client


async def test_client():
client = await get_client()

print(await client.get_masterchain_info())

await client.close()

from pytoniq import LiteClient

async def main():
client = LiteClient.from_mainnet_config( # choose mainnet, testnet or custom config dict
ls_i=0, # index of liteserver from config
trust_level=2, # trust level to liteserver
timeout=15 # timeout not includes key blocks synchronization as it works in pytonlib
)

await client.connect()

await client.get_masterchain_info()

await client.reconnect() # can reconnect to an exising object if had any errors

await client.close()

""" or use it with context manager: """
async with LiteClient.from_mainnet_config(ls_i=0, trust_level=2, timeout=15) as client:
await client.get_masterchain_info()

if __name__ == '__main__':
asyncio.run(test_client())
```

</TabItem>
Expand Down
25 changes: 9 additions & 16 deletions docs/participate/run-nodes/full-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import TabItem from '@theme/TabItem';

# Full Node

:::caution [MyTonCtrl](/participate/run-nodes/mytonctrl) requires terminal restarting after some operations
If you get an error without visible reason, ***like [Validator is not settings](/participate/run-nodes/nodes-troubleshooting#validator-console-is-not-settings) even from owner***, try to restart terminal
:::

## OS requirements

We highly recommend installing MyTonCtrl using the supported operating systems:
Expand Down Expand Up @@ -88,10 +84,10 @@ sudo adduser <username>
sudo usermod -aG sudo <username>
```

3. Log into the new user
3. Log into the new user (if you are using ssh, you will need to stop current session and reconnect with correct user)

```bash
su - username
ssh <username>@<server-ip-address>
```

### Install the MyTonCtrl
Expand All @@ -103,27 +99,25 @@ Download and run the installation script from the **non-root** user account with

```bash
wget https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/scripts/install.sh
sudo bash install.sh -m full -d
sudo bash install.sh -d
```

</TabItem>
<TabItem value={'debian'} label={'Debian'}>

```bash
wget https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/scripts/install.sh
su root -c 'bash install.sh -m full -d'
su root -c 'bash install.sh -d'
```

</TabItem>
</Tabs>

* `-m full` - Full node installation mode.
* `-d` - **mytonctrl** will download a [dump](https://dump.ton.org/) of the latest blockchain state.
This will reduce synchronization time by several times.
* `-c <path>` - If you want to use not public liteservers for synchronization. _(not required)_
* `-i` - Ignore minimum requirements, use it only if you want to check compilation process without real node usage.

There are two installation modes: lite and full. They both compile and install TON components. However the lite version does not configure or run the node/validator.
* `-m` - Mode, can be `validator` or `liteserver`,

### Run the mytonctrl

Expand All @@ -144,11 +138,11 @@ The following statuses should be displayed:

* **mytoncore status**: Should be in green.
* **local validator status**: Should also be in green.
* **local validator out of sync**: Initially, a large number is displayed. As soon as the newly created validator connects with other validators, the number will be around 250k. As synchronization progresses, this number decreases. When it falls below 20, the validator is synchronized.
* **local validator out of sync**: Initially, a `n/a` string is displayed. As soon as the newly created validator connects with other validators, the number will be around 250k. As synchronization progresses, this number decreases. When it falls below 20, the validator is synchronized.

Example of the **status** command output:

![status](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/mytonctrl-status.png)
![status](/img/docs/nodes-validator/mytonctrl-status.png)

:::caution Make sure you have same output for status
For all nodes type **Local Validator status** section should appear.
Expand All @@ -162,8 +156,7 @@ Wait until `Local validator out of sync` becomes less than 20 seconds.
Download script and run it:

```bash
wget https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/scripts/uninstall.sh
sudo bash uninstall
sudo bash /usr/src/mytonctrl/uninstall.sh
```

### Check mytonctrl owner
Expand All @@ -186,7 +179,7 @@ ls -lh /var/ton-work/keys/

- To check **mytonctrl** logs, open `~/.local/share/mytoncore/mytoncore.log` for a local user or `/usr/local/bin/mytoncore/mytoncore.log` for Root.

![logs](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/manual-ubuntu_mytoncore-log.png)
![logs](/img/docs/nodes-validator/manual-ubuntu_mytoncore-log.png)

### Check the node logs

Expand Down
22 changes: 15 additions & 7 deletions docs/participate/run-nodes/mytonctrl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To install and manage your own node, use the **MyTonCtrl** open-source tool deve

[MyTonCtrl](https://github.com/ton-blockchain/mytonctrl) is a console application that is a convenient wrapper for fift, lite-client, and validator-engine-console. It has been specifically developed to streamline wallet, domain, and validator management tasks on the Linux operating system.

Actually, there is [MyTonCtrl2](https://github.com/ton-blockchain/mytonctrl/tree/mytonctrl2) with a lot of improvements ([single nominator pool](/participate/network-maintenance/single-nominator), more checks, etc.). But now it is under development and can be unstable.
Actually, there is [MyTonCtrl2](https://github.com/ton-blockchain/mytonctrl/tree/mytonctrl2) with a lot of improvements ([single nominator pool](/participate/network-maintenance/single-nominator), more checks, etc.).

We are actively seeking feedback about the installation process. If you have any questions or suggestions, please [contact us](https://t.me/Alexgton).

Expand Down Expand Up @@ -101,7 +101,7 @@ MyTonCtrl> setting <setting_name>

### set

Set the specified value of a specified setting. Skip setting existence if `--force` enabled
Set the specified value of a specified setting. Skip setting existence checking if `--force` enabled

```bash
MyTonCtrl> set <setting> <value> [--force]
Expand All @@ -116,7 +116,7 @@ No args, rollback to mytonctrl 1.0.
Retrieves and prints the JSON representation of the configuration specified by `<config-id>`

```bash
MyTonCtrl> get <config_id>
MyTonCtrl> getconfig <config_id>
```

### get_pool_data
Expand Down Expand Up @@ -197,10 +197,6 @@ No args, cleanup validator database

No args, prints table with several tests

### activate_ton_storage_provider

No args, activates "provider_wallet_001" wallet and sends some amount of tons

## Single pool

### new_single_pool
Expand Down Expand Up @@ -534,6 +530,18 @@ prints Services status (of Full node, Mytoncore, V.console, Liteserver) and node
| Add or replace arg | `set_node_argument [-ARG_NAME] [ARG_VALUE]` | Add argument or replace it value if it exists. `-ARG_NAME` must have `-` or `--` at the beginning |
| Delete arg | `set_node_argument [-ARG_NAME] -d` | Delete argument from list. |

Possible arguments:

| Node argument name | Description | Default value |
|--------------------|-----------------------------------------|--------------------------------------------------------------------------------------|
| `threads` | count of threads | `cpus count - 1` |
| `daemonize` | | No value |
| `global-config` | path to global config | `/usr/bin/ton/global.config.json` |
| `db` | path to database | `/var/ton-work/db/` |
| `logname` | path to logs | `/var/ton-work/log` |
| `state-ttl` | ttl of blockchain states that node keep | 604800 |
| `archive-ttl` | ttl of blocks node stores | 2592000 if lightserver mode was enabled during installation process, otherwise 86400 |

### enable

Enable one of the modes, for `ton-http-api` creates config
Expand Down
2 changes: 1 addition & 1 deletion docs/participate/run-nodes/nodes-troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ __A:__ This is normal, typically this means you tried to retrieve block, which d

__Q:__ If comparative frequency appears, does it mean there is a problem somewhere?

__A:__ No. You need to check "Local validator out of sync" value in mytonctrl. If it's less than 60 seconds, then everything is fine.
__A:__ No. You need to check "Local validator out of sync" value in mytonctrl. If it's less than 20 seconds, then everything is fine.

But you need to keep in mind that the node is constantly synchronizing. Sometimes, you may try to receive a block that has not reached the node you requested.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ su - <username>

**status**命令输出的示例:

![status](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/mytonctrl-status.png)
![status](/docs/participate/run-nodes/images/mytonctrl-status.png)

:::caution 确保状态输出相同
对于所有类型的节点,**Local Validator status**部分应该显示。
Expand All @@ -222,7 +222,7 @@ wl

在安装**mytonctrl**期间,将创建**validator_wallet_001**钱包:

![wallet list](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/manual-ubuntu_mytonctrl-wl_ru.png)
![wallet list](/docs/participate/run-nodes/images/manual-ubuntu_mytonctrl-wl_ru.png)


### 激活钱包
Expand All @@ -247,7 +247,7 @@ vas
aw [wallet name]
```

![account history](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/manual-ubuntu_mytonctrl-vas-aw_ru.png)
![account history](/docs/participate/run-nodes/images/manual-ubuntu_mytonctrl-vas-aw_ru.png)

### 您的验证者现已准备就绪

Expand All @@ -259,7 +259,7 @@ set stake 50000

`set stake 50000` — 这将质押代币大小设置为50k coins。如果质押代币被接受并且我们的节点成为验证者,那么质押代币只能在第二次选举中提取(根据选民的规则)。

![setting stake](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/manual-ubuntu_mytonctrl-set_ru.png)
![setting stake](/docs/participate/run-nodes/images/manual-ubuntu_mytonctrl-set_ru.png)

## 启用Liteserver模式

Expand Down Expand Up @@ -292,8 +292,7 @@ Hetzner和OVH被禁止运行验证者,但您可以使用它们运行liteserver
2. 创建配置文件

```bash
MyTonCtrl> installer
MyTonInstaller> clcf
MyTonCtrl> installer clcf

本地配置文件已创建:/usr/bin/ton/local.config.json
```
Expand Down Expand Up @@ -550,7 +549,7 @@ sudo ufw enable

- 要检查**mytoncrl**日志,请打开本地用户的`~/.local/share/mytoncore/mytoncore.log`,或者Root的`/usr/local/bin/mytoncore/mytoncore.log`。

![logs](https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/screens/manual-ubuntu_mytoncore-log.png)
![logs](/docs/participate/run-nodes/images/manual-ubuntu_mytoncore-log.png)


## 故障排除
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading