diff --git a/README.md b/README.md index 4fd110a..f06c257 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ### What can cardano-signer sign? * **Sign** any hexdata, textdata or binaryfile with a provided normal or extended secret key. The key can be provided in hex, bech or file format. The signing output is a signature in hex- or json-format, also the public key of the provided secret key for verification. * Sign payloads in **CIP-8** mode. The signing output is a signature in hex format and also the public key of the provided secret key for verification. The output can also be set to be in json format which will also show additional data (--json-extended). -* Generate and sign **Catalyst registration/delegation** metadata cbor in **CIP-36** mode. This also includes relatively weighted voting power delegation. The output is the registration/delegation data in json or cborHex-format and/or a binary cbor file, which can be transmitted on chain as it is. +* Generate and sign **Catalyst registration/delegation/deregistration** metadata in **CIP-36** mode. This also includes relatively weighted voting power delegation. The output is the registration/delegation or deregistraton data in json or cborHex-format and/or a binary cbor file, which can be transmitted on chain as it is. ### What can cardano-signer verify? * **Verify** a signature for any hexdata, textdata or binaryfile together with a provided public key. The key can be provided in hex, bech or file format. The verification output is true(exitcode=0) or false(exitcode=1) as a console output or in json-format. @@ -19,7 +19,7 @@ $ ./cardano-signer help -cardano-signer 1.8.0 +cardano-signer 1.9.0 Signing a hex/text-string or a binary-file: @@ -45,7 +45,7 @@ Signing a payload in CIP-8 mode: Output: "signature_hex + publicKey_hex" or JSON-Format -Signing a catalyst registration/delegation/deregistration in CIP-36 mode: +Signing a catalyst registration/delegation or deregistration in CIP-36 mode: Syntax: cardano-signer sign --cip36 Params: [--vote-public-key "||" public-key-file(s) or public hex/bech-key string(s) to delegate the votingpower to (single or multiple) @@ -54,15 +54,15 @@ Signing a catalyst registration/delegation/deregistration in CIP-36 mode: --rewards-address "" rewards stake address (bech format like 'stake1..., stake_test1...') [--nonce ] optional nonce value, if not provided the mainnet-slotHeight calculated from current machine-time will be used [--vote-purpose ] optional parameter (unsigned int), default: 0 (catalyst) - [--deregister] optional flag to generate an empty delegation (=deregistration), votingpower/rewardsaddress will be ignored + [--deregister] optional flag to generate a deregistration (no --vote-public-key/--vote-weight/--rewards-address needed [--testnet-magic [xxx]] optional flag to switch the address check to testnet-addresses, default: mainnet - [--json | --json-extended] optional flag to generate output in json/json-extended format, default: cborHex + [--json | --json-extended] optional flag to generate output in json/json-extended format, default: cborHex(text) [--out-file ""] path to an output file, default: standard-output [--out-cbor ""] path to write a binary metadata.cbor file to Output: Registration-Metadata in JSON-, cborHex-, cborBinary-Format -Verifying a hex/text-string or a binary-file(data) via signature + publicKey: +Verifying a hex/text-string or a binary-file via signature + publicKey: Syntax: cardano-signer verify Params: --data-hex "" | --data "" | --data-file "" @@ -75,15 +75,14 @@ Verifying a hex/text-string or a binary-file(data) via signature + publicKey: ``` -![image](https://user-images.githubusercontent.com/47434720/193452839-c8bdcfa3-cd63-4b40-a3a1-4f547449f7a4.png) - +![image](https://user-images.githubusercontent.com/47434720/197326961-31b8be92-22cf-42e4-b901-9d6212e1ff32.png)

## Examples -### Signing (defaultmode) +### Signing (in defaultmode) ``` console ### SIGN HEXDATA OR TEXTDATA WITH A KEY-HEXSTRING @@ -92,6 +91,7 @@ $ cardano-signer sign \ --data-hex "8f21b675423a65244483506122492f5720d7bd35d70616348089678ed4eb07a9" \ --secret-key "c14ef0cc5e352446d6243976f51e8ffb2ae257f2a547c4fba170964a76501e7a" +Output (cbor-hex): ca3ddc10f845dbe0c22875aaf91f66323d3f28e265696dcd3c56b91a8e675c9e30fd86ba69b9d1cf271a12f7710c9f3385c78cbf016e17e1df339bea8bd2db03 9be513df12b3fabe7c1b8c3f9fab0968eb2168d5689bf981c2f7c35b11718b27 $ cardano-signer sign \ @@ -116,6 +116,7 @@ $ cardano-signer sign \ --data-hex "8f21b675423a65244483506122492f5720d7bd35d70616348089678ed4eb07a9" \ --secret-key owner.staking.skey +Output (cbor-hex): ca3ddc10f845dbe0c22875aaf91f66323d3f28e265696dcd3c56b91a8e675c9e30fd86ba69b9d1cf271a12f7710c9f3385c78cbf016e17e1df339bea8bd2db03 9be513df12b3fabe7c1b8c3f9fab0968eb2168d5689bf981c2f7c35b11718b27 $ cardano-signer sign \ @@ -127,6 +128,7 @@ Error: The file 'owner.staking.vkey' is not a signing/secret key json $ cardano-signer sign --data-file test.txt --secret-key test.skey +Output (cbor-hex): caacb18c46319f55b932efa77357f14b66b27aa908750df2c91800dc59711015ea2e568974ac0bcabf9b1c4708b877c2b94a7658c2dcad78b108049062572e09 57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0 ``` @@ -144,6 +146,7 @@ $ cardano-signer sign --cip8 \ --secret-key myStakeKey.skey \ --testnet-magic 1 +Output (cbor-hex): 5b2e7ac3fbe3cec1540f98fcc29c1ab63778e14a653a2328b2e56af6fd2a714540708e5f3e19670b9b867151c7dfb75061c6b94508d88f43ad3b3893ca213506 57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0 $ cardano-signer sign --cip8 \ @@ -153,6 +156,7 @@ $ cardano-signer sign --cip8 \ --testnet-magic 1 \ --json-extended +Output (extended-json): { "workMode": "sign-cip8", "addressHex": "e0171983a1178a55b02afacfd6ad6b516da375469fd7dbcf54a2f95823", @@ -171,6 +175,7 @@ $ cardano-signer sign --cip8 \ --secret-key myStakeKey.skey \ --testnet-magic 1 +Output (cbor-hex): 5b2e7ac3fbe3cec1540f98fcc29c1ab63778e14a653a2328b2e56af6fd2a714540708e5f3e19670b9b867151c7dfb75061c6b94508d88f43ad3b3893ca213506 57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0 ``` @@ -187,7 +192,7 @@ $ cardano-signer sign --cip36 \ --secret-key myStakeKey.skey \ --json -Output: (Nonce automatically calculated from current machine time) +Output (json): (Nonce automatically calculated from current machine time) { "61284": { "1": [ @@ -213,6 +218,7 @@ $ cardano-signer sign --cip36 \ --testnet-magic 1 \ --out-cbor catalyst-delegation.cbor +Output (cbor-hex): a219ef64a5018182582057758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0010258209be513df12b3fabe7c1b8c3f9fab0968eb2168d5689bf981c2f7c35b11718b2703581de0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f041a0449d908050019ef65a1015840c839244556db17a2df914c7291c891e5abd1bd580de7786d640da9e27983efe86495cbee900eb685c08e367e778bb0860c6e366b9ec715d8fba824ef55c8aa0f ### REGISTER/DELEGATE TO MULTIPLE VOTING-KEYS WITH VOTINGPOWER 10%,20%,70% @@ -230,6 +236,7 @@ $ cardano-signer sign --cip36 \ --testnet-magic 1 \ --out-cbor catalyst-multidelegation.cbor +Output (cbor-hex): a219ef64a5018382582099d1d0c4cdc8a4b206066e9606c6c3729678bd7338a8eab9bffdffa39d3df9580a825820c2cd50d8a231fbc1444d65abab4f6bf74178e6de64722558eeef0b73de293a8a1482582051f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b518460258209be513df12b3fabe7c1b8c3f9fab0968eb2168d5689bf981c2f7c35b11718b2703581de0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f041a0449d908050019ef65a1015840ecce4b2e10146857b9f583ce01b10a26726022963d47fd61d0fbb67b543428fa46315d4e35b2ab73e7e15f620883176422a19e780a751d71ac488053365e6402 $ cardano-signer sign --cip36 \ @@ -241,41 +248,68 @@ $ cardano-signer sign --cip36 \ --testnet-magic 1 \ --json-extended +Output (extended-json): { "workMode": "sign-cip36", - "registrationCBOR": "a219ef64a5018282582051f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b50182582057758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f00502582086870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e03581de0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f041a075bcd15050019ef65a1015840a97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d", - "registrationJSON": { - "61284": { - "1": [ - [ - "0x51f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b5", - 1 - ], - [ - "0x57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0", - 5 - ] - ], - "2": "0x86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e", - "3": "0xe0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f", - "4": 123456789, - "5": 0 - }, - "61285": { - "1": "0xa97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d" - } - }, + "votePurpose": "Catalyst", + "totalVoteWeight": 6, "signDataHex": "45d05fca1f25e1a01c375dc2c8896e1fe61619852bbef2b26b4ece433c5bdeb7", "signature": "a97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d", "secretKey": "f5beaeff7932a4164d270afde7716067582412e8977e67986cd9b456fc082e3a", - "publicKey": "86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e" + "publicKey": "86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e", + "output": { + "cbor": "a219ef64a5018282582051f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b50182582057758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f00502582086870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e03581de0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f041a075bcd15050019ef65a1015840a97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d", + "json": { + "61284": { + "1": [ + [ + "0x51f117d26e29aea7db3d1f2f874ab5f585f619a95aed6d71d31a7404cb6557b5", + 1 + ], + [ + "0x57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0", + 5 + ] + ], + "2": "0x86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e", + "3": "0xe0c13582aec9a44fcc6d984be003c5058c660e1d2ff1370fd8b49ba73f", + "4": 123456789, + "5": 0 + }, + "61285": { + "1": "0xa97affe866b515f3dadb3038b4ccc58bf689005d417300fbf57d3f17eceb553d7354d919adb59a8b6dc30afb6cdda414812c3ffd4dfceebb15e391a7415bde0d" + } + } + } } +``` + +### Signing (CIP-36 mode) - Catalyst Voting-Chain De-Registration +``` console +### DEREGISTER FROM THE VOTING-CHAIN WITH MINIMAL PARAMETERS (Mainnet example) + +$ cardano-signer sign --cip36 \ + --deregister \ + --secret-key myStakeKey.skey \ + --json + +Output (json): (Nonce automatically calculated from current machine time) +{ + "61286": { + "1": "0x57758911253f6b31df2a87c10eb08a2c9b8450768cb8dd0d378d93f7c2e220f0", + "2": 74858300, + "3": 0 + }, + "61285": { + "1": "0xc7bec561f2b80766f78c169ccb231865048e0ed7e9fb4f98f263d00e3e4a2e6126a18f70b303be63f8e01f46dd116be5c387495a7cec707d3ebc3e6be4d87008" + } +} ```
-### Verification (defaultmode) +### Verification ``` console ### VERIFY HEXDATA or TEXTDATA WITH A SIGNATURE AND A KEY-HEXSTRING @@ -326,7 +360,16 @@ true

-## Release Notes +## Release Notes / Change-Logs + +* **1.9.0** + #### CIP-36 mode updates: + - Added the new [deregistration metadata format](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0036#deregistration-metadata-format-catalyst) in CIP-36 mode, which is using key 61286 for the deregistration data. + - Changed the output of `--json-extended` in CIP-36 mode to output the cbor and json content below the "output" key [example](https://github.com/gitmachtl/cardano-signer/edit/main/README.md#signing-cip-36-mode---catalyst-voting-registration--votingpower-delegation) + #### General: + - Using the general bech32 lib to decode public/private keys, so **any bech32 string** can be used. Before it was limited to `ed25519_pk` and `ed25519_sk` prefixes. + - Defining command-line argument types to avoid parsing arguments like `--data-hex="000000"` as a number. Must be parsed as a string of course. + - Added command-line aliases so you **can also use**: `--signing-key` or `--secret-key`, `--verification-key` or `--public-key`, etc. * **1.8.0** #### CIP-36 mode updates: