diff --git a/docs.json b/docs.json index 000fc7507..8eac66024 100644 --- a/docs.json +++ b/docs.json @@ -250,6 +250,7 @@ "standard/wallets/how-it-works", "standard/wallets/mnemonics", "standard/wallets/comparison", + "standard/wallets/gas-benchmarks", "standard/wallets/creation", "standard/wallets/history", "standard/wallets/v4", diff --git a/standard/wallets/gas-benchmarks.mdx b/standard/wallets/gas-benchmarks.mdx new file mode 100644 index 000000000..580f551c1 --- /dev/null +++ b/standard/wallets/gas-benchmarks.mdx @@ -0,0 +1,119 @@ +--- +title: "Cost comparison" +--- + +import { Aside } from '/snippets/aside.jsx'; + + + +This page provides comprehensive cost comparison for TON wallet contracts, presenting both gas consumption metrics and real-world costs in TON. The cost data includes all transaction fees, not just gas consumption, enabling users to make informed decisions based on their specific use cases. + +## Key findings by wallet type + +| Version | Optimal batch size | Key advantage | +| :---------------- | :----------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Wallet V3][v3] | ≤ 8 | Lowest cost for single and small batch transfers | +| [Wallet V4][v4] | ≤ 8 | Supports plugins | +| [Wallet V5][v5] | ≥ 8 | Most cost-effective for medium+ batches;
[supports gasless transactions](/standard/wallets/v5#gasless-transactions) | +| [Highload V3][HL] | ≥ 20 | Less than 1% diff vs V5 after 128 messages;
[parallel processing of messages](/standard/wallets/highload/overview#what-makes-them-different) | + +## Single transfers + +| Wallet Version | Gas (units) | Cost (TON) | Cost per message (TON) | Difference | +| --------------- | ----------- | ---------- | ---------------------- | ------------------- | +| **V3** | 2,994 | 0.002217 | 0.002217 | Most cost-effective | +| **V4** | 3,308 | 0.002342 | 0.002342 | +5.67% vs V3 | +| **V5** | 4,939 | 0.003091 | 0.003091 | +39.42% vs V3 | +| **Highload V3** | 6,200 | 0.003599 | 0.003599 | +62.33% vs V3 | + +## Batch transfers (4 messages) + +| Wallet Version | Gas (units) | Cost (TON) | Cost per message (TON) | Difference | +| --------------- | ----------- | ---------- | ---------------------- | ------------------- | +| **V3** | 4,920 | 0.0048448 | 0.001211 | Most cost-effective | +| **V4** | 5,234 | 0.0049704 | 0.001243 | +2.59% vs V3 | +| **V5** | 7,090 | 0.0059768 | 0.001494 | +23.38% vs V3 | +| **Highload V3** | 7,956 | 0.0082084 | 0.002052 | +69.45% vs V3 | + +## Batch transfers (8 messages) + +V5 became more effective than V4 and almost tied with V3. + +| Wallet Version | Gas (units) | Cost (TON) | Cost per message (TON) | Difference | +| --------------- | ----------- | ---------- | ---------------------- | ------------------- | +| **V3** | 9,840 | 0.0096896 | 0.001211 | Most cost-effective | +| **V5** | 9,958 | 0.0098248 | 0.001228 | +1.40% vs V3 | +| **V4** | 10,468 | 0.0099408 | 0.001243 | +2.59% vs V3 | +| **Highload V3** | 7,956 | 0.0120100 | 0.001501 | +23.95% vs V3 | + +## Batch transfers (16 messages) + +Highload became more effective than V4 and almost tied with V3. + +| Wallet Version | Gas (units) | Cost (TON) | Cost per message (TON) | Difference | +| --------------- | ----------- | ---------- | ---------------------- | ------------------- | +| **V5** | 15,694 | 0.0175432 | 0.001096 | Most cost-effective | +| **V3** | 19,680 | 0.0193792 | 0.001211 | +10.47% vs V5 | +| **Highload V3** | 7,956 | 0.0196580 | 0.001229 | +12.06% vs V5 | +| **V4** | 20,936 | 0.0198816 | 0.001243 | +13.34% vs V5 | + +## Batch transfers (20 messages) + +Highload is significantly more effective than V3 or V4. + +| Wallet Version | Gas (units) | Cost (TON) | Cost per message (TON) | Difference | +| --------------- | ----------- | ---------- | ---------------------- | ------------------- | +| **V5** | 18,562 | 0.0214040 | 0.001070 | Most cost-effective | +| **Highload V3** | 7,956 | 0.0234852 | 0.001174 | +9.72% vs V5 | +| **V3** | 24,600 | 0.0242240 | 0.001211 | +13.17% vs V5 | +| **V4** | 26,170 | 0.0248520 | 0.001243 | +16.11% vs V5 | + +## Batch transfers (200 messages) + +V5 is still most effective, but difference is negligible. + +| Wallet Version | Gas (units) | Cost (TON) | Cost per message (TON) | Difference | +| --------------- | ----------- | ---------- | ---------------------- | ------------------- | +| **V5** | 147,622 | 0.1954632 | 0.000977 | Most cost-effective | +| **Highload V3** | 7,956 | 0.1963556 | 0.000982 | +0.46% vs V5 | +| **V3** | 246,000 | 0.2422400 | 0.001211 | +23.93% vs V5 | +| **V4** | 261,700 | 0.2485200 | 0.001243 | +27.14% vs V5 | + + + +## Methodology + +### Sandbox measurements: + +Framework: Blueprint + [@ton/sandbox](/contract-dev/testing/overview) + +Wallets: implementations from [@ton/ton](https://github.com/ton-org/ton) (V3R2, V4, V5R1) and [Highload V3 sources](https://github.com/ton-blockchain/highload-wallet-contract-v3) + +Test scenario: Transfer 0.01 TON with `PAY_GAS_SEPARATELY` mode with unique comment for each message in batches to prevent deduplication. + +### On-chain measurements: + +Network: TON testnet + +Wallets: Same implementations as sandbox + +Measurement: Actual transaction fees from explorer data + +## Code examples + +Check [gas-research](https://github.com/memearchivarius/gas-research) and [tolk-bench](https://github.com/ton-blockchain/tolk-bench) projects for code examples. + +[v3]: /standard/wallets/history#wallet-v3 + +[v4]: /standard/wallets/v4 + +[v5]: /standard/wallets/v5 + +[HL]: /standard/wallets/highload/overview