-
Notifications
You must be signed in to change notification settings - Fork 71
Gas comparison between wallets for simple transfers #537
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
Changes from 17 commits
c87cf5e
2b5c5b1
64a3dbb
176011f
5c22aae
4f982b5
c3ef325
cae1c21
5ba51cf
92a4943
da7fe9e
8318476
99200cf
b6a4787
1bad23c
3f67ee6
4a49988
22808bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| --- | ||
| title: "Cost comparison" | ||
|
|
||
| --- | ||
|
|
||
| import { Aside } from '/snippets/aside.jsx'; | ||
|
|
||
| <Aside | ||
| type="caution" | ||
| > | ||
| Gas costs can vary between different versions of TVM, keep that in mind. | ||
| </Aside> | ||
|
|
||
| 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; <br /> [supports gasless transactions](/standard/wallets/v5#gasless-transactions) | | ||
| | [Highload V3][HL] | ≥ 20 | Less than 1% diff vs V5 after 128 messages; <br /> [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 | | ||
|
|
||
| <Aside> | ||
| Keep in mind that Highload V3 uses two transactions for batch transfers, which incur additional forward fee costs. | ||
| Also, actual gas consumption may vary between runs because the contract must process the existing dictionary state, while in the sandbox, each run usually starts from a clean state. | ||
| </Aside> | ||
|
|
||
| ## 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should move the scripts to https://github.com/ton-org/docs-examples, there should be no links to personal repos in the docs, unless it's some kind of SDK which happens to live there
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, why
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it's useful example of precise tests
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't want to provide more info than we need to, especially if it is not relevant to the case |
||
|
|
||
| [v3]: /standard/wallets/history#wallet-v3 | ||
|
|
||
| [v4]: /standard/wallets/v4 | ||
|
|
||
| [v5]: /standard/wallets/v5 | ||
|
|
||
| [HL]: /standard/wallets/highload/overview | ||
Uh oh!
There was an error while loading. Please reload this page.