Skip to content

Commit df74920

Browse files
Multisig page DANGER banner (ton-community#945)
* multisig-banner * upd * Update multisig.md * Resolving conversations * yellow * Resolving conversations
1 parent 7cf8dde commit df74920

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

docs/v3/guidelines/smart-contracts/howto/multisig-js.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ description: At the end of this guide you will deploy multisig wallet and send s
44

55
# Interact with multisig wallets using TypeScript
66

7+
:::warning
8+
This page is heavily outdated and will be updated soon.
9+
See the [multisig-contract-v2](https://github.com/ton-blockchain/multisig-contract-v2), the most up-to-date multisignature contract on TON.
10+
Use npm and do not update.
11+
:::
12+
713
## Introduction
814
If you don't know what is multisig wallet in TON, you can check it out [here](/v3/guidelines/smart-contracts/howto/multisig)
915

10-
Following this steps you will learn how to:
16+
Following these steps you will learn how to:
1117
* Create and deploy multisig wallet
1218
* Create, sign and send transactions with that wallet
1319

@@ -24,7 +30,7 @@ The full code of this guide is available here:
2430
## Create and deploy multisig wallet
2531
Let's create a source file, `main.ts` for example. Open it in your favorite code editor and follow this guide!
2632

27-
At first we need to import all important stuff
33+
At first, we need to import all important stuff
2834
```js
2935
import { Address, beginCell, MessageRelaxed, toNano, TonClient, WalletContractV4, MultisigWallet, MultisigOrder, MultisigOrderBuilder } from "ton";
3036
import { KeyPair, mnemonicToPrivateKey } from 'ton-crypto';

docs/v3/guidelines/smart-contracts/howto/multisig.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This tutorial help you learn how to deploy your multisig contract.
1414
Recall, that (n, k)-multisig contract is a multisignature wallet with n private keys holders, which accepts requests to send messages if the request (aka order, query) collects at least k signatures of the holders.
1515

1616
Based on original multisig contract code and updates by akifoq:
17+
1718
- [original TON Blockchain multisig-code.fc](https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/multisig-code.fc)
1819
- [akifoq/multisig](https://github.com/akifoq/multisig) with fift libraries to work with multisig.
1920

@@ -37,12 +38,10 @@ Before we begin our journey, check and prepare your environment.
3738
```bash
3839
git clone https://github.com/akifoq/multisig.git
3940
cd ~/multisig
40-
```
41-
41+
```
4242

4343
## 🚀 Let's get started!
4444

45-
4645
1. Compile the code to fift.
4746
2. Prepare multisig owners keys.
4847
3. Deploy your contract.
@@ -56,8 +55,8 @@ Compile the contract to Fift with:
5655
func -o multisig-code.fif -SPA stdlib.fc multisig-code.fc
5756
```
5857

59-
6058
### Prepare multisig owners keys
59+
6160
#### Create participants keys
6261

6362
To create a key you need to run:
@@ -66,7 +65,7 @@ To create a key you need to run:
6665
fift -s new-key.fif $KEY_NAME$
6766
```
6867

69-
* Where `KEY_NAME` is the name of the file where the private key will be written.
68+
- Where `KEY_NAME` is the name of the file where the private key will be written.
7069

7170
For example:
7271

@@ -107,8 +106,8 @@ After that, you need to run:
107106
fift -s new-multisig.fif 0 $WALLET_ID$ wallet $KEYS_COUNT$ ./keys.txt
108107
```
109108

110-
* `$WALLET_ID$` - the wallet number assigned for current key. It is recommended to use a unique `$WALLET_ID$` for each new wallet with the same key.
111-
* `$KEYS_COUNT$` - the number of keys needed for confirmation, usually equal to the number of public keys
109+
- `$WALLET_ID$` - the wallet number assigned for current key. It is recommended to use a unique `$WALLET_ID$` for each new wallet with the same key.
110+
- `$KEYS_COUNT$` - the number of keys needed for confirmation, usually equal to the number of public keys
112111

113112
:::info wallet_id explained
114113
It's possible to create many wallets with the same keys (Alice key, Bob key). What to do if Alice and Bob already have treasure? That's why `$WALLET_ID$` is crucial here.
@@ -128,7 +127,7 @@ Bounceable address (for later access): kQBLuyZgCX21xy3V6QhhFQEPD4yFAeC4_vH-MY2d5
128127
(Saved wallet creating query to file wallet-create.boc)
129128
```
130129

131-
:::info
130+
:::info
132131
If you have "public key must be 48 characters long" error, please make sure your `keys.txt` has unix type word wrap - LF. For example, word wrap can be changed via Sublime text editor.
133132
:::
134133

@@ -166,7 +165,6 @@ sendfile ./wallet-create.boc
166165

167166
After that, the wallet will be ready to work within a minute.
168167

169-
170168
### Interact with multisig wallet
171169

172170
#### Create a request
@@ -177,9 +175,9 @@ First you need to create a message request:
177175
fift -s create-msg.fif $ADDRESS$ $AMOUNT$ $MESSAGE$
178176
```
179177

180-
* `$ADDRESS$` - address where to send coins
181-
* `$AMOUNT$` - number of coins
182-
* `$MESSAGE$` - name of file for compiled message.
178+
- `$ADDRESS$` - address where to send coins
179+
- `$AMOUNT$` - number of coins
180+
- `$MESSAGE$` - name of file for compiled message.
183181

184182
For example:
185183

@@ -198,21 +196,23 @@ Next you need to choose a wallet to send a coins from:
198196
```
199197
fift -s create-order.fif $WALLET_ID$ $MESSAGE$ -t $AWAIT_TIME$
200198
```
199+
201200
Where
202-
* `$WALLET_ID$` — is an ID of wallet backed by this multisig contract.
203-
* `$AWAIT_TIME$` — Time in seconds that smart contract will await signs from multisig wallet's owners for request.
204-
* `$MESSAGE$` — here is a name of message boc-file created on the previous step.
201+
202+
- `$WALLET_ID$` — is an ID of wallet backed by this multisig contract.
203+
- `$AWAIT_TIME$` — Time in seconds that smart contract will await signs from multisig wallet's owners for request.
204+
- `$MESSAGE$` — here is a name of message boc-file created on the previous step.
205205

206206
:::info
207207
If time equals `$AWAIT_TIME$` passed before the request signs, the request becomes expired. As usual, $AWAIT_TIME$ equals a couple of hours (7200 seconds)
208208
:::
209209

210210
For example:
211+
211212
```
212213
fift -s create-order.fif 0 message -t 7200
213214
```
214215

215-
216216
Ready file will be saved in `order.boc`
217217

218218
:::info
@@ -227,8 +227,8 @@ To sign, you need to do:
227227
fift -s add-signature.fif $KEY$ $KEY_INDEX$
228228
```
229229

230-
* `$KEY$` - name of the file containing the private key to sign, without extension.
231-
* `$KEY_INDEX$` - index of the given key in `keys.txt` (zero-based)
230+
- `$KEY$` - name of the file containing the private key to sign, without extension.
231+
- `$KEY_INDEX$` - index of the given key in `keys.txt` (zero-based)
232232

233233
For example, for our `multisig_key.pk` file:
234234

@@ -239,12 +239,15 @@ fift -s add-signature.fif multisig_key 0
239239
#### Create a message
240240

241241
After everyone has signed the order, it needs to be turned into a message for the wallet and signed again with the following command:
242+
242243
```
243244
fift -s create-external-message.fif wallet $KEY$ $KEY_INDEX$
244245
```
246+
245247
In this case, will be enough only one sign of wallet's owner. The idea is that you can't attack a contract with invalid signatures.
246248

247249
For example:
250+
248251
```
249252
fift -s create-external-message.fif wallet multisig_key 0
250253
```
@@ -267,6 +270,7 @@ If everyone else signed the request, it will be completed!
267270

268271
You did it, ha-ha! 🚀🚀🚀
269272

270-
## What's next?
273+
## See also
271274

272-
- [Read more about multisig wallets in TON](https://github.com/akifoq/multisig) from akifoq
275+
- [Read more about multisig wallets in TON](https://github.com/akifoq/multisig)_[@akifoq](https://t.me/aqifoq)_
276+
- [Multisig wallet v2](https://github.com/ton-blockchain/multisig-contract-v2)

0 commit comments

Comments
 (0)