diff --git a/docs/develop/network/overlay.md b/docs/develop/network/overlay.md index 45f7cfe601..d9cde079b7 100644 --- a/docs/develop/network/overlay.md +++ b/docs/develop/network/overlay.md @@ -1,5 +1,10 @@ # Overlay subnetworks +Implementation: +* https://github.com/ton-blockchain/ton/tree/master/overlay + +## Overview + The architecture of TON is built in such a way that a lot of chains can exist simultaneously and independently in it - they can be both private or public. Nodes have the ability to choose which shards and chains they store and process. At the same time, the communication protocol remains unchanged due to its universality. Protocols such as DHT, RLDP and Overlays allow this to be achieved. @@ -11,6 +16,21 @@ All chains in TON, including the masterchain, communicate using their own overla To join it, you need to find the nodes that are already in it, and start exchanging data with them. For the public overlays you can find nodes using DHT. +## ADNL vs Overlay networks + +In contrast to ADNL, the TON overlay networks usually do not support +sending datagrams to other arbitrary nodes. Instead, some “semi-permanent +links” are established between certain nodes (called “neighbors” with respect to +the overlay network under consideration) and messages are usually forwarded +along these links (i.e. from a node to one of its neighbors). + +Each overlay subnetwork has a 256-bit network identifier usually equal +to a SHA256 of the description of the overlay network—a TL-serialized object. + +Overlay subnetworks can be public or private. + +Overlay subnetworks work according to a special [gossip](https://en.wikipedia.org/wiki/Gossip_protocol) protocol. + ## Interaction with overlay nodes We have already analyzed an example with finding overlay nodes in an article about DHT, @@ -70,4 +90,4 @@ Thus, we can receive information directly from the nodes. ## References -_Here a [link to the original article](https://github.com/xssnick/ton-deep-doc/blob/master/Overlay-Network.md) by [Oleg Baranov](https://github.com/xssnick)._ \ No newline at end of file +_Here a [link to the original article](https://github.com/xssnick/ton-deep-doc/blob/master/Overlay-Network.md) by [Oleg Baranov](https://github.com/xssnick)._ diff --git a/docs/develop/network/rldp.md b/docs/develop/network/rldp.md index 5d1e01e071..fc4b03b231 100644 --- a/docs/develop/network/rldp.md +++ b/docs/develop/network/rldp.md @@ -1,5 +1,12 @@ # RLDP +Implementation: +* https://github.com/ton-blockchain/ton/tree/master/rldp +* https://github.com/ton-blockchain/ton/tree/master/rldp2 +* https://github.com/ton-blockchain/ton/tree/master/rldp-http-proxy + +## Overview + RLDP - Reliable Large Datagram Protocol - is a protocol that runs on top of ADNL UDP, which is used to transfer large data blocks and includes Forward Error Correction (FEC) algorithms as a replacement of acknowledgment packets on the other side. This makes it possible to transfer data between network components more efficiently, but with more traffic consumption. @@ -179,4 +186,4 @@ If `last` = true, then we have reached the end, we can put all the pieces togeth ## References -_Here a [link to the original article](https://github.com/xssnick/ton-deep-doc/blob/master/RLDP.md) by [Oleg Baranov](https://github.com/xssnick)._ \ No newline at end of file +_Here a [link to the original article](https://github.com/xssnick/ton-deep-doc/blob/master/RLDP.md) by [Oleg Baranov](https://github.com/xssnick)._ diff --git a/docs/develop/smart-contracts/tutorials/wallet.md b/docs/develop/smart-contracts/tutorials/wallet.md index 03fe849e5e..1cdd60b34e 100644 --- a/docs/develop/smart-contracts/tutorials/wallet.md +++ b/docs/develop/smart-contracts/tutorials/wallet.md @@ -2105,7 +2105,7 @@ When working with many messages in a short period, there is a need for special w :::note We will work [with a slightly modified version of Wrapper](https://github.com/aSpite/highload-wallet-contract-v3/blob/main/wrappers/HighloadWalletV3.ts) for the contract, as it protects against some non-obvious mistakes. -:::note +::: ### Storage Structure diff --git a/docs/learn/academy/academy-overview.md b/docs/learn/academy/academy-overview.mdx similarity index 100% rename from docs/learn/academy/academy-overview.md rename to docs/learn/academy/academy-overview.mdx diff --git a/docs/learn/networking/overlay-subnetworks.md b/docs/learn/networking/overlay-subnetworks.md deleted file mode 100644 index 2fd35cfbb2..0000000000 --- a/docs/learn/networking/overlay-subnetworks.md +++ /dev/null @@ -1,33 +0,0 @@ -# Overlay Subnetworks - -Implementation: -* https://github.com/ton-blockchain/ton/tree/master/overlay - -## Overview - -In a multi-blockchain system like TON, even full nodes would usually be interested in obtaining updates (i.e., new blocks) only around -a few shardchains. To this end, a special overlay subnetwork has been built -inside the TON Network, on top of the ADNL Protocol, -for each shardchain. - -Also, overlay subnetworks are used for the operation of TON Storage, TON Proxy and so on. - -## ADNL vs Overlay networks - -In contrast to ADNL, the TON overlay networks usually do not support -sending datagrams to other arbitrary nodes. Instead, some “semi-permanent -links” are established between certain nodes (called “neighbors” with respect to -the overlay network under consideration) and messages are usually forwarded -along these links (i.e. from a node to one of its neighbors). - -Each overlay subnetwork has a 256-bit network identifier usually equal -to a SHA256 of the description of the overlay network—a TL-serialized object. - -Overlay subnetworks can be public or private. - -Overlay subnetworks work according to a special [gossip](https://en.wikipedia.org/wiki/Gossip_protocol) protocol. - -:::info -Read more about overlays in [Overlay subnetworks](/develop/network/overlay) article, or in Chapter 3.3 of the [TON Whitepaper](https://ton.org/docs/ton.pdf). -::: - diff --git a/docs/learn/networking/overview.md b/docs/learn/networking/overview.md index 396be45e1d..e90fe3a026 100644 --- a/docs/learn/networking/overview.md +++ b/docs/learn/networking/overview.md @@ -19,3 +19,9 @@ The TON Project uses its own peer-to-peer network protocols. blockchain itself, thus providing more possibilities and flexibility for creating new services in the TON Ecosystem. +## See Also + +* [ADNL Protocol](/learn/networking/adnl) +* [Overlay Subnetworks](/learn/networking/overlay-subnetworks) +* [RLDP Protocol](/learn/networking/rldp) +* [TON DHT Service](/learn/networking/ton-dht) diff --git a/docs/learn/networking/rldp.md b/docs/learn/networking/rldp.md deleted file mode 100644 index 91f5620585..0000000000 --- a/docs/learn/networking/rldp.md +++ /dev/null @@ -1,17 +0,0 @@ -# RLDP Protocol - -Implementation: -* https://github.com/ton-blockchain/ton/tree/master/rldp -* https://github.com/ton-blockchain/ton/tree/master/rldp2 -* https://github.com/ton-blockchain/ton/tree/master/rldp-http-proxy - -## Overview - -A reliable arbitrary-size datagram protocol built upon the ADNL, called RLDP, -is used instead of a TCP-like protocol. This reliable datagram protocol can -be employed, for instance, to send RPC queries to remote hosts and receive -answers from them. - -:::info -Detailed description with examples can be found in [RLDP](/develop/network/rldp) article of `develop` section. -::: \ No newline at end of file diff --git a/docs/learn/overviews/addresses.md b/docs/learn/overviews/addresses.md index d5b89d9e89..5557a198af 100644 --- a/docs/learn/overviews/addresses.md +++ b/docs/learn/overviews/addresses.md @@ -1,4 +1,4 @@ -# Smart Contract Addresses +# Smart Contract Addresses Documentation This section will describe the specifics of smart contract addresses on TON Blockchain. It will also explain how actors are synonymous with smart contracts on TON. diff --git a/docs/participate/wallets/apps.mdx b/docs/participate/wallets/apps.mdx index b7fa178207..87740ac926 100644 --- a/docs/participate/wallets/apps.mdx +++ b/docs/participate/wallets/apps.mdx @@ -1,6 +1,6 @@ import Player from '@site/src/components/player' -# Wallet Apps (for Devs) +# Wallet Apps ## Overview diff --git a/docs/participate/wallets/contracts.md b/docs/participate/wallets/contracts.md index 0b48e53ec7..07930cf4d8 100644 --- a/docs/participate/wallets/contracts.md +++ b/docs/participate/wallets/contracts.md @@ -101,64 +101,9 @@ Sometimes the functionality of basic wallets isn't enough. That's why there are Let's have a look at them. -### Highload Wallet v3 +### Highload Wallets -This wallet is made for who need to send transactions at very high rates. For example, crypto exchanges. - -- [Source code](https://github.com/ton-blockchain/highload-wallet-contract-v3) - -Any given external message (transfer request) to a highload v3 contains: -- a signature (512 bits) in the top level cell - the other parameters are in the ref of that cell -- subwallet ID (32 bits) -- message to send as a ref (the serialized internal message that will be sent) -- send mode for the message (8 bits) -- composite query ID - 13 bits of "shift" and 10 bits of "bit number", however the 10 bits of bit number can only go up to 1022, not 1023, and also the last such usable query ID (8388605) is reserved for emergencies and should not be normally used -- created at, or message timestamp -- timeout - -Timeout is stored in highload as a parameter and is checked against the timeout in all requests - so the timeout for all requests is equal. The message should be not older than timeout at the time of arrival to the highload wallet, or in code it is required that `created_at > now() - timeout`. Query IDs are stored for the purposes of replay protection for at least timeout and possibly up to 2 * timeout, however one should not expect them to be stored for longer than timeout. Subwallet ID is checked against the one stored in the wallet. Inner ref's hash is checked along with the signature against the public key of the wallet. - -Highload v3 can only send 1 message from any given external message, however it can send that message to itself with a special op code, allowing one to set any action cell on that internal message invocation, effectively making it possible to send up to 254 messages per 1 external message (possibly more if another message is sent to highload wallet again among these 254). - -Highload v3 will always store the query ID (replay protection) once all the checks pass, however a message may not be sent due to some conditions, including but not limited to: -- **containing state init** (such messages, if required, may be sent using the special op code to set the action cell after an internal message from highload wallet to itself) -- not enough balance -- invalid message structure (that includes external out messages - only internal messages may be sent straight from the external message) - -Highload v3 will never execute multiple externals containing the same `query_id` **and** `created_at` - by the time it forgets any given `query_id`, the `created_at` condition will prevent such a message from executing. This effectively makes `query_id` **and** `created_at` together the "primary key" of a transfer request for highload v3. - -When iterating (incrementing) query ID, it is cheaper (in terms of TON spent on fees) to iterate through bit number first, and then the shift, like when incrementing a regular number. After you've reached the last query ID (remember about the emergency query ID - see above), you can reset query ID to 0, but if highload's timeout period has not passed yet, then the replay protection dictionary will be full and you will have to wait for the timeout period to pass. - - -### Highload wallet v2 - -:::danger -Legacy contract, it is suggest to use High-load wallet v3. -::: - -This wallet is made for those who need to send hundreds of transactions in a short period of time. For example, crypto exchanges. - -It allows you to send up to `254` transactions in one smart contract call. It also uses a slightly different approach to solve replay attacks instead of seqno, so you can call this wallet several times at once to send even thousands of transactions in a second. - -:::caution Limitations -Note, when dealing with highload-wallet the following limits need to be checked and taken into account. -::: - -1. **Storage size limit.** Currently, size of contract storage should be less than 65535 cells. If size of -old_queries will grow above this limit, exception in ActionPhase will be thrown and transaction will fail. -Failed transaction may be replayed. -2. **Gas limit.** Currently, gas limit is 1'000'000 GAS units, that means that there is a limit of how much -old queries may be cleaned in one tx. If number of expired queries will be higher, contract will stuck. - -That means that it is not recommended to set too high expiration date: -number of queries during expiration time span should not exceed 1000. - -Also, number of expired queries cleaned in one transaction should be below 100. - - - -Wallet source code: - * [ton/crypto/smartcont/highload-wallet-v2-code.fc](https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/highload-wallet-v2-code.fc) +When working with many messages in a short period, there is a need for special wallet called Highload Wallet. Read [the article](/participate/wallets/highload) for more information. ### Lockup wallet diff --git a/docs/participate/wallets/highload.md b/docs/participate/wallets/highload.md new file mode 100644 index 0000000000..e1fb3fcc19 --- /dev/null +++ b/docs/participate/wallets/highload.md @@ -0,0 +1,64 @@ +# Highload Wallet + +When working with many messages in a short period, there is a need for special wallet called Highload Wallet. Highload Wallet V2 was the main wallet on TON for a long time, but you had to be very careful with it. Otherwise, you could [lock all funds](https://t.me/tonstatus/88). + +[With the advent of Highload Wallet V3](https://github.com/ton-blockchain/Highload-wallet-contract-v3), this problem has been solved at the contract architecture level and consumes less gas. This chapter will cover the basics of Highload Wallet V3 and important nuances to remember. + +## Highload Wallet v3 + +This wallet is made for who need to send transactions at very high rates. For example, crypto exchanges. + +- [Source code](https://github.com/ton-blockchain/Highload-wallet-contract-v3) + +Any given external message (transfer request) to a Highload v3 contains: +- a signature (512 bits) in the top level cell - the other parameters are in the ref of that cell +- subwallet ID (32 bits) +- message to send as a ref (the serialized internal message that will be sent) +- send mode for the message (8 bits) +- composite query ID - 13 bits of "shift" and 10 bits of "bit number", however the 10 bits of bit number can only go up to 1022, not 1023, and also the last such usable query ID (8388605) is reserved for emergencies and should not be normally used +- created at, or message timestamp +- timeout + +Timeout is stored in Highload as a parameter and is checked against the timeout in all requests - so the timeout for all requests is equal. The message should be not older than timeout at the time of arrival to the Highload wallet, or in code it is required that `created_at > now() - timeout`. Query IDs are stored for the purposes of replay protection for at least timeout and possibly up to 2 * timeout, however one should not expect them to be stored for longer than timeout. Subwallet ID is checked against the one stored in the wallet. Inner ref's hash is checked along with the signature against the public key of the wallet. + +Highload v3 can only send 1 message from any given external message, however it can send that message to itself with a special op code, allowing one to set any action cell on that internal message invocation, effectively making it possible to send up to 254 messages per 1 external message (possibly more if another message is sent to Highload wallet again among these 254). + +Highload v3 will always store the query ID (replay protection) once all the checks pass, however a message may not be sent due to some conditions, including but not limited to: +- **containing state init** (such messages, if required, may be sent using the special op code to set the action cell after an internal message from Highload wallet to itself) +- not enough balance +- invalid message structure (that includes external out messages - only internal messages may be sent straight from the external message) + +Highload v3 will never execute multiple externals containing the same `query_id` **and** `created_at` - by the time it forgets any given `query_id`, the `created_at` condition will prevent such a message from executing. This effectively makes `query_id` **and** `created_at` together the "primary key" of a transfer request for Highload v3. + +When iterating (incrementing) query ID, it is cheaper (in terms of TON spent on fees) to iterate through bit number first, and then the shift, like when incrementing a regular number. After you've reached the last query ID (remember about the emergency query ID - see above), you can reset query ID to 0, but if Highload's timeout period has not passed yet, then the replay protection dictionary will be full and you will have to wait for the timeout period to pass. + + +## Highload wallet v2 + +:::danger +Legacy contract, it is suggest to use Highload wallet v3. +::: + +This wallet is made for those who need to send hundreds of transactions in a short period of time. For example, crypto exchanges. + +It allows you to send up to `254` transactions in one smart contract call. It also uses a slightly different approach to solve replay attacks instead of seqno, so you can call this wallet several times at once to send even thousands of transactions in a second. + +:::caution Limitations +Note, when dealing with Highload wallet the following limits need to be checked and taken into account. +::: + +1. **Storage size limit.** Currently, size of contract storage should be less than 65535 cells. If size of +old_queries will grow above this limit, exception in ActionPhase will be thrown and transaction will fail. +Failed transaction may be replayed. +2. **Gas limit.** Currently, gas limit is 1'000'000 GAS units, that means that there is a limit of how much +old queries may be cleaned in one tx. If number of expired queries will be higher, contract will stuck. + +That means that it is not recommended to set too high expiration date: +number of queries during expiration time span should not exceed 1000. + +Also, number of expired queries cleaned in one transaction should be below 100. + + + +Wallet source code: + * [ton/crypto/smartcont/Highload-wallet-v2-code.fc](https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/Highload-wallet-v2-code.fc) \ No newline at end of file diff --git a/docs/v3/concepts/ton-blockchain/shards.md b/docs/v3/concepts/ton-blockchain/shards.md new file mode 100644 index 0000000000..9b0fc8cd8d --- /dev/null +++ b/docs/v3/concepts/ton-blockchain/shards.md @@ -0,0 +1,25 @@ +# Overview: Sharding and Split Merge in the TON Blockchain + +[//]: # (TODO, this is from gpt) + +The TON Blockchain employs advanced sharding mechanisms to enhance scalability and performance, allowing it to efficiently process a massive number of transactions. +The core concept is splitting the blockchain into smaller, independent pieces called **shards**. These shards can handle transactions in parallel, ensuring high throughput even as the network grows. + +In TON, sharding is highly dynamic. Unlike other blockchains, which have a fixed number of shards, TON can create new shards on demand. +As the transaction load increases, shards split, and as the load decreases, they merge. +This flexibility ensures that the system can adapt to varying workloads while maintaining efficiency. + +The **Masterchain** plays a crucial role, maintaining the network configuration and the final state of all **workchains** and **shardchains**. +While the masterchain is responsible for overall coordination, **workchains** operate under their specific rules, each of which can be split further into shardchains. +Currently, only one workchain (the **Basechain**) operates on TON. + +At the heart of TON's efficiency is the **Infinity Sharding Paradigm**, which treats each account as part of its own "accountchain." +These accountchains are then aggregated into shardchain blocks, facilitating efficient transaction processing. + +In addition to the dynamic creation of shards, TON uses **Split Merge** functionality, which allows the network to efficiently respond to changing transaction loads. This system enhances scalability and interaction within the blockchain network, exemplifying TON's approach to resolving common blockchain challenges with a focus on efficiency and global consistency. + + +## See Also + +* [Shards Dive In](/develop/blockchain/shards) +* [# Infinity Sharding Paradigm](/develop/blockchain/sharding-lifecycle) diff --git a/docs/v3/concepts/ton-blockchain/smart-contract-addresses.md b/docs/v3/concepts/ton-blockchain/smart-contract-addresses.md new file mode 100644 index 0000000000..916fced315 --- /dev/null +++ b/docs/v3/concepts/ton-blockchain/smart-contract-addresses.md @@ -0,0 +1,55 @@ +# Smart Contract Addresses + +[//]: # (TODO, this is gpt) + +On the TON Blockchain, every actor, including wallets and smart contracts, is represented by an address. These addresses are critical for receiving and sending messages and transactions. There are two main formats for smart contract addresses: **raw addresses** and **user-friendly addresses**. + +## Address Components + +Each address on TON consists of two main components: +- **Workchain ID**: A signed 32-bit integer that denotes which workchain the contract belongs to (e.g., `-1` for the Masterchain and `0` for the Basechain). +- **Account ID**: A unique identifier for the contract, generally 256 bits in length for the Masterchain and Basechain. + +## Raw vs. User-Friendly Addresses + +### Raw Address +A **raw address** contains only the basic elements: +- **Workchain ID** (e.g., `-1` for Masterchain) +- **Account ID**: A 256-bit unique identifier + +Example: +`-1:fcb91a3a3816d0f7b8c2c76108b8a9bc5a6b7a55bd79f8ab101c52db29232260` + +However, raw addresses have two main issues: +1. They lack built-in error checking, meaning a mistake in copying can lead to loss of funds. +2. They do not support additional features like bounceable/non-bounceable flags. + +### User-Friendly Address + +A **user-friendly address** solves these problems by incorporating: +1. **Flags**: Indicates if the address is bounceable (for contracts) or non-bounceable (for wallets). +2. **Checksum**: A 2-byte error-checking mechanism (CRC16) that helps detect errors before sending. +3. **Encoding**: Transforms the raw address into a readable, compact form using base64 or base64url. + +For example, the same raw address can be converted into a user-friendly address like: +`kf/8uRo6OBbQ97jCx2EIuKm8Wmt6Vb15+KsQHFLbKSMiYIny` (base64) + +User-friendly addresses make transactions safer by preventing errors and allowing the return of funds in case of failed transactions. + +## Address States + +Each address on TON can be in one of the following states: +- **Nonexist**: The address has no data (initial state for all addresses). +- **Uninit**: The address has a balance but no smart contract code. +- **Active**: The address is live with smart contract code and balance. +- **Frozen**: The address is locked due to storage costs exceeding its balance. + +## Converting Between Address Formats + +To convert between raw and user-friendly addresses, you can use TON APIs or developer tools like [ton.org/address](https://ton.org/address). These utilities allow seamless conversion and ensure proper formatting before sending transactions. + +For more details on how to handle these addresses, including encoding examples and transaction security, you can refer to the full guide in [Addresses Documentation](/learn/overviews/addresses). + +## See Also + +* [Smart Contracts Addresses Documentation](/learn/overviews/addresses) diff --git a/docs/guidelines/README.md b/docs/v3/guidelines/nodes/overview.md similarity index 100% rename from docs/guidelines/README.md rename to docs/v3/guidelines/nodes/overview.md diff --git a/docs/v3/guidelines/overview.md b/docs/v3/guidelines/overview.md new file mode 100644 index 0000000000..0f39f90424 --- /dev/null +++ b/docs/v3/guidelines/overview.md @@ -0,0 +1,3 @@ +# Overview + +// TODO: need to be written \ No newline at end of file diff --git a/mv.py b/mv.py new file mode 100644 index 0000000000..852c793bb4 --- /dev/null +++ b/mv.py @@ -0,0 +1,144 @@ +import os +import re +import json +import time +from watchdog.observers import Observer +from watchdog.events import FileSystemEventHandler + +redirect_data = [] + +class MoveEventHandler(FileSystemEventHandler): + def on_moved(self, event): + if '.git' in event.src_path or '.git' in event.dest_path: + return + + if event.is_directory: + print(f"Directory moved from {event.src_path} to {event.dest_path}") + else: + print(f"File moved from {event.src_path} to {event.dest_path}") + + repo_path = os.getcwd() + + source = get_redirect(event.src_path, repo_path) + destination = get_redirect(event.dest_path, repo_path) + + print("from_r:",source) + print("to_r:", destination) + + # path_r = destination.split("/")[1] + json_file = f"./redirects/redirects.json" + file_extensions = ['.mdx', '.md'] + + replace_in_repo(repo_path, source, destination, file_extensions) + redirect(json_file, source, destination) + + +def start_monitoring(path): + event_handler = MoveEventHandler() + observer = Observer() + observer.schedule(event_handler, path, recursive=True) + + print(f"Monitoring moves in: {path}") + observer.start() + + try: + while True: + time.sleep(1) + except KeyboardInterrupt: + observer.stop() + + observer.join() + +def find_markdown_links(text): + md_link_pattern = r'\[([^\]]+)\]\(([^#)]+)([^)]*)\)' + matches = re.findall(md_link_pattern, text) + + return matches + +def replace_word_in_file(file_path, target, replacement): + with open(file_path, 'r', encoding='utf-8') as file: + content = file.read() + + + links = find_markdown_links(content) + + content_replaced = '' + for _, url, _ in links: + if url == target: + content_replaced = content.replace(url, replacement) + + if content_replaced != '' and content != content_replaced: + with open(file_path, 'w', encoding='utf-8') as file: + file.write(content_replaced) + print(f"Replaced in file: {file_path}") + +def replace_in_repo(repo_path, target, replacement, file_extensions=None): + for root, dirs, files in os.walk(repo_path): + if '.git' in root or 'i18n' in root: + continue + + if root == repo_path: + for file_name in files: + if file_name == "navbar.js" or file_name == "redirects.js": + file_path = os.path.join(root, file_name) + replace_word_in_file(file_path, target, replacement) + continue + + path_list = root.split(repo_path) + if len(path_list) > 1 and path_list[1] == "/sidebars": + for file_name in files: + file_path = os.path.join(root, file_name) + replace_word_in_file(file_path, target, replacement) + continue + + for file_name in files: + if file_extensions: + if not any(file_name.endswith(ext) for ext in file_extensions): + continue + + if root.find("node_modules") != -1: + continue + + file_path = os.path.join(root, file_name) + replace_word_in_file(file_path, target, replacement) + +def get_redirect(path, repo): + res = os.path.splitext(path) + res = res[0] + spl = res.split(repo) + res = spl[1].split('/docs', 1) + res = res[1] + return res + +def redirect(json_file, from_r, to_r): + obj = { + "from": from_r, + "to": to_r + } + + with open(json_file, 'r') as file: + data = json.load(file) + + data.append(obj) + + with open(json_file, 'w') as file: + json.dump(data, file, indent=4) + + +if __name__ == "__main__": + repo_path = os.getcwd() + + event_handler = MoveEventHandler() + observer = Observer() + observer.schedule(event_handler, repo_path, recursive=True) + + print(f"Monitoring moves in: {repo_path}") + observer.start() + + try: + while True: + time.sleep(1) + except KeyboardInterrupt: + observer.stop() + + observer.join() diff --git a/navbar.js b/navbar.js index 59573fcbf0..f8b0adaaa5 100644 --- a/navbar.js +++ b/navbar.js @@ -22,7 +22,7 @@ module.exports = { label: 'Blockchain of Blockchains', }, { - to: '/learn/overviews/addresses', + to: '/v3/concepts/ton-blockchain/smart-contract-addresses', label: 'Smart Contract Addresses', }, { @@ -132,7 +132,7 @@ module.exports = { items: [ { to: '/participate/run-nodes/mytonctrl', - label: 'MyTonCtrl', // TODO: refactor status + label: 'Manage Blockchain Nodes', }, { to: '/participate/run-nodes/nodes-troubleshooting', @@ -158,31 +158,31 @@ module.exports = { }, { type: 'dropdown', - to: 'participate', + to: 'v3/guidelines/overview', + label: 'Guidelines', position: 'left', - label: 'Web3', items: [ { - to: 'participate/web3/dns', - label: 'TON DNS & Domains', + to: '/develop/smart-contracts/guidelines', + label: 'Smart Contracts', }, { - to: 'participate/web3/how-to-open-any-ton-site', - label: 'Open TON Sites', + to: '/develop/dapps/', + label: 'DApps', }, { - to: 'develop/dapps/tutorials/how-to-run-ton-site', - label: 'Run TON Sites', + to: 'v3/guidelines/nodes/overview', + label: 'Nodes' }, { - to: 'participate/ton-storage/storage-daemon', - label: 'Run a Storage Daemon', + to: 'develop/dapps/ton-connect/overview', + label: 'Integrate with TON' }, { - to: 'participate/ton-storage/storage-provider', - label: 'Build a Storage Provider', + to: 'participate/web3/overview', + label: 'Web3', }, - ], + ] }, { type: 'dropdown', @@ -206,6 +206,14 @@ module.exports = { to: 'develop/dapps/defi/coins', // TODO: add page label: 'DApps', }, + { + to: 'participate/explorers', + label: 'Infrastructure' + }, + { + to: '/develop/data-formats/cell-boc', + label: 'Data Formats', + }, { to: 'learn/networking/low-level-adnl', label: 'Networking' @@ -218,7 +226,7 @@ module.exports = { }, { type: 'dropdown', - label: 'External', + label: 'Resources', position: 'left', items: [ { @@ -229,10 +237,6 @@ module.exports = { to: 'https://t.me/addlist/1r5Vcb8eljk5Yzcy', label: 'TON Developers Kit', }, - { - to: 'https://t.me/tonsupport_aibot', - label: 'AI TON Support Agent', - }, { to: 'https://github.com/ton-blockchain/TEPs', label: 'Standards Discussion (TEPs)', diff --git a/redirects/redirects.json b/redirects/redirects.json new file mode 100644 index 0000000000..a376b30d77 --- /dev/null +++ b/redirects/redirects.json @@ -0,0 +1,10 @@ +[ + { + "from": "/develop/overview", + "to": "/v3/overview" + }, + { + "from": "/v3/overview", + "to": "/develop/overview" + } +] \ No newline at end of file diff --git a/sidebars/develop.js b/sidebars/develop.js index ff3c9bf16e..ba00749466 100644 --- a/sidebars/develop.js +++ b/sidebars/develop.js @@ -10,9 +10,12 @@ module.exports = [ }, { 'type': 'html', - 'value': ' Smart Contracts ', + 'value': ' Smart Contracts Documentation ', }, 'develop/smart-contracts/README', + 'learn/overviews/addresses', + 'develop/blockchain/shards', + 'develop/blockchain/sharding-lifecycle', { type: 'category', label: 'Getting Started', @@ -47,26 +50,17 @@ module.exports = [ }, { type: 'category', - label: 'Ready-to-use contracts', + label: 'Contracts Specification', items: [ - { - type: 'category', - label: 'Core Contracts', - items: [ - 'develop/smart-contracts/core-contracts/precompiled', - 'develop/smart-contracts/governance', - 'develop/research-and-development/minter-flow', - ], - }, - { - type: 'category', - label: 'Wallets in TON', - items: [ - 'participate/wallets/apps', - 'participate/wallets/contracts', - ], - }, + 'participate/wallets/contracts', + 'participate/wallets/highload', 'participate/network-maintenance/vesting-contract', + 'develop/smart-contracts/governance', + 'participate/network-maintenance/nominator-pool', + 'participate/network-maintenance/single-nominator', + 'develop/smart-contracts/core-contracts/precompiled', + 'develop/research-and-development/minter-flow', + 'develop/smart-contracts/examples', ], }, { @@ -115,7 +109,7 @@ module.exports = [ }, { 'type': 'html', - 'value': ' DApps ', + 'value': ' DApps Documentation ', }, { type: 'category', @@ -137,11 +131,11 @@ module.exports = [ label: 'Assets', items: [ 'develop/dapps/asset-processing/overview', - 'develop/dapps/asset-processing/README', // TODO: divide - 'develop/dapps/asset-processing/jettons', // TODO: divide - 'develop/dapps/asset-processing/mintless-jettons', // TODO: divide + // 'develop/dapps/asset-processing/README', // TODO: divide + // 'develop/dapps/asset-processing/jettons', // TODO: divide + // 'develop/dapps/asset-processing/mintless-jettons', // TODO: divide 'develop/dapps/asset-processing/usdt', - 'develop/dapps/asset-processing/nfts', // TODO: divide + // 'develop/dapps/asset-processing/nfts', // TODO: divide ], }, { @@ -149,7 +143,6 @@ module.exports = [ label: 'Oracles', items: [ 'develop/oracles/about_blockchain_oracles', - { type: 'category', label: 'Oracles in TON', @@ -159,13 +152,18 @@ module.exports = [ }, ], }, + { + type: 'link', + label: 'Open-Source and Decentralization in TON', + href: 'https://defi.org/ton/', + }, { 'type': 'html', 'value': '
', }, { 'type': 'html', - 'value': ' Infrastructure ', + 'value': ' Infrastructure Documentation ', }, 'participate/explorers', { @@ -208,8 +206,6 @@ module.exports = [ label: 'Proof of Stake', id: 'participate/network-maintenance/staking-incentives', }, - 'participate/network-maintenance/nominator-pool', - 'participate/network-maintenance/single-nominator', 'participate/nodes/collators', ], }, @@ -221,7 +217,7 @@ module.exports = [ }, { 'type': 'html', - 'value': ' Networking ', + 'value': ' Networking Documentation ', }, { type: 'category', @@ -236,10 +232,32 @@ module.exports = [ type: 'category', label: 'Network Protocols', items: [ - 'learn/networking/low-level-adnl', // TODO: MERGE ADNL - 'develop/network/adnl-tcp', - 'develop/network/adnl-udp', - 'develop/network/dht', + { + type: 'category', + label: 'ADNL', + items: [ + { + type: 'doc', + label: 'Overview', + id: 'learn/networking/adnl', + }, + 'learn/networking/low-level-adnl', // TODO: MERGE ADNL + 'develop/network/adnl-tcp', + 'develop/network/adnl-udp', + ], + }, + { + type: 'category', + label: 'DHT', + items: [ + { + type: 'doc', + label: 'Overview', + id: 'learn/networking/ton-dht', + }, + 'develop/network/dht', + ] + }, 'develop/network/rldp', 'develop/network/overlay', ], @@ -250,7 +268,7 @@ module.exports = [ }, { 'type': 'html', - 'value': ' Data Formats ', + 'value': ' Data Formats Documentation ', }, { type: 'category', @@ -278,7 +296,7 @@ module.exports = [ }, { 'type': 'html', - 'value': ' TON Virtual Machine (TVM) ', + 'value': ' TON Virtual Machine (TVM) Documentation ', }, 'learn/tvm-instructions/tvm-overview', 'learn/tvm-instructions/tvm-initialization', @@ -302,7 +320,7 @@ module.exports = [ }, { 'type': 'html', - 'value': ' Quality Assurance & Outsource', + 'value': ' Quality Assurance & Outsource ', }, 'develop/companies/auditors', 'develop/companies/outsource', diff --git a/sidebars/guidelines.js b/sidebars/guidelines.js index 2c6a7a34e1..f00d24dd03 100644 --- a/sidebars/guidelines.js +++ b/sidebars/guidelines.js @@ -2,7 +2,7 @@ * @type {import('@docusaurus/plugin-content-docs').SidebarConfig} */ module.exports = [ - 'guidelines/README', + 'v3/guidelines/overview', 'develop/get-started-with-ton', { type: 'category', @@ -36,7 +36,7 @@ module.exports = [ }, { 'type': 'html', - 'value': ' Smart Contracts ', + 'value': ' Smart Contracts Guidelines ', }, 'develop/smart-contracts/guidelines', 'develop/smart-contracts/guidelines/get-methods', @@ -82,7 +82,6 @@ module.exports = [ 'develop/smart-contracts/tutorials/airdrop-claim-best-practice', 'develop/smart-contracts/tutorials/shard-optimization', 'develop/smart-contracts/tutorials/wallet', - 'develop/smart-contracts/examples', { type: 'link', label: 'How to shard your TON smart contract and why', @@ -96,7 +95,7 @@ module.exports = [ }, { 'type': 'html', - 'value': ' DApps ', + 'value': ' DApps Guidelines ', }, 'develop/dapps/README', 'develop/dapps/cookbook', @@ -198,8 +197,9 @@ module.exports = [ }, { 'type': 'html', - 'value': ' MyTonCtrl & Blockchain Nodes ', + 'value': ' MyTonCtrl & Blockchain Nodes Guidelines ', }, + 'v3/guidelines/nodes/overview', { type: 'category', label: 'Running Nodes', @@ -297,7 +297,7 @@ module.exports = [ }, { 'type': 'html', - 'value': ' Web3 ', + 'value': ' Web3 Guidelines ', }, 'participate/web3/overview', { diff --git a/sidebars/learn.js b/sidebars/learn.js index c59d3876f4..6e60790ecc 100644 --- a/sidebars/learn.js +++ b/sidebars/learn.js @@ -18,36 +18,11 @@ module.exports = [ label: 'TON Blockchain', items: [ 'learn/overviews/ton-blockchain', - 'learn/overviews/addresses', + 'v3/concepts/ton-blockchain/smart-contract-addresses', + 'participate/wallets/apps', 'learn/overviews/cells', - { - type: 'category', - label: 'TON Networking', - items: [ - { - type: 'doc', - label: 'Overview', - id: 'learn/networking/overview', - }, - { - type: 'doc', - label: 'ADNL Protocol', - id: 'learn/networking/adnl', - }, - 'learn/networking/overlay-subnetworks', - 'learn/networking/rldp', - 'learn/networking/ton-dht', - - ], - }, - 'develop/blockchain/shards', - 'develop/blockchain/sharding-lifecycle', + 'learn/networking/overview', 'learn/overviews/blockchain-comparison', - { - type: 'link', - label: 'Open-Source and Decentralization in TON', - href: 'https://defi.org/ton/', - }, ], }, {