Skip to content

Commit 2d400c5

Browse files
committed
Add section on how to create a multi-sig transaction
1 parent 68099b9 commit 2d400c5

File tree

1 file changed

+100
-10
lines changed

1 file changed

+100
-10
lines changed

source/mainnet/net/references/multi-sig.rst

Lines changed: 100 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ This page will go through the main steps as follows:
3131
- Add an additional signature to a multi-sig transaction with the ``concordium-client`` tool.
3232
- Send a multi-sig transaction with the ``concordium-client`` tool on chain.
3333

34-
.. note::
35-
36-
Mutli-sig signing can be used on all active transaction types which are currently: ``DeployModule``, ``InitContract``,
37-
``UpdateContract``, ``Transfer(CCD)``, ``TransferWithMemo``, ``TransferWithSchedule``,
38-
``TransferWithScheduleAndMemo``, ``ConfigureDelegation``, ``ConfigureBaker``, ``RegisterData``, ``UpdateCredential``,
39-
and ``UpdateCredentialsKeys``.
40-
4134
Create a multi-sig account
4235
==========================
4336

@@ -162,8 +155,8 @@ To add additional keys to an existing account on Concordium using the ``concordi
162155
The ``<number-of-credential-to-sign>`` specifies the minimum number of credentials that are needed to sign the
163156
transaction after the update.
164157

165-
Configure the ``concordium-client`` tool to use a multi-sig account
166-
===================================================================
158+
Configure the tool to use a multi-sig account
159+
=============================================
167160

168161
To configure the ``concordium-client`` tool to use a multi-sig account, you can either:
169162

@@ -274,19 +267,116 @@ tool in this section (Option 2). The first option is covered in the
274267
275268
.. note::
276269

277-
This command updates the keys in the key directory of your local ``concordium-client`` tool. No transaction is sent on-chain.
270+
This command updates the keys in the key directory of your local ``concordium-client`` tool. No transaction
271+
is sent on-chain.
278272

279273

280274
Create a multi-sig transaction
281275
==============================
276+
277+
Multi-sig transactions can be created for all active transaction types which are currently: ``DeployModule``,
278+
``InitContract``, ``UpdateContract``, ``Transfer(CCD)``, ``TransferWithMemo``, ``TransferWithSchedule``,
279+
``TransferWithScheduleAndMemo``, ``ConfigureDelegation``, ``ConfigureBaker``, ``RegisterData``,
280+
``UpdateCredential``, and ``UpdateCredentialsKeys``.
281+
282+
To create a multi-sig transaction, execute a transaction-creating command and add an ``--out`` flag.
283+
This flag will cause ``concordium-client`` to output the partially-signed
284+
transaction into the specified file instead of sending it on-chain.
285+
286+
If you omit the ``--signers`` flag, ``concordium-client`` will output
287+
a transaction signed with all keys associated with the account as present in the local key directory.
288+
If you want to sign with specific keys from the local key directory,
289+
you can specify some of them with the ``--signers`` flag (e.g. ``--signer "0:0,0:1"``).
290+
291+
For example, to create a multi-sig transaction to send 1 CCD to an account on testnet using all local keys,
292+
run the following command:
293+
294+
.. code-block:: console
295+
296+
$concordium-client transaction send --receiver 4bbdAUCDK2D6cUvUeprGr4FaSaHXKuYmYVjyCa4bXSCu3NUXzA --amount 1 --out ./transaction.json --energy 5000 --sender 4jxvYasaPncfmCFCLZCvuL5cZuvR5HAQezCHZH7ZA7AGsRYpix --grpc-port 20000 --grpc-ip node.testnet.concordium.com
297+
298+
The partially-signed transaction is output into the file ``transaction.json`` and has the following format:
299+
300+
.. code-block:: json
301+
:force:
302+
303+
{
304+
"energy": 5000,
305+
"expiryTime": 1716995242,
306+
"nonce": 46,
307+
"payload": {
308+
"amount": "1000000",
309+
"toAddress": "4bbdAUCDK2D6cUvUeprGr4FaSaHXKuYmYVjyCa4bXSCu3NUXzA",
310+
"transactionType": "transfer"
311+
},
312+
"signature": {
313+
"0": {
314+
"0": "3099534c5f32daf64dc40b7a0013979b9b74b167d259fc787a363ed2db7f1bcdafdcf06e166b2d915c7f29043186b3015a6064755bf3c3733bca2151b2b19c04"
315+
}
316+
},
317+
"signer": "4jxvYasaPncfmCFCLZCvuL5cZuvR5HAQezCHZH7ZA7AGsRYpix",
318+
"version": 1
319+
}
320+
321+
If you want to sign the transaction with keys that are not in the local key directory, you need to provide
322+
the keys as a separte file with the ``--keys`` flag. Keys provided with a flag take precedence and no
323+
lookup of local keys in the key directory is performed.
324+
325+
For example, to create a multi-sig transaction to send 1 CCD to an account on testnet using keys for signing
326+
from a file, run the following command:
327+
328+
.. code-block:: console
329+
330+
$concordium-client transaction send --keys ./keypair.json --receiver 4bbdAUCDK2D6cUvUeprGr4FaSaHXKuYmYVjyCa4bXSCu3NUXzA --amount 1 --out ./transaction.json --energy 5000 --sender 4jxvYasaPncfmCFCLZCvuL5cZuvR5HAQezCHZH7ZA7AGsRYpix --grpc-port 20000 --grpc-ip node.testnet.concordium.com
331+
332+
where ``keypair.json`` is a file of the following format:
333+
334+
.. code-block:: json
335+
:force:
336+
337+
{
338+
"cidx": {
339+
"kidx": {
340+
"encryptedSignKey": {
341+
"metadata": {
342+
"encryptionMethod": "AES-256",
343+
"iterations": ...,
344+
"salt": ...,
345+
"initializationVector": ...,
346+
"keyDerivationMethod": "PBKDF2WithHmacSHA256"
347+
},
348+
"cipherText": ...
349+
},
350+
"verifyKey": ...,
351+
"schemeId": "Ed25519"
352+
},
353+
...
354+
},
355+
...
356+
}
357+
358+
359+
If you want to create a partially-signed transaction with no signatures at all, you can use an
360+
empty ``keypair.json`` file of the following format:
361+
362+
.. code-block:: json
363+
:force:
364+
365+
{}
366+
282367
Add an additional signature to a multi-sig transaction
283368
======================================================
284369

285370
.. _sign-with-keyfile:
286371

372+
.. Step: Add an additional signature
373+
.. stack run concordium-client -- transaction add-signature ./transaction.json --signers "0:1" --grpc-port 20000 --grpc-ip node.testnet.concordium.com
374+
287375
Send a multi-sig transaction on-chain
288376
=====================================
289377

378+
.. Step: Send the fully signed transaction on-chain
379+
.. stack run concordium-client -- transaction submit ./transaction.json --grpc-port 20000 --grpc-ip node.testnet.concordium.com
290380
291381
.. note::
292382

0 commit comments

Comments
 (0)