Open gitmachtl opened 2 years ago
cardano-signer 1.7.0 now also supports more output options including JSON format, which will generate a user-readable registration.json (with 0x prefix for hexbytearrays cardano-style) which can also be directly used in a transactions:
Example:
$ cardano-signer sign --cip36 \
--rewards-address "stake_test1urqntq4wexjylnrdnp97qq79qkxxvrsa9lcnwr7ckjd6w0cr04y4p" \
--secret-key "f5beaeff7932a4164d270afde7716067582412e8977e67986cd9b456fc082e3a" \
--vote-public-key ../myvote.voting.pkey --vote-weight 1 \
--vote-public-key "57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0" --vote-weight 5 \
--nonce 123456789 \
--json | --json-extended
JSON-Output:
{
"61284": {
"1": [
[
"0x51f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b5",
1
],
[
"0x57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0",
5
]
],
"2": "0x86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e",
"3": "0xe0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f",
"4": 123456789,
"5": 0
},
"61285": {
"1": "0xa97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d"
}
}
JSON-Extended-Output:
{
"workMode": "sign-cip36",
"registrationCBOR": "a219ef64a5018282582051f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b50182582057758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f00502582086870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e03581de0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f041a075bcd15050019ef65a1015840a97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d",
"registrationJSON": {
"61284": {
"1": [
[
"0x51f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b5",
1
],
[
"0x57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0",
5
]
],
"2": "0x86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e",
"3": "0xe0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f",
"4": 123456789,
"5": 0
},
"61285": {
"1": "0xa97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d"
}
},
"signDataHex": "45d05fca1f25e1a01c375dc2c8896e1fe61619852bbef2b26b4ece433c5bdeb7",
"signature": "a97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d",
"secretKey": "f5beaeff7932a4164d270afde7716067582412e8977e67986cd9b456fc082e3a",
"publicKey": "86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e"
}
So using cardano-signer to produce CIP-0036 conform metadata for the CardanoMainnet and Catalyst for a single 100% voting-power delegation would be as simple as runnning:
nonce=$(curl -s -X GET "https://api.koios.rest/api/v0/tip" -H "Accept: application/json" | jq -r ".[0].abs_slot") #getting slotHeight for Mainnet via koios
cardano-signer sign --cip36 \
--rewards-address "<stakeaddress_to_receive_rewards>" \
--secret-key stake.skey \
--vote-public-key myvote.voting.vkey \
--nonce ${nonce} \
--json \
--out-file catalyst-registration-metadata.json
cardano signer 1.8.0 can now calculate the nonce (if not provided) from the current machine time on its own (mainnet-slotHeight).
So a minimal registration could look like:
$ cardano-signer sign --cip36 \
--rewards-address "stake1u55c9gha99xz3dnxxeczsr3f4kj23zs4mtpst3szlztengsv62rry" \
--vote-public-key test.voting.vkey \
--secret-key myStakeKey.skey \
--json \
--out-file catalyst-registration-metadata.json
Output: (Nonce automatically calculated from current machine time)
{
"61284": {
"1": [
[ "0xc2cd50d8a231fbc1488d65abab4f6bf74178e6de64722558eeef0b73de293a8a", 1 ]
],
"2": "0x57758911253aa6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0",
"3": "0xe1e382a2fd294c28b7763670280e29ada4a88a15dac305c602f89799a2",
"4": 73146002,
"5": 0
},
"61285": {
"1": "0x4a96002...3278ea09"
}
}
cardano-signer 1.9.0 can now also generate the newly added catalyst deregistration metadata format via the flag --deregister
. Also it can calculate the nonce (if not provided) from the current machine time on its own (mainnet-slotHeight).
If not provided, the --vote-purpose defaults to 0 (catalyst).
So a minimal call would look like:
$ cardano-signer sign --cip36 \
--deregister \
--secret-key myStakeKey.skey \
--json
Output: (Nonce automatically calculated from current machine time)
{
"61286": {
"1": "0x57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0",
"2": 74858300,
"3": 0
},
"61285": {
"1": "0xc7bec561f2b80766f78c169ccb231865048e0ed7e9fb4f98f263d00e3e4a2e6126a18f70b303be63f8e01f46dd116be5c387495a7cec707d3ebc3e6be4d87008"
}
}
cardano-signer 1.10.1 is now supporting the changed reward payout address. It is no longer a stakeaddress, its a payment address (enterprise or base) now.
So a minimal registration could look like:
$ cardano-signer sign --cip36 \
--rewards-address "addr1v9ux8dwy800s5pnq327g9uzh8f2fw98ldytxqaxumh3e8kqumfr6d" \
--vote-public-key test.voting.vkey \
--secret-key myStakeKey.skey \
--json \
--out-file catalyst-registration-metadata.json
Output: (Nonce automatically calculated from current machine time)
{
"61284": {
"1": [
[
"0xcd6d71f11cbd2f63326e5a50d7141a9443bd0f16f4b02f3f2f4d40acc5f83294",
1
]
],
"2": "0x9be513df12b3fabe7c1b8c3f9fab0968eb2168d5689bf981c2f7c35b11718b27",
"3": "0x617863b5c43bdf0a06608abc82f0573a549714ff69166074dcdde393d8",
"4": 78696706,
"5": 0
},
"61285": {
"1": "0x535d1ee26b844a71005043d4f151c18c8ef073d32bfb097284dd16f40e78f8bae877dccc268ab2762e96312910c95dc4685a025b474fe93c69aafa59fdf14c0b"
}
}
Just as an info, the new version of cardano-signer 1.5.0 has implemented the upcoming CIP-0036 standard for governance/catalyst multi-delegation of voting-power. It generates the registration cbor hex string or directly the binary cbor file to submit it on chain.
Signing (CIP-36 mode) - Catalyst Voting Registration / VotingPower Delegation