Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
33 changes: 22 additions & 11 deletions book/src/framework/components/blockchains/ton.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ TON (The Open Network) support in the framework utilizes MyLocalTon Docker Compo
[blockchain_a]
type = "ton"
image = "ghcr.io/neodix42/mylocalton-docker:latest"
service_profile = "core" # "core" (default) or "full"
```

## Default Ports
## Service Profiles

The TON implementation exposes several services:
* Core (default): Genesis node only
* Full: Genesis + HTTP API + Faucet + Explorer + Indexing services

- TON Lite Server: Port 40004
- TON HTTP API: Port 8081
- TON Simple HTTP Server: Port 8000
- TON Explorer: Port 8080
## Ports

Ports are allocated based on the base port (default 8000):

* Base: Genesis HTTP server
* Base + 10: TON HTTP API (full profile)
* Base + 20: Block Explorer (full profile)
* Base + 30: Index API (full profile)
* Base + 40: Faucet (full profile)
* Base + 50: Lite Server

> **Note**: By default, only the lite client service is exposed externally. Other services may need additional configuration to be accessible outside the Docker network.

Expand All @@ -31,6 +39,7 @@ By default, the MyLocalTon environment starts with only one validator enabled. I
package examples

import (
"fmt"
"strings"
"testing"

Expand Down Expand Up @@ -59,27 +68,27 @@ func TestTonSmoke(t *testing.T) {
t.Run("setup:connect", func(t *testing.T) {
// Create a connection pool
connectionPool := liteclient.NewConnectionPool()

// Get the network configuration from the global config URL
cfg, cferr := liteclient.GetConfigFromUrl(t.Context(), fmt.Sprintf("http://%s/localhost.global.config.json", bc.Nodes[0].ExternalHTTPUrl))
require.NoError(t, cferr, "Failed to get config from URL")

// Add connections from the config
caerr := connectionPool.AddConnectionsFromConfig(t.Context(), cfg)
require.NoError(t, caerr, "Failed to add connections from config")

// Create an API client with retry functionality
client = ton.NewAPIClient(connectionPool).WithRetry()

t.Run("setup:faucet", func(t *testing.T) {
// Create a wallet from the pre-funded high-load wallet seed
rawHlWallet, err := wallet.FromSeed(client, strings.Fields(blockchain.DefaultTonHlWalletMnemonic), wallet.HighloadV2Verified)
require.NoError(t, err, "failed to create highload wallet")

// Create a workchain -1 (masterchain) wallet
mcFunderWallet, err := wallet.FromPrivateKeyWithOptions(client, rawHlWallet.PrivateKey(), wallet.HighloadV2Verified, wallet.WithWorkchain(-1))
require.NoError(t, err, "failed to create highload wallet")

// Get subwallet with ID 42
funder, err := mcFunderWallet.GetSubwallet(uint32(42))
require.NoError(t, err, "failed to get highload subwallet")
Expand All @@ -96,13 +105,15 @@ func TestTonSmoke(t *testing.T) {
})
})
}

```

## Test Private Keys

The framework includes a pre-funded high-load wallet for testing purposes. This wallet type can send up to 254 messages per 1 external message, making it efficient for test scenarios.

Default High-Load Wallet:

```
Address: -1:5ee77ced0b7ae6ef88ab3f4350d8872c64667ffbe76073455215d3cdfab3294b
Mnemonic: twenty unfair stay entry during please water april fabric morning length lumber style tomorrow melody similar forum width ride render void rather custom coin
Expand Down
3 changes: 3 additions & 0 deletions framework/components/blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ type Input struct {
// GAPv2 specific params
HostNetworkMode bool `toml:"host_network_mode"`
CertificatesPath string `toml:"certificates_path"`

// Ton specific params
ServiceProfile string `toml:"service_profile" validate:"omitempty,oneof=core full"`
}

// Output is a blockchain network output, ChainID and one or more nodes that forms the network
Expand Down
Loading
Loading