Configuration
PoktBot is highly configurable. The configuration file is structured in the following sections:
Section TELEGRAM_API
This section holds telegram secrets to run the bot.
SECTION | OPTION | DESCRIPTION | DEFAULT VALUE |
---|---|---|---|
TELEGRAM_API | api_id | API ID number generated at https://my.telegram.org. It is usually an unsigned integer of 64bits. | |
TELEGRAM_API | api_hash | API Hash generated at https://my.telegram.org. It is usually a 32-chars hexadecimal string (16 bytes) | |
TELEGRAM_API | bot_token | Token generated by creating the bot at BotFather. It is usually a string in the format "id:hash" | |
TELEGRAM_API | session_path | Path for the storage of the telegram session. | var/lib/poktbot/telegram/sessions/ |
TELEGRAM_API | session_name | Filename for the telegram session. | poktbot |
Section SERVER
This section holds server configuration, like nodes, database and notification rules.
SECTION | OPTION | DESCRIPTION | DEFAULT VALUE |
---|---|---|---|
SERVER | log_file_location | Filename location for the storage of the logs. | var/log/poktbot.log |
SERVER | database_type | Database backend format. As of PoktBot 0.0.1, it is supported: - joblib: The stored database is a LZ4 compressed joblib data file. |
joblib |
SERVER | database_secret | Secret required by the database backend. As of PoktBot 0.0.1: - joblib: the secret consists of the path location for the storage of the data. |
var/lib/poktbot/db/ |
SERVER | nodes | List of the nodes addresses to track by the bot. A node address is the account of the node. This config option can be updated through the Telegram bot interface (menu nodes ). |
[] |
SERVER | chain_ids | Dictionary of chain IDs supported by the bot. Fields of transactions referencing to these chain ids are translated into the corresponding name. |
"0029": "Algorand" "000D": "Algorand Archival" "0045": "Algorand Testnet" "0A45": "Algorand Testnet Archival" "0030": "Arweave" "0003": "Avalanche" "00A3": "Avalanche Archival" "000E": "Avalanche Fuji" "0004": "Binance Smart Chain" "0010": "Binance Smart Chain Archival" "0011": "Binance Smart Chain Testnet" "0012": "Binance Smart Chain Testnet Archival" "0002": "Bitcoin" "0021": "Ethereum" "0022": "Ethereum Archival" "0028": "Ethereum Archival Trace" "0026": "Ethereum Goerli" "0024": "Ethereum Kovan" "0025": "Ethereum Rinkeby" "0023": "Ethereum Ropsten" "0046": "Evmos" "0005": "FUSE" "000A": "FUSE Archival" "0027": "Gnosis Chain" "000C": "Gnosis Chain Archival" "0040": "Harmony Shard 0" "0A40": "Harmony Shard 0 Archival" "0041": "Harmony Shard 1" "0A41": "Harmony Shard 1 Archival" "0042": "Harmony Shard 2" "0A42": "Harmony Shard 2 Archival" "0043": "Harmony Shard 3" "0A43": "Harmony Shard 3 Archival" "0044": "IoTeX" "0047": "OKExChain" "0001": "Pocket Network" "0009": "Polygon" "000B": "Polygon Archival" "000F": "Polygon Mumbai" "00AF": "Polygon Mumbai Archival" "0006": "Solana" "0031": "Solana Testnet" |
SERVER | api_url_transactions | Backend URL to fetch transactions data. | https://poktscan.com/api/graphql?opname=transactions |
SERVER | api_url_errors | Backend URL to fetch node errors. | https://poktscan.com/api/graphql?opname=getNodeErrors |
SERVER | api_max_page_count | How many pages the node API will request at most in a single shot. Note that this attribute limits the number of HTTP requests made to the API between observer updates. If the total number of pages retrieved are fewer than the available pages, the database will take several observer updates to be up to date. In other words: the first update may not fill the database until "now" if the number of pages to retrieve are greater than this value; but further updates might get up to date. |
2 |
SERVER | api_page_size | Number of elements to retrieve for each API call. The greater, the fewer pages to iterate; but the higher delay in response time too | 1000 |
SERVER | api_date_format | Format for the date returned by the API. This format is used to transform the string dates into datetime objects. | %Y-%m-%dT%H:%M:%S.%f |
SERVER | error_rules | List of rules that allows tracking error notifications. Every rule has up to 3 possible fields: * find: RegEx text to match in order to trigger the notification * notify_many: If a single error retrieval yields many error lines that match the same find RegEx, the message in this field is sent to the admins.* notify_single: If there is only a single line matching the error, this message is sent instead. The notification has access to the following fields: * address: Node account address source of the issue. * count: Number of lines that matched (only available in notify_many )* begintime_formatted: Datetime at which the first error was notified (only available in notify_many )* endtime_formatted: Datetime at which the last error was notified (only available in notify_many ) * time_formatted: Datetime at which the error was notified (only available in notify_single )An example of two notification rules are as follows:
|
[] |
SERVER | errors_notification_max_age | Maximum age that an unreported error can have. Errors older than this age are not reported. This ensures that spam notification is avoided at first run (cold start) | 1 days |
SERVER | rewards_multiplier_date_format | Multiplier date format for every entry in option rewards_multiplier . |
%d/%m/%Y %H:%M:%S |
SERVER | rewards_multiplier | List of rewards multiplier changes over time. Every item in the list must contain a date and a reward float value. The date must be UTC located and its format must be compliant with rewards_multiplier_date_format . |
- date: "28/02/2022 17:41:00" |
Section PRICES
This section holds prices API configuration, like backend and currency format.
SECTION | OPTION | DESCRIPTION | DEFAULT VALUE |
---|---|---|---|
PRICES | coingecko_url | URL from the API of Coingecko to fetch prices from. | https://api.coingecko.com/api/v3/coins/{cryptocurrency}/market_chart/range?id=pocket-network&vs_currency={currency}&from={start}&to={end} |
PRICES | currency | Currency format for the retrieved information. | eur |
PRICES | currency_alias | Currency alias is the currency suffix name in the column of the files generated in the balances menu. Have correspondence with the PRICE.currency value. |
Euro |
Section IDS
This section holds IDS that are allowed to interact with the bot. The IDs are structured in a RBAC system, being 2 roles currently implemented as of version 0.0.1:
SECTION | OPTION | DESCRIPTION | DEFAULT VALUE |
---|---|---|---|
IDS | admins_ids | Administrators of the bot. This parameter holds telegram IDs of allowed users with granted permission to change configuration, add/remove investors & admins, and receive node status/error notifications. |
[] |
IDS | investors_ids | Investors of the bot. This parameter holds telegram IDs of users that are allowed to access statistics and rewards information. |
[] |
Section CONF
This section holds global configuration of the system, like timeouts and timers intervals.
SECTION | OPTION | DESCRIPTION | DEFAULT VALUE |
---|---|---|---|
CONF | admins_ids | Administrators of the bot. This parameter holds telegram IDs of allowed users with granted permission to change configuration, add/remove investors & admins, and receive node status notifications. |
[] |
CONF | investors_ids | Investors of the bot. This parameter holds telegram IDs that are allowed to access statistics. |
eur |
CONF | global_timeout | Global timeout in seconds for Telegram commands interaction (when requesting data to the user). | 20 |
CONF | global_periodic_time | Interval in seconds for the observation of new transactions, errors and prices. | 240 |
CONF | timezone | Timezone at which every datetime will be located when generating reports. | Europe/Madrid |
CONF | date_format | Datetime format for the reports. Supported formats: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes. |
%d/%m/%Y %H:%M:%S %z |
CONF | last_days_stats_graph | Number of days to display in the stats graph. | 15 |
Minimum configuration file
Options that contain default values can be omitted from the config file. A minimum configuration file looks as follows:
---
TELEGRAM_API:
api_hash: <<YOUR API HASH>>
api_id: <<YOUR API ID>>
bot_token: <<YOUR BOT TOKEN>>
IDS:
admins_ids:
- <<YOUR TELEGRAM ID>>
- <<THE TELEGRAM ID OF THE ADMINISTRATOR 2>>
...
investors_ids:
- <<THE TELEGRAM ID OF THE INVESTOR 1>>
- <<THE TELEGRAM ID OF THE INVESTOR 2>>
...
SERVER:
nodes:
- <<YOUR NODE 1 ACCOUNT HASH>>
- <<YOUR NODE 2 ACCOUNT HASH>>
...