OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Pytoniq

Pytoniq is an MIT-licensed Python SDK for interacting with the TON blockchain. It extends pytoniq-core with a LiteClient and native ADNL implementations, and includes tools and examples for LiteServer requests, block scanning, peer communication and DHT lookups.

Independent OpenViST project profile, based on linked sources.

Pytoniq — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use Pytoniq when a Python project needs direct TON blockchain access or native ADNL and DHT protocol workflows, rather than only a general-purpose blockchain interface.

Who it is for

  • Python developers building applications that query TON blockchain data.
  • Teams implementing TON LiteServer, ADNL or DHT integrations.

Documented uses

  • Connect a Python application to a TON LiteServer and retrieve masterchain information.
  • Scan blocks and inspect transaction messages.
  • Send requests through a LiteBalancer that selects responsive LiteServers.
  • Connect to ADNL peers and perform DHT lookups.
Before you choose

Requirements & limits

  • The SDK is Python-based and its documented client examples use asynchronous operations.
  • LiteClient setup accepts mainnet, testnet or custom configuration and includes trust-level and timeout parameters.
  • LiteBalancer's timeout retry behavior must be explicitly enabled; its peer selection considers liveness, masterchain sequence number and average response time.
  • The repository describes block-link proofs and a local .blockstore for zero-trust-level use.
  • The block-scanning example imports a helper from the repository examples folder that is not available in the PyPI package.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Connect a LiteClient and read TON masterchain information

Install Pytoniq, connect a LiteClient using mainnet configuration, and request masterchain information.

Before you start

  • Python environment capable of installing the pytoniq package.
  • A LiteServer configuration; the example uses LiteClient.from_mainnet_config.
  • An asynchronous Python function for the documented await calls.

Steps

  1. Install the package with the command below.

    Documented command
    pip install pytoniq
  2. Import LiteClient from pytoniq and create a client with LiteClient.from_mainnet_config(ls_i=0, trust_level=2, timeout=15).

  3. Call await client.connect() and then await client.get_masterchain_info().

  4. Close the connection with await client.close(); alternatively, use the documented async with client context manager to request masterchain information.

Expected outcome

The client connects and requests TON masterchain information, then closes the connection or exits its context manager.

Guide limitations

  • The timeout setting does not include key-block synchronization.
  • The documented example shows mainnet configuration; it notes testnet or a custom configuration dictionary as alternatives but does not provide their setup details.
Source-based practical guide

Start an ADNL transport and connect to a peer

Initialize Pytoniq's ADNL receiving server, connect to the documented peer, and shut the server down.

Before you start

  • Pytoniq installed in a Python environment.
  • An asynchronous function for the documented await calls.
  • The peer address, port, and public key shown in the example.

Steps

  1. Create an AdnlTransport with timeout=3 and call await adnl.start().

  2. Create a Node using the example peer values and the transport: Node('172.104.59.125', 14432, "/YDNd+IwRUgL0mq21oC0L3RxrS8gTu0nciSPUrhqR78=", adnl).

  3. Connect with await adnl.connect_to_peer(peer).

  4. Disconnect with await peer.disconnect() and stop the receiving server with await adnl.close().

Expected outcome

The example starts an ADNL receiving server, connects to the specified peer, and then disconnects and closes the server.

Guide limitations

  • The example specifies a particular peer; it does not describe how to obtain or validate other peer details.
  • The sample's optional ping delay is omitted because it is not required to establish and close the documented connection.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
11 October 2026
Original website title
yungwine/pytoniq · Official homepage title · retained in its source language