You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Specification.md
+2-70
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ Authentication:
42
42
43
43
Operations:
44
44
* standard "send message" action (up to 255 messages at once),
45
-
* enable/disable signature authentication,
45
+
* enable/disable signature authentication (can be invoked only by extension),
46
46
* install/remove extension.
47
47
48
48
Signed messages can be delivered both by external and internal messages.
@@ -111,77 +111,9 @@ When wallet contract is being deployed, original code hash is being used as the
111
111
Library contract itself data and code are empty cells. That leads to the inability to change the library code, delete the contract, or withdraw funds from it.
112
112
Therefore, any Wallet V5 user can top up the library contract balance if they are afraid that the library code of their wallet will be frozen.
113
113
114
-
## Wallet ID
115
-
116
-
Wallet ID disambiguates requests signed with the same public key to different wallet versions (V3/V4/V5) or wallets deployed on different chains.
117
-
118
-
For Wallet V5 we suggest using the following wallet ID:
-`global_id` is a TON chain identifier. TON Mainnet `global_id = -239` and TON Testnet `global_id = -3`.
125
-
-`wc` is a Workchain. -1 for Masterchain and 0 for Basechain.
126
-
-`version`: current version of wallet v5 is `0`.
127
-
-`subwallet_number` can be used to get multiple wallet contracts bound to the single keypair.
128
-
129
-
## Packed address
130
-
131
-
To make authorize extensions efficiently we compress 260-bit address (workchain + sha256 of stateinit) into a 256-bit integer:
132
-
133
-
```
134
-
int addr = addr_hash ^ (wc + 1)
135
-
```
136
-
137
-
Previously deployed wallet v4 was packing the address into a cell which costs ≈500 gas, while access to dictionary costs approximately `120*lg2(N)` in gas, that is serialization occupies more than half of the access cost for wallets with up to 16 extensions. This design makes packing cost around 50 gas and allows cutting the authentication cost 2-3x for reasonably sized wallets.
138
-
139
-
As of 2023 TON network consists of two workchains: -1 (master) and 0 (base). This means that the proposed address packing reduces second-preimage resistance of sha256 by 1 bit which we consider negligible. Even if the network is expanded with 254 more workchains in a distant future, our scheme would reduce security of extension authentication by only 8 bits down to 248 bits. Note that birthday attack is irrelevant in our setting as the user agent is not installing random extensions, although the security margin is plenty anyway (124 bits).
0 commit comments