Skip to content

Commit 001bcb2

Browse files
committed
Add additional signatues and send multi-sig transaction on chain
1 parent 2d400c5 commit 001bcb2

File tree

1 file changed

+66
-7
lines changed

1 file changed

+66
-7
lines changed

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

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ The partially-signed transaction is output into the file ``transaction.json`` an
318318
"version": 1
319319
}
320320
321+
.. _sign-with-keyfile:
322+
321323
If you want to sign the transaction with keys that are not in the local key directory, you need to provide
322324
the keys as a separte file with the ``--keys`` flag. Keys provided with a flag take precedence and no
323325
lookup of local keys in the key directory is performed.
@@ -364,23 +366,80 @@ empty ``keypair.json`` file of the following format:
364366
365367
{}
366368
369+
.. note::
370+
371+
Choose an ``expiryTime`` for the transaction that takes into account the time it takes to gather all signatures
372+
by the different entities. If the ``expiryTime`` has passed, the transaction is no longer valid.
373+
367374
Add an additional signature to a multi-sig transaction
368375
======================================================
369376

370-
.. _sign-with-keyfile:
377+
For example, to sign the partially-signed testnet transaction in the file ``transaction.json`` (created in the
378+
previous section) on a potentially different device by a different entity, run the following command:
379+
380+
.. code-block:: console
381+
382+
$concordium-client transaction add-signature ./transaction.json --grpc-port 20000 --grpc-ip node.testnet.concordium.com
383+
384+
.. note::
371385

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
386+
All keys (as present in the local key directory) associated with the ``signer`` account
387+
are used to sign the transaction since the ``--signers`` flag is omitted in the above command.
388+
Check that the ``signer`` account in the ``transaction.json`` file, is the account you want
389+
to lookup its keys and sign with.
390+
391+
.. note::
392+
393+
If you want to sign with specific keys from the local key directory,
394+
you can specify some of them with the ``--signers`` flag (e.g. ``--signer "0:0,0:1"``).
395+
396+
.. note::
397+
If you want to sign the transaction with keys that are not in the local key directory,
398+
you can checkout the ``--keys`` flag :ref:`here<sign-with-keyfile>`.
399+
400+
The additional signatures generated are added to the partially-signed transaction into the
401+
file ``transaction.json`` and the file will look similar to the following format:
402+
403+
.. code-block:: json
404+
:force:
405+
406+
{
407+
"energy": 5000,
408+
"expiryTime": 1716995242,
409+
"nonce": 46,
410+
"payload": {
411+
"amount": "1000000",
412+
"toAddress": "4bbdAUCDK2D6cUvUeprGr4FaSaHXKuYmYVjyCa4bXSCu3NUXzA",
413+
"transactionType": "transfer"
414+
},
415+
"signature": {
416+
"0": {
417+
"0": "3099534c5f32daf64dc40b7a0013979b9b74b167d259fc787a363ed2db7f1bcdafdcf06e166b2d915c7f29043186b3015a6064755bf3c3733bca2151b2b19c04",
418+
"1": "52271842cd8bacf60bcdea0e7226539079574cef512991bb57bbd09bb27fe16008552f4ce926cac16abbf8190a97264d96ad405a35bd35c466ef86c3ba15680c"
419+
},
420+
},
421+
"signer": "4jxvYasaPncfmCFCLZCvuL5cZuvR5HAQezCHZH7ZA7AGsRYpix",
422+
"version": 1
423+
}
374424
375425
Send a multi-sig transaction on-chain
376426
=====================================
377427

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
428+
For example, to send the partially-signed testnet transaction from the file ``transaction.json`` (created in the
429+
previous section) on chain, run the following command:
430+
431+
.. code-block:: console
432+
433+
$concordium-client transaction submit ./transaction.json --grpc-port 20000 --grpc-ip node.testnet.concordium.com
380434
381435
.. note::
382436

383-
Additional resources:
437+
The node will reject the transaction if the threshold of signatures is not met.
438+
439+
Additional resources
440+
====================
441+
442+
.. note::
384443

385-
- `Use multi-sig accounts in the Rust SDK <https://gist.github.com/DOBEN/683fe1a7c82a0551546a7ec242d30cc0>`_
444+
`Use multi-sig accounts in the Rust SDK <https://gist.github.com/DOBEN/683fe1a7c82a0551546a7ec242d30cc0>`_
386445

0 commit comments

Comments
 (0)