Skip to content

External messages delivery monitoring with a fancy smart contract written in Fift-ASM. Sends externals and finds them in the blockchain.

Notifications You must be signed in to change notification settings

1IxI1/delivery-monitor

Repository files navigation

TON External messages delivery monitor

This script sends a unique external message every N seconds to each of his wallets and then waits for them, saving the stats about ones delivered.

Of course, it can be run with different providers to check for any issues with Lite Servers.

How to use

Deploy a log-wallet using script ts/deployC5.ts.

Create wallets.txt file with your new loggers:

EQAWgUoE0qsUDUJMJXH25H__mATCdGkhVDQtCw06nOqXoDJ9 0309251779ebe8f2a4ccb10f4edcf2243e78764d63bb11c146fec926eb819512
EQBPXbJUj91i2jkcyghHLUbF27wxM1oLpLp99yeyAugDAEYv d2c97e8439ba407e448f8864961480483089cb8a83e2a8085d67b4feda6765e2

The second column here is the wallet's seed - 64 hex characters.

Add as many wallets as you want.

Run:

cp monitors.json.example monitors.json
# edit monitors.json as you need
pip install -r requirements.txt
python start.py

It can run in server mode and in cli mode. First will write log in monitor.json, second will print all in stdout.
To choose, edit "cli": true, in monitors.json.

If "to_send" is not set, script will infinetly monitor this provider.

See more in Configuration section.

What is log-wallet

It's a thing that just receives external messages in a very cheap way (now < 0.0013 TON per tx).

It works mainly as v3r2 wallet, but:

  • without sending messages (i.e. just sign verification, valid_until check, seqno update).
  • it uses no c4, but ONLY ITS CODE as a STORAGE for pubkey and seqno.

On each external_msg, it applies c5 from msg, which should have the set_code_action with code generated by this (logger-c5.fif) script.

See logger-c5.fif.

Configuration

Here's an example of how you may fill monitors.json:

{
    "cli": true,
    "monitors": [
        {
            "enabled": true,
            "provider": "liteserver",
            "wallets": "mywallets/w-c5-1.txt",
            "config": "configs/testnet.json",
            "dbname": "ls",
            "to_send": 10
        },
        {
            "enabled": false,
            "provider": "toncenter",
            "wallets": "mywallets/w-c5-2.txt",
            "toncenter_api_url": "https://testnet.toncenter.com/api/v2/",
            "toncenter_api_key": "...",
            "dbname": "tc"
        },
        {
            "enabled": true,
            "provider": "tonapi",
            "wallets": "mywallets/w-c5-3.txt",
            "testnet": true,
            "tonapi_key": "..."
        }
    ]
}

This config will monitor 2 providers with different wallets.

And the second, toncenter, is disabled here. it won't be monitored.

dbname is the name of the database file in db/ dir. If not set, it will equal specified provider (e.g. here tonapi will use db/tonapi.db).

Results database

In db/ dir, in an sqlite database you will find all the transactions you've sent on wallets, with their delivery times.

  • utime - timestamp of sending
  • executed_in - seconds between sending and block where the message was found
  • found_in - seconds between sending and time when script got the info from provider

db/toncenter.db example:

addr utime is_found executed_in found_in
EQBPXbJUj91i2jkcyghHLUbF27wxM1oLpLp99yeyAugDAEYv 1709637119 true 3 12
EQAlt8tyJ75FRhDMDgL0sX-x93PTE7n16rfmg_Cv4KQgwdz5 1709637120 true 2 11
EQCc7AtrG7xHT76LEVl2OqnkHN-BLJtCWquRVidvY5e8VyDk 1709637118 true 2 14
EQCznq_pKOQMnUpGWY4qb9SAzqc0NmtF0vGUdJLp4hXi0T8A 1709637110 true 7 22
EQAWgUoE0qsUDUJMJXH25H__mATCdGkhVDQtCw06nOqXoDJ9 1709637182 true 7 16
EQAfX-dlqHKsGtAE6zeLvFcqjTTuXD7imNN4sI3Q5uwqle4D 1709637188 true 1 11

About

External messages delivery monitoring with a fancy smart contract written in Fift-ASM. Sends externals and finds them in the blockchain.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published