Skip to content

Commit

Permalink
Add resign voting docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jhbertra committed May 6, 2024
1 parent e081369 commit 79d8bd4
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 6 deletions.
2 changes: 1 addition & 1 deletion credential-manager/orchestrator-cli/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ hotNFTCommandParser = info parser description
fold
[ command "init" $ InitHotNFT <$> initHotNFTCommandParser
, command "vote" $ Vote <$> voteCommandParser
, command "resignVoting" $ ResignVoting <$> resignVotingCommandParser
, command "resign-voting" $ ResignVoting <$> resignVotingCommandParser
, command "rotate" $ RotateHot <$> rotateHotCommandParser
, command "unlock" $ UnlockHot <$> unlockHotCommandParser
]
Expand Down
1 change: 1 addition & 0 deletions doc/read-the-docs-site/orchestrator-cli/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ tools in an approximate sequence.
init-hot-nft
vote
resign-delegation
resign-voting
5 changes: 0 additions & 5 deletions doc/read-the-docs-site/orchestrator-cli/resign-delegation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ this user.
]
}
.. code-block:: bash
cat resign-child-6/value
addr_test1wzq7m97vwjyu43w8snutpnuukhef8nlh7lpx4x53rquzanqmwuk6y+5000000 lovelace + 1 14987a29cf4065e7b38a4cde6bc84b067492ad3ecc8223598a8fe4be
Step 2: Create the Transaction
------------------------------
Expand Down
169 changes: 169 additions & 0 deletions doc/read-the-docs-site/orchestrator-cli/resign-voting.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
.. _resign_voting:

Resigning from the Voting Group
===================================

Members of the voting group are able to voluntarily resign their group
membership, just like delegation group members.

Step 1: Creating the assets
---------------------------

Say ``child-7`` wants to resign from the voting group. To build the
transaction assets to remove them, you can use the following commands:

.. code-block:: bash
$ cardano-cli conway query utxo --address $(cat hot-nft/script.addr) --output-json \
| jq 'to_entries | .[0].value' \
> hot-nft.utxo
$ orchestrator-cli hot-nft resign-voting \
--utxo-file hot-nft.utxo \
--voting-cert example-certificates/children/child-7/child-7-cert.pem \
--out-dir resign-child-7
As before, let's see what assets were prepared:

.. code-block:: bash
$ ls resign-child-7 -1
datum.json
redeemer.json
value
We have the familiar ``datum.json``, ``redeemer.json``, and ``value`` files:

.. code-block:: bash
$ diff <(jq '.inlineDatum' < hot-nft.utxo) <(jq '.' < resign-child-7/datum.json)
7,17d6
< "bytes": "fb5e0be4801aea73135efe43f4a3a6d08147af523112986dd5e7d13b"
< },
< {
< "bytes": "57f5530e057e20b726b78aa31104d415cb2bce58c669829a44d009c1b1005bcd"
< }
< ]
< },
< {
< "constructor": 0,
< "fields": [
< {
In the datum, ``child-7`` has been removed, while the redeemer says to remove
this user.
.. code-block:: bash
cat resign-child-7/redeemer.json
{
"constructor": 1,
"fields": [
{
"constructor": 0,
"fields": [
{
"bytes": "fb5e0be4801aea73135efe43f4a3a6d08147af523112986dd5e7d13b"
},
{
"bytes": "57f5530e057e20b726b78aa31104d415cb2bce58c669829a44d009c1b1005bcd"
}
]
}
]
}
Step 2: Create the Transaction
------------------------------
.. code-block:: bash
$ cardano-cli conway transaction build \
--tx-in $(cardano-cli query utxo --address $(cat orchestrator.addr) --output-json | jq -r 'keys[0]') \
--tx-in-collateral $(cardano-cli query utxo --address $(cat orchestrator.addr) --output-json | jq -r 'keys[0]') \
--tx-in $(cardano-cli query utxo --address $(cat hot-nft/script.addr) --output-json | jq -r 'keys[0]') \
--tx-in-script-file hot-nft/script.plutus \
--tx-in-inline-datum-present \
--tx-in-redeemer-file resign-child-7/redeemer.json \
--tx-out "$(cat resign-child-7/value)" \
--tx-out-inline-datum-file resign-child-7/datum.json \
--required-signer-hash $(cat example-certificates/children/child-7/child-7.keyhash) \
--change-address $(cat orchestrator.addr) \
--out-file resign-child-7.body
Estimated transaction fee: Coin 408789
Step 3. Send the Transaction to The Resignee
--------------------------------------------
To build the transaction, we need to get a signature from the resignee.
.. code-block:: bash
$ cardano-cli conway transaction witness \
--tx-body-file resign-child-7.body \
--signing-key-file example-certificates/children/child-7/child-7.skey \
--out-file resign-child-7.child-7.witness
$ cardano-cli conway transaction witness \
--tx-body-file resign-child-7.body \
--signing-key-file orchestrator.skey \
--out-file resign-child-7.orchestrator.witness
Step 4. Assemble and Submit the Transaction
-------------------------------------------
.. code-block:: bash
$ cardano-cli conway transaction assemble \
--tx-body-file resign-child-7.body \
--witness-file resign-child-7.child-7.witness \
--witness-file resign-child-7.orchestrator.witness \
--out-file resign-child-7.tx
$ cardano-cli conway transaction submit --tx-file resign-child-7.tx
Transaction successfully submitted.
Step 5. Verify the voting member is removed
-----------------------------------------------
.. code-block:: bash
$ cardano-cli conway query utxo --address $(cat hot-nft/script.addr) --output-json
{
"0d1236cabd0256d8aec32ac3085858a1d23ce0d0de87bfafa3711564beeb04c3#0": {
"address": "addr_test1wrwhrnx58j942jj3mauh5graef2c6y0e4phjxaqsakyt23qpxcdz7",
"datum": null,
"inlineDatum": {
"list": [
{
"constructor": 0,
"fields": [
{
"bytes": "a3c6cb93a32b02877c61f64ab1c66c4513f12788bf7c500ead7d941b"
},
{
"bytes": "9923f31c1ce14e2acbd505fa8eebd4ce677d1bcd96c6d71610f810f2008ecc3a"
}
]
},
{
"constructor": 0,
"fields": [
{
"bytes": "eda6befbe1a4cb8191752d97b67627a548bcc5f3e4653ecfdba7cdf0"
},
{
"bytes": "ecd64beefcf59f01a975457b0a3623d2b03d5bcf71642a8d8d8275e4668aad31"
}
]
}
]
},
"inlineDatumhash": "20003d8b8a9526ab5daf6f9e31ef5f0ac8cfb97832d85492e49c8e1456424ade",
"referenceScript": null,
"value": {
"63ac965b8bab57dc91f302dad97d1d70e979e8cae8d3514c7ad6f86f": {
"": 1
},
"lovelace": 5000000
}
}
}

0 comments on commit 79d8bd4

Please sign in to comment.