Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 10 #19

Merged
merged 7 commits into from
Nov 29, 2024
Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "3rd/tvm-spec"]
path = 3rd/tvm-spec
url = https://github.com/ton-community/tvm-spec.git
1 change: 1 addition & 0 deletions 3rd/tvm-spec
Submodule tvm-spec added at 59ec1a
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ Use Gitpod (a free, online VS code-like IDE) for contributing. It will launch a

### Local (default way)

1. Download repository from GitHub
1. Download repository from GitHub with its submodules

```
git clone --recursive https://github.com/ton-community/ton-docs.git
```

2. Install last version [NodeJS LTS](https://nodejs.org/en/download/) to run local build
3. Open Terminal in project directory
4. Install dependencies with command:
Expand Down
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,6 @@
"sidebars",
"i18n",
".husky",
"warnings.txt"
"3rd/*"
]
}
2 changes: 1 addition & 1 deletion docs/v3/documentation/smart-contracts/func/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The core reason for creating the FunC Cookbook is to collect all the experience from FunC developers in one place so that future developers will use it!

Compared to the [FunC Documentation](/v3/documentation/smart-contracts/func/docs/types), this article is more focused on everyday tasks every FunC developer resolve during the development of smart contracts.
Compared to the [FunC Documentation](/v3/documentation/smart-contracts/func/docs/types), this article is more focused on the everyday tasks of every FunC developer to resolve during the development of smart contracts.

## Basics

Expand Down
13 changes: 13 additions & 0 deletions docs/v3/documentation/smart-contracts/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,19 @@ Tact by Example

</Button>

### 📗 Tolk

A new language for writing smart contracts in TON. Think of Tolk as the "**next‑generation FunC**"

:::caution
Under active development.
:::

<Button href="/v3/documentation/smart-contracts/tolk/overview" colorType={'primary'} sizeType={'sm'}>

Tolk Overview

</Button>

### 📕 Fift (advanced)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Saving 1 MB of data for one year on TON will cost 6.01 TON. Note that you usuall

### Is it possible to send a gasless transaction?

At present, this opportunity is not available. We are actively working on its development. Please stay tuned for updates.
In TON, gasless transactions are possible using [wallet v5](/v3/documentation/smart-contracts/contracts-specs/wallet-contracts#preparing-for-gasless-transactions) a relayer that pays the gas fee for transaction.

### How to calculation?

Expand Down
36 changes: 36 additions & 0 deletions docs/v3/guidelines/dapps/apis-sdks/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Overview

The purpose of this article is to help you choose the right tools for application development in TON ecosystem.

## TMA development

* Use [Mini Apps SDKs](/v3/guidelines/dapps/tma/overview#mini-apps-sdks) for [Telegram Mini Apps](/v3/guidelines/dapps/tma/overview) development.
* Choose [JS/TS-based SDK](/v3/guidelines/dapps/apis-sdks/sdk#typescript--javascript) for interacting with TON blockchain.

## DApps development

* Use Tolk, FunC or Tact [programming languages](/v3/documentation/smart-contracts/overview#programming-languages) for TON blockchain smart contracts development for your [DApp](/v3/guidelines/dapps/overview) if needed.
* To interacts with TON blockchain and process its data choose listed [SDK](/v3/guidelines/dapps/apis-sdks/sdk). One of the most popular languages for this purpose are:
* [JS/TS](/v3/guidelines/dapps/apis-sdks/sdk#typescript--javascript)
* [Go](/v3/guidelines/dapps/apis-sdks/sdk#go)
* [Python](/v3/guidelines/dapps/apis-sdks/sdk#python)
* To integrate user authentication with their TON Wallets (also payments processing logic) into your DApp use [TON Connect](/v3/guidelines/ton-connect/overview).

## TON Statistics analyzer

You may need fast interaction with TON blockchain or collect and analyze its data. For these purposes it may be helpful to run your own [Ton Node](/v3/documentation/infra/nodes/node-types).

* [Liteserver Node](/v3/guidelines/nodes/running-nodes/liteserver-node) - just for interaction with blockchain.
* [Archive Node](/v3/guidelines/nodes/running-nodes/archive-node) - collecting extended historical data of a blockchain.

Use SDKs with native [ADNL](/v3/documentation/network/protocols/adnl/adnl-tcp) support:
* [Go](https://github.com/xssnick/tonutils-go)
* [Python](https://github.com/yungwine/pytoniq)


## See Also

* [SDKs](/v3/guidelines/dapps/apis-sdks/sdk)
* [TMA Tutorials](/v3/guidelines/dapps/tma/tutorials/step-by-step-guide)
* [TON Connect Tutorials](/v3/guidelines/ton-connect/guidelines/how-ton-connect-works)
* [Payments Processing](/v3/guidelines/dapps/asset-processing/payments-processing)
6 changes: 3 additions & 3 deletions docs/v3/guidelines/dapps/cookbook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ async def main():
}

await wallet.transfer(**transfer)
await client.close_all()
await provider.close_all()

asyncio.run(main())
```
Expand Down Expand Up @@ -606,7 +606,7 @@ async def main():
stack=[begin_cell().store_address(USER_ADDRESS).end_cell().begin_parse()])
jetton_wallet = result_stack[0].load_address()
print(f"Jetton wallet address for {USER_ADDRESS}: {jetton_wallet.to_str(1, 1, 1)}")
await provider.close_all()
await provider.close_all()

asyncio.run(main())
```
Expand Down Expand Up @@ -862,7 +862,7 @@ async def main():
.end_cell())

await wallet.transfer(destination=USER_JETTON_WALLET, amount=int(0.05*1e9), body=transfer_cell)
await provider.close_all()
await provider.close_all()

asyncio.run(main())
```
Expand Down
43 changes: 19 additions & 24 deletions docs/v3/guidelines/nodes/node-maintenance-and-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,30 @@ This document assumes that a validator is installed using the configuration and

## <a id="maintenance"></a>Maintenance
### <a id="database-grooming"></a>Database grooming
TON Node/Validator keeps it's database within the path specified by `--db` flag of `validator-engine`, usually `/var/ton-work/db`, this directory is created and managed by the node but it is recommended to perform a database grooming/cleanup task once a month to remove some artifacts.
TON Node keeps its database within the path specified by `--db` flag of `validator-engine`, usually `/var/ton-work/db`. To reduce the database size, you can decrease the TTL (time-to-live) of some stored data.

:::caution Do not forget to stop validator process
You **must** stop the validator process before performing the steps outlined below, failure to do that will likely cause database corruption.
:::
Current TTL values can be found in the node service file (default path is `/etc/systemd/system/validator.service`). If you use MyTonCtrl you can use command `installer status`. If some of the values are not set, then the default values are used.

The procedure takes ~5 minutes to complete and will not cause major service disruption.
### archive-ttl

#### Switch to root
```sh
sudo -s
```
#### Stop validator service
```sh
systemctl stop validator
```
#### Verify that validator is not running
```sh
systemctl status validator
```
#### Perform database cleanup
```sh
find /var/ton-work/db -name 'LOG.old*' -exec rm {} +
`archive-ttl` is a parameter that defines the time-to-live for the blocks. The default value is 604800 seconds (7 days). You can decrease this value to reduce the database size.

```bash
MyTonCtrl> installer set_node_argument --archive-ttl <value>
```
#### Start validator service
```sh
systemctl start validator

If you don't use MyTonCtrl then you can edit the node service file.

### state-ttl

`state-ttl` is a parameter that defines the time-to-live for the blocks states. The default value is 86400 seconds (24 hours). You can decrease this value to reduce the database size, but for validators it's highly recommended to use the default value (keep the flag unset).
Also, this value should be more than length of the validation period (the value can be found in [15th config param](https://docs.ton.org/v3/documentation/network/configs/blockchain-configs#param-15)).

```bash
MyTonCtrl> installer set_node_argument --state-ttl <value>
```
Verify that the validator process is running by analysing the processes and log. Validator should re-sync with the network within a few minutes.

If you don't use MyTonCtrl then you can edit the node service file.

### <a id="backups"></a>Backups
The easiest and most efficient way to backup the validator is to copy crucial node configuration files, keys and mytonctrl settings:
Expand Down
10 changes: 8 additions & 2 deletions docs/v3/guidelines/smart-contracts/howto/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ import { TonClient } from '@ton/ton';
import { mnemonicToWalletKey } from '@ton/crypto';

const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
endpoint: "https://toncenter.com/api/v2/jsonRPC", // you can replace it on https://testnet.toncenter.com/api/v2/jsonRPC for testnet
apiKey: "put your api key" // you can get an api key from @tonapibot bot in Telegram
});

Expand Down Expand Up @@ -1026,7 +1026,13 @@ log.Println("Contract address:", contractAddress.String()) // Output contract ad
</TabItem>
</Tabs>

Using the State Init, we can now build the message and send it to the blockchain. To carry out this process **a minimum wallet balance of 0.1 TON** (the balance can be less, but this amount is guaranteed to be sufficient) is required. To accomplish this, we’ll need to run the code mentioned earlier in the tutorial, get the correct wallet address and send 0.1 TON to this address.
Using the State Init, we can now build the message and send it to the blockchain.

:::warning
To carry out this process, **a minimum wallet balance of 0.1 TON** is required (the balance can be less, but this amount is guaranteed to be sufficient). To accomplish this, we’ll need to run the code mentioned earlier in the tutorial, obtain the correct wallet address, and send 0.1 TON to this address. Alternatively, you can send this sum manually via your wallet app before sending the deployment message itself.

Deployment by external messages is presented here mostly for educational purposes; in practice, it's much more convenient to [deploy smart contracts via Wallets](/v3/guidelines/smart-contracts/howto/wallet#contract-deployment-via-wallet), which will be described later.
:::

Let’s start with building the message similar to the one we built **in the previous section**:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ async def main():


await wallet.transfer(destination=DESTINATION_ADDRESS, amount=int(0.05*1e9), body="转账示例内容")
await client.close_all()
await provider.close_all()

asyncio.run(main())
```
Expand Down Expand Up @@ -444,7 +444,7 @@ async def main():
stack=[begin_cell().store_address(USER_ADDRESS).end_cell().begin_parse()])
jetton_wallet = result_stack[0].load_address()
print(f"用户{USER_ADDRESS}的Jetton钱包地址: {jetton_wallet.to_str(1, 1, 1)}")
await provider.close_all()
await provider.close_all()

asyncio.run(main())
```
Expand Down Expand Up @@ -597,7 +597,7 @@ async def main():
.end_cell())

await wallet.transfer(destination=USER_JETTON_WALLET, amount=int(0.05*1e9), body=transfer_cell)
await client.close_all()
await provider.close_all()

asyncio.run(main())
```
Expand Down
2 changes: 1 addition & 1 deletion navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = {
label: 'Telegram Mini Apps (TMAs)',
},
{
to: 'v3/guidelines/dapps/apis-sdks/sdk',
to: 'v3/guidelines/dapps/apis-sdks/overview',
label: 'APIs and SDKs',
},
{
Expand Down
1 change: 1 addition & 0 deletions sidebars/guidelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module.exports = [
type: 'category',
label: 'APIs and SDKs',
items: [
'v3/guidelines/dapps/apis-sdks/overview',
'v3/guidelines/dapps/apis-sdks/sdk',
'v3/guidelines/dapps/apis-sdks/api-types',
'v3/guidelines/dapps/apis-sdks/ton-http-apis',
Expand Down
Loading
Loading