Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2d0d9fc
BCE-8698: Added ton docker
lipika-pal Feb 27, 2026
4fc4b2f
BCE-8698: ports updated to ton docker
lipika-pal Feb 27, 2026
b30d67f
BCE-8698: config updated for ton docker
lipika-pal Feb 27, 2026
05a2739
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
0f9f63d
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
622a799
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
d4b7dbf
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
fef4b46
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
ef6168b
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
df0e105
Remove .idea from repo and add to gitignore
lipika-pal Mar 2, 2026
6502afa
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
6303f2e
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
4c8e2a3
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
6e34083
BCE-8698: config updated for ton docker
lipika-pal Mar 2, 2026
4f11052
BCE-8698: config updated for ton docker
lipika-pal Mar 3, 2026
a77c094
BCE-8698: added ton http api and refactored ton node
lipika-pal Mar 4, 2026
f0a3613
BCE-8698: lint fixes
lipika-pal Mar 4, 2026
84a593d
BCE-8698: lint fixes
lipika-pal Mar 4, 2026
8c2a525
BCE-8698: lint fixes
lipika-pal Mar 4, 2026
28a5f01
BCE-8698: traefik labels added
lipika-pal Mar 5, 2026
f9392c8
BCE-8698: fix public ip detection
lipika-pal Mar 5, 2026
6a65b14
BCE-8698: fix snapshot
lipika-pal Mar 5, 2026
c60d138
BCE-8698: auto generate liteserver config for ton-http-api
lipika-pal Mar 5, 2026
8d224ef
BCE-8698: lint fixes
lipika-pal Mar 5, 2026
8a0f88f
BCE-8698: fixing ton-http-api liteserver config generation
lipika-pal Mar 5, 2026
29150e5
BCE-8698: fix ton http api
lipika-pal Mar 5, 2026
59c77c9
BCE-8698: added ethd check-sync command
lipika-pal Mar 5, 2026
85e9102
BCE-8698: updated ton-http-api checking ton node sync
lipika-pal Mar 5, 2026
990866b
BCE-8698: fixed sync check
lipika-pal Mar 5, 2026
68bc88a
BCE-8698: refactor
lipika-pal Mar 5, 2026
368fcf4
BCE-8698:fixed ton-http-api
lipika-pal Mar 6, 2026
0e10ef3
BCE-8698: refactored
lipika-pal Mar 6, 2026
279edfb
BCE-8698: check sync updated
lipika-pal Mar 6, 2026
bdc4899
BCE-8698: ton node and http-api updated
lipika-pal Mar 8, 2026
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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@
*.bak
*.original
custom.yml
.idea/
*.iml
*.ipr
*.iws
.vscode/
.DS_Store
*.log
*.tmp
tmp/
temp/
12 changes: 1 addition & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ repos:
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs
- id: detect-private-key
- id: check-ast
- id: debug-statements
- id: check-merge-conflict
- id: check-added-large-files
- id: mixed-line-ending
- id: check-case-conflict
- id: requirements-txt-fixer
- id: check-toml

- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
Expand All @@ -33,13 +29,7 @@ repos:
rev: v2.4.1
hooks:
- id: codespell

# Dockerfiles
# Disabled bcs macOS Docker might not be installed
# - repo: https://github.com/hadolint/hadolint
# rev: v2.13.1
# hooks:
# - id: hadolint-docker
args: ['-L', 'pyton']

# YAML style (beyond syntax)
- repo: https://github.com/adrienverge/yamllint
Expand Down
126 changes: 126 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Overview

Docker Compose for TON (The Open Network) liteserver nodes.

`cp default.env .env`, adjust values for the right network (mainnet/testnet), then `./ethd up`.

Meant to be used with [central-proxy-docker](https://github.com/CryptoManufaktur-io/central-proxy-docker) for traefik and Prometheus remote write; use `:ext-network.yml` in `COMPOSE_FILE` inside `.env` in that case.

Add `ton-shared.yml` to `COMPOSE_FILE` to expose liteserver and validator console ports locally instead of via traefik.

`./ethd install` brings in docker-ce, if you don't have Docker installed already.

`cp default.env .env`

`nano .env` and adjust variables, particularly `GLOBAL_CONFIG_URL` and `SNAPSHOT`

`./ethd up`

Initial sync: ~10 hours (~4-5 hours with snapshot).

To update the software, run `./ethd update` and then `./ethd up`

# Configuration

## Mainnet

Basic setup:
```properties
TON_BRANCH=mainnet
GLOBAL_CONFIG_URL=https://ton.org/global.config.json
SNAPSHOT=latest
```

With HTTP API:
```properties
COMPOSE_FILE=ton.yml:ton-http-api.yml
TON_API_HTTP_PORT=8081
```

With local RPC access:
```properties
COMPOSE_FILE=ton.yml:ton-shared.yml
```

## Testnet

```properties
TON_BRANCH=testnet
GLOBAL_CONFIG_URL=https://ton.org/testnet-global.config.json
SNAPSHOT=latest_testnet
```

## HTTP API

Enable HTTP/JSON-RPC API in `COMPOSE_FILE`:
```properties
COMPOSE_FILE=ton.yml:ton-http-api.yml
TON_API_HTTP_PORT=8081
```

Test endpoints:
```bash
# masterchain info
curl -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getMasterchainInfo","params":[]}' \
http://localhost:8081

# health check
curl http://localhost:8081/healthcheck
```

# Operations

## Check Sync Status
```bash
./scripts/check-sync.sh
```
Exit codes: 0=synced, 1=syncing, 2=error

## Monitor Logs
```bash
./ethd logs -f ton
```

## Node Status
```bash
docker compose exec ton mytonctrl
MyTonCtrl> status
```

## Generate Liteserver Config
After full sync:
```bash
docker compose exec ton mytonctrl
MyTonCtrl> installer clcf
```
Creates `/usr/bin/ton/local.config.json` for client connections.

# Hardware Requirements

**Mainnet:**
- 16 cores, 64GB RAM
- 1TB SSD/NVMe (~250GB used, grows over time)
- 1 Gbps, 10TB+ monthly traffic

**Testnet:** Similar, ~100GB storage

# Ports

Default ports (customizable in `.env`):
- `VALIDATOR_PORT` (30001/udp) - P2P networking
- `LITESERVER_PORT` (30003/tcp) - Liteserver connections
- `VALIDATOR_CONSOLE_PORT` (30002/tcp) - Console access
- `TON_API_HTTP_PORT` (8081/tcp) - HTTP API

Public IP auto-detected on startup. Override with `PUBLIC_IP` in `.env` if needed.

# Customization

`custom.yml` can override any settings and is not tracked by git. Add to `COMPOSE_FILE` in `.env` if used.

See `default.env` for all configuration options.

## Version

This is TON Docker v1.0.0
35 changes: 0 additions & 35 deletions README.md.example

This file was deleted.

52 changes: 52 additions & 0 deletions default.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# copy to .env and adjust
COMPOSE_FILE=ton.yml

# uncomment to override public ip (kubernetes/special networks)
#PUBLIC_IP=

TON_BRANCH=mainnet

# testnet: https://ton.org/testnet-global.config.json
GLOBAL_CONFIG_URL=https://ton.org/global.config.json

MYTONCTRL_VERSION=master
TELEMETRY=true
IGNORE_MINIMAL_REQS=true
MODE=liteserver

ARCHIVE_TTL=2592000
STATE_TTL=86400
VERBOSITY=1

LITESERVER_PORT=30003
VALIDATOR_PORT=30001
VALIDATOR_CONSOLE_PORT=30002

TON_HOST=ton
TON_API_HOST=ton-api
DOMAIN=example.com

# faster sync (~200GB): latest | latest_testnet | https://dump.ton.org/dumps/latest.tar.lz
SNAPSHOT=

TON_DOCKERFILE=Dockerfile.binary
TON_DOCKER_TAG=latest
TON_DOCKER_REPO=ghcr.io/ton-blockchain/ton-docker-ctrl

# add ton-http-api.yml to COMPOSE_FILE to enable
TON_API_HTTP_PORT=8081
TON_API_LOGS_LEVEL=INFO
TON_API_GET_METHODS_ENABLED=1
TON_API_JSON_RPC_ENABLED=1
TON_API_WEBSERVERS_WORKERS=1
TON_API_CACHE_ENABLED=0
TON_API_ROOT_PATH=/
TON_API_TONLIB_PARALLEL_REQUESTS_PER_LITESERVER=50
TON_API_TONLIB_REQUEST_TIMEOUT=10
TON_API_LOGS_JSONIFY=0
TON_API_GUNICORN_FLAGS=

SCRIPT_TAG=

# do not adjust
ENV_VERSION=1
25 changes: 0 additions & 25 deletions default.env.example

This file was deleted.

28 changes: 13 additions & 15 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,23 @@ __free_space=0
__docker_dir="/var/lib/docker"


# Also adjust version() and __prep_conffiles for your chain, look for the word "Adjust" below
# If you are using an init container, adjust start()

version() {
# script version
grep "^This is" README.md
echo
__var="COMPOSE_FILE"
__get_value_from_env "${__var}" "${__env_file}" "__value"
# Client versions
# Adjust for your clients and how to check their version
# Multiple clients are in multiple case statements. Mutually exclusive clients are in one case statement
# Avoid the use of ;;&
# client versions
case "${__value}" in
*x.yml* )
__docompose exec x-geth x-geth version
*ton.yml* )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not working, make sure ./ethd commands work all of them, ie ./ethd version

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

echo "TON_DOCKER_TAG: $(grep -E '^TON_DOCKER_TAG=' "${__env_file}" | cut -d '=' -f2)"
__docompose exec ton validator-engine -V || true
;;
esac
}


__prep_conffiles() {
# Adjust - this is where sample files would be copied to config files that are meant to be bind-mounted
return
}

Expand Down Expand Up @@ -117,10 +111,8 @@ __env_migrate() {
if [ "${__debug}" -eq 1 ]; then # Find any values in default.env that contain dashes
__error=0
while IFS= read -r __line; do
# Skip blank lines and comments
[[ -z "${__line}" || "${__line}" =~ ^# ]] && continue

# Warn on dash-containing variable names
if [[ "${__line}" =~ ^([A-Za-z0-9_-]+)= ]]; then
__varname="${BASH_REMATCH[1]}"
if [[ "${__varname}" = *-* ]]; then
Expand All @@ -131,7 +123,7 @@ __env_migrate() {
continue
fi
else
continue # Doesn't match variable assignment format
continue
fi
done < "./default.env"
if [ "${__error}" -gt 0 ]; then
Expand Down Expand Up @@ -340,7 +332,6 @@ __update_value_in_env() {
awk_exe="awk"
fi

# Escape backslashes for safety
escaped_value=$(printf '%s' "${new_value}" | sed 's/\\/\\\\/g')

# Check if the variable already exists in the .env file
Expand Down Expand Up @@ -1037,6 +1028,11 @@ cmd() {
}


check-sync() {
bash scripts/check-sync.sh "$@" || true
}


terminate() {
# Assume project name and volume are delimited by _ and there is no _ in the volume name. Done to avoid catching project-2 while looking at project
if [ -z "$(__dodocker volume ls -q -f "name=^$(basename "$(realpath .)" | tr '[:upper:]' '[:lower:]')_[^_]+$")" ]; then
Expand Down Expand Up @@ -1136,6 +1132,8 @@ __full_help() {
echo " shows logs"
echo " cmd <command>"
echo " executes an arbitrary Docker Compose command. Use \"cmd help\" to list them"
echo " check-sync"
echo " call the check sync script to check the sync status of the node"
echo " terminate"
echo " stops the ${__app_name} and destroys all data stores"
echo " space"
Expand Down Expand Up @@ -1237,7 +1235,7 @@ if ! __docompose --help >/dev/null 2>&1; then
fi

case "$__command" in
help|update|up|start|down|stop|restart|version|logs|cmd|terminate|space)
help|update|up|start|down|stop|restart|version|logs|cmd|check-sync|terminate|space)
$__command "$@";;
*)
echo "Unrecognized command $__command"
Expand Down
10 changes: 10 additions & 0 deletions init/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates bash curl pv plzip tar aria2 \
&& rm -rf /var/lib/apt/lists/*

COPY ./fetch-snapshot.sh /usr/local/bin/fetch-snapshot.sh
RUN chmod 755 /usr/local/bin/fetch-snapshot.sh

ENTRYPOINT ["/usr/local/bin/fetch-snapshot.sh"]
Loading