vacuumlabs/cardano-hw-cli

Strange issue with vKey witness problem

Closed this issue ยท 25 comments

HW-CLI 1.11.0-rc3
Cardano-App 5.0.0
Carcano-Cli 1.35.3
Chain: PreProd
Era: Alonzo

Asset Minting transaction + 2x metadata files attached, the following example works:

Transaction creation:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820164ae288559ea58ff805750589bbd0816ffda3e9084e01322d3385daaf5ca1b60001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00680dbba1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e09021a0002e195031a005d0a3909a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e010758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4ba101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

After it went thru HW-CLI canonical order correction:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820164ae288559ea58ff805750589bbd0816ffda3e9084e01322d3385daaf5ca1b60001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00680dbba1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e09021a0002e195031a005d0a390758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4b09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

After the signing via HW-Wallet:

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820164ae288559ea58ff805750589bbd0816ffda3e9084e01322d3385daaf5ca1b60001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00680dbba1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e09021a0002e195031a005d0a390758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4b09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f584024fa74d077fa2ca2346c2be000e8d74cc52df6e9b2bcc7f9f87443d3d07ee3a3082bceab9e6a102af6758e631c68f7821a461b46359fddb08a6529877017b50d8258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f02034958409af92fb74d7556d07e7ec5aba2d80ff7516aa6fdb2d5384de524b665e70b7891788cb2521d0047abea658f311cb85b6fdcd9fee02a10d8e64bc9123d0a7d870b01818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

-> SUBMIT -> OK

$ cardano-cli transaction view ... <above signed txfile>
auxiliary scripts: null
certificates: null
collateral inputs: []
era: Alonzo
fee: 188821 Lovelace
inputs:
- 164ae288559ea58ff805750589bbd0816ffda3e9084e01322d3385daaf5ca1b6#0
metadata:
  '1':
  - - test
    - second entry
  '2':
  - - test
    - first entry
  '674':
  - - msg
    - - minting with non-canonical metadata attached
mint:
  policy 34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518:
    asset 4154414441636f696e (ATADAcoin): 1
outputs:
- address: addr_test1qp6fwmz547h5gnmu6jvmmpge4tr9j2cnkg4e6kqh7rd9c5sr6gz4xgyf45hhs95f9ch0g2zfk76j0z8yrvlagwnwq88sq0cm9e
  address era: Shelley
  amount:
    lovelace: 6819259
    policy 34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518:
      asset 4154414441636f696e (ATADAcoin): 9
  datum: null
  network: Testnet
  payment credential key hash: 74976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c52
  reference script: null
  stake reference:
    stake credential key hash: 03d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf
required signers (payment key hashes needed for scripts): null
update proposal: null
validity range:
  lower bound: null
  upper bound: 6097465
withdrawals: null
witnesses:
- key: VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")
  signature: SignedDSIGN (SigEd25519DSIGN "24fa74d077fa2ca2346c2be000e8d74cc52df6e9b2bcc7f9f87443d3d07ee3a3082bceab9e6a102af6758e631c68f7821a461b46359fddb08a6529877017b50d")
- key: VKey (VerKeyEd25519DSIGN "0186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f020349")
  signature: SignedDSIGN (SigEd25519DSIGN "9af92fb74d7556d07e7ec5aba2d80ff7516aa6fdb2d5384de524b665e70b7891788cb2521d0047abea658f311cb85b6fdcd9fee02a10d8e64bc9123d0a7d870b")

This is the same transaction again with the only difference that the order of the 2x metadata files have switched places during the cardano-cli build-raw command:

Transaction creation:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820c6afe424d3dd9a96bc08c33436b82df647c97fa77f051c800bb0c7a586982fcc0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00652c26a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0a021a0002e195031a005d0af209a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e010758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4ba101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

After it went thru HW-CLI canonical order correction:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820c6afe424d3dd9a96bc08c33436b82df647c97fa77f051c800bb0c7a586982fcc0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00652c26a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0a021a0002e195031a005d0af20758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4b09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

After the signing via HW-Wallet:

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820c6afe424d3dd9a96bc08c33436b82df647c97fa77f051c800bb0c7a586982fcc0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00652c26a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0a021a0002e195031a005d0af20758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4b09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f5840eb5d7bb96974d6a777da2d15ddd27ad76901ddffff28034b533951d5591fb85eab131dc5f1a453f742d4fbec94b4fa65abc5b036d67ca4b35ba7e4204e17e90e8258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f0203495840be5197f4fb7807afa972c39ccb32f2b600df2995fdefd7de17d52297fae863df26e4946a5d252f1aff074b301253e262f74efddfaf15b1547138496aa1c8b40701818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

-> SUBMIT -> ERROR

Submitting the transaction via the node... Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (InvalidWitnessesUTXOW [VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")]))])

Transaction View shows the following:

$ cardano-cli transaction view ... <above signed txfile>
${cardanocli} transaction view --tx-file /tmp/ledger-red.payment.tx
auxiliary scripts: null
certificates: null
collateral inputs: []
era: Alonzo
fee: 188821 Lovelace
inputs:
- c6afe424d3dd9a96bc08c33436b82df647c97fa77f051c800bb0c7a586982fcc#0
metadata:
  '1':
  - - test
    - second entry
  '2':
  - - test
    - first entry
  '674':
  - - msg
    - - minting with non-canonical metadata attached
mint:
  policy 34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518:
    asset 4154414441636f696e (ATADAcoin): 1
outputs:
- address: addr_test1qp6fwmz547h5gnmu6jvmmpge4tr9j2cnkg4e6kqh7rd9c5sr6gz4xgyf45hhs95f9ch0g2zfk76j0z8yrvlagwnwq88sq0cm9e
  address era: Shelley
  amount:
    lovelace: 6630438
    policy 34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518:
      asset 4154414441636f696e (ATADAcoin): 10
  datum: null
  network: Testnet
  payment credential key hash: 74976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c52
  reference script: null
  stake reference:
    stake credential key hash: 03d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf
required signers (payment key hashes needed for scripts): null
update proposal: null
validity range:
  lower bound: null
  upper bound: 6097650
withdrawals: null
witnesses:
- key: VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")
  signature: SignedDSIGN (SigEd25519DSIGN "eb5d7bb96974d6a777da2d15ddd27ad76901ddffff28034b533951d5591fb85eab131dc5f1a453f742d4fbec94b4fa65abc5b036d67ca4b35ba7e4204e17e90e")
- key: VKey (VerKeyEd25519DSIGN "0186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f020349")
  signature: SignedDSIGN (SigEd25519DSIGN "be5197f4fb7807afa972c39ccb32f2b600df2995fdefd7de17d52297fae863df26e4946a5d252f1aff074b301253e262f74efddfaf15b1547138496aa1c8b407")

Looks like there is a deeper issue with the signing, this is a tx with just a simple metadata included:

Transaction created:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a600818258207924b21c32851af9113ee850b1853a9f65ce8753bdd7f71263698b188a24bea30001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00626df9a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0b021a0002d535031a005d12fa09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0107582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c5a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

After it went thru the HW-CLI autocorrection:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a600818258207924b21c32851af9113ee850b1853a9f65ce8753bdd7f71263698b188a24bea30001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00626df9a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0b021a0002d535031a005d12fa07582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c509a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

Notice that nothing has changed other than the order of the array entry No7 vs No9 before and after the canonical correction. But no change in the metadata hash or so, because nothing in the metadata was changed.

Signed via HW-Wallet:

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a600818258207924b21c32851af9113ee850b1853a9f65ce8753bdd7f71263698b188a24bea30001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00626df9a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0b021a0002d535031a005d12fa07582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c509a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f5840b489b560acef6638b46e5a6a2c959ca8969503131452b973607cc090951e996bd71c03db8ad223ae666cb0b918ecbc568d42db86ee8ffdbb712a77c884468f0f8258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f0203495840cea580f56b5bcc34ef5e7b989afce1310e58f58c8d248ae7088a629cdc2e2dd79b829bd6bca54c9a635e13b0b3e7b1fd0178b972a0a2f20622858b16c8b2780101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

-> SUBMIT -> ERROR

Submitting the transaction via the node... Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (InvalidWitnessesUTXOW [VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")]))])

Notice - If no metadata is included in the transaction it is going straight thru.

UPDATE:
i have tried the same transaction again a bit later and it worked!?
i have than tried the same transaction again a bit later and it failed again!?

This one FAILED...

After creating

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820bf45f88d729d0af72e24d2d1debe011df2fb3da3ce7b83c31a17ed921df65c9a0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a005cc38fa1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0d021a0002d535031a005d156109a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0107582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c5a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

After canonical correction:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820bf45f88d729d0af72e24d2d1debe011df2fb3da3ce7b83c31a17ed921df65c9a0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a005cc38fa1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0d021a0002d535031a005d156107582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c509a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

After signing:

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820bf45f88d729d0af72e24d2d1debe011df2fb3da3ce7b83c31a17ed921df65c9a0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a005cc38fa1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0d021a0002d535031a005d156107582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c509a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f5840e6b4223e1cd0f32c1e3b026278ab3a11e1d82336a57a732e7e9cab3c13744e5533cf8e3f2e8f571f481d85e0ba2ddeff2be7565647ff158cb786d2ea8fd4c90f8258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f0203495840965166ab0d518bb0baca89a93fbe0118cbe9ee8d1a62502e2949cc7a937ebda1a9ecca9e0d5b069a83a0185306b56dcbd25ccf40ca4f09ada9b0c8862c37ab0d01818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

-> SUBMIT -> ERROR

Submitting the transaction via the node... Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (InvalidWitnessesUTXOW [VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")]))])

This one went thru again, same transaction builing!

After creation:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820bf45f88d729d0af72e24d2d1debe011df2fb3da3ce7b83c31a17ed921df65c9a0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a005cc38fa1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0d021a0002d535031a005d15d009a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0107582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c5a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

After canonical correction:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820bf45f88d729d0af72e24d2d1debe011df2fb3da3ce7b83c31a17ed921df65c9a0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a005cc38fa1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0d021a0002d535031a005d15d007582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c509a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

After signing:

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820bf45f88d729d0af72e24d2d1debe011df2fb3da3ce7b83c31a17ed921df65c9a0001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a005cc38fa1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e0d021a0002d535031a005d15d007582079ecea5c9901f2d1c810838fda536d4c0140a17462f1e226029742b1eb6893c509a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f5840928a3b63e2f789cbeed6372dc303eefbcd38e4dba5acd814ff9de03ee47a3c2d8c7faae713fb859e5b3e5ae0b22ba5ebe1f06f0770b3e1377f0046b1a27f040d8258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f02034958401e0a0f3b5b09b6ba58048c016aad4719230e3949013b3aa0a59c259859ff77d1d99567131fb9b7b1c3f3b75d7a93783e577a4a517e7f7a51de25f383c63fa20801818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a11902a2a1636d7367816c746573746d65746164617461"
}

-> SUBMIT -> OK

Again, this one went thru:

After creating:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820c8194a0e3e8687a76dbf8dbf2c0351c41b3c0e1cf07124d0644e68cac0e7a6710001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00a49046a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e08021a0002e195031a005d1bce09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e010758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4ba101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

After canonical correction:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820c8194a0e3e8687a76dbf8dbf2c0351c41b3c0e1cf07124d0644e68cac0e7a6710001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00a49046a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e08021a0002e195031a005d1bce0758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4b09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

After signing:

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a60081825820c8194a0e3e8687a76dbf8dbf2c0351c41b3c0e1cf07124d0644e68cac0e7a6710001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00a49046a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e08021a0002e195031a005d1bce0758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4b09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f58403ee83a08984e05a0cf137a09980eba51634562714e99a6f4019ddb362430fe3d6cba7aed42c1fad11e0b03b571ad16e570f1758300dc948f4620ac331b2def028258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f020349584083bc3549c542913c79b0f89a65c284cfd27d7351d4b8a4b5d42a71e5f8c426b11fe4dd21228dcc021303ce0a78c1ea61457d5b41e9f1fb2abdf5783928507d0801818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

-> SUBMIT -> OK


Same command again...

After creating:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a6008182582076ec1b51e8073c2f2a48266ddf10eff415b697fe6866153861c7b415182ca0a20001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00a1aeb1a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e09021a0002e195031a005d1be909a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e010758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4ba101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

After canonical correction:

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a6008182582076ec1b51e8073c2f2a48266ddf10eff415b697fe6866153861c7b415182ca0a20001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00a1aeb1a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e09021a0002e195031a005d1be90758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4b09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

After the signing:

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a6008182582076ec1b51e8073c2f2a48266ddf10eff415b697fe6866153861c7b415182ca0a20001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a00a1aeb1a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e09021a0002e195031a005d1be90758206f06a72a7e5e681582a35158205d77394390e939a0dfaffc8c826c71a1c9cb4b09a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f584026675a33243f5445977a3d9f7a5cd1d1f471cefe974263d94fc9a7ca2d136b538d40c1205ca6591ecb202cdb4b4140ef5004b0bb707c64201221ad76f924a5018258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f020349584005c4e8042e1386953a4c9a7c4acc623f81f44a238174ff247ae31b6868f94c4a74713303049063d998c46d094ef804483dbd4e4b2bcb26cda79ca0d45871d20101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5d90103a100a301a164746573746c7365636f6e6420656e74727902a164746573746b666972737420656e7472791902a2a1636d736781782c6d696e74696e672077697468206e6f6e2d63616e6f6e6963616c206d65746164617461206174746163686564"
}

-> SUBMIT -> ERROR

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (InvalidWitnessesUTXOW [VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")]))])

Something strange is going on here...

@janmazak @gabrielKerekes not sure if this is a node/cli issue or a hw/signing issue

i can kind of replicate the issue, i mint an asset (+1), signing, submit -> ok, wait for the next block. mint again an asset (+1) -> fails with vkey witness error.
if i wait 2 blocks, even the new balance is reported back correctly with the block after the minting, it works.
do we have a node issue with ledger update or is it a hw/signing issue?

First transaction - 14 ATADAcoins on the address, after the minting it should be 15 -> OK:
image

Second transaction after the next block came in - 15 ATADAcoins on the address OK, after the minting it should be 16 -> FAILED:
image

Trying the same again a bit later: 15 ATADAcoins on the addres OK, after the minting it should be 16 -> OK:
image

Notice that nothing has changed other than the order of the array entry No7 vs No9 before and after the canonical correction. But no change in the metadata hash or so, because nothing in the metadata was changed.

The metadata hash (called the auxiliary data hash in alonzo) is inside of the transaction body. The transaction signature is a digital signature of the transaction ID, which is a hash of the transaction body. So if you rearrange the fields in the transaction body, you will get a different transaction ID and invalidate the signature. Indeed that's what the InvalidWitnessesUTXOW failure is indicating.

This doesn't make sense to me. The fields for map entry 7 and 9 changed position, but the auxiliarydata at the end didn't change so also no change in the auxmetahash. And this was done before the tx was signed. Not afterwards. It also does not explain the strange behaviour after a block or after two blocks. Same transaction building over and over again is one time working, the other time not.

And this was done before the tx was signed. Not afterwards.

Are you sure that the transaction that you submitted had the same ID as that which you signed? The signature will only be valid for one of the two transaction bodies that you have above (even though they are semantically the same).

The steps above are in order. First the generation via cardano-cli build-raw. After that it is going thru hw-cli which will do a canonical order to be ready for hw-wallet-signing. After that it is singed via the hw-wallet and after that its submitted. No jumps.
Its clear that the txid changes if the order within the tx changes. So the txid of the original tx after the building and after the canonical order is different of course. But the original tx will not be used, only the one with the correct canonical order.

Hm, I'm not sure what the issue could be ๐Ÿค” @gitmachtl Can't there be some concurrency problem within the scripts you are using? E.g. the transaction file has not yet been fully written before being read, parsed and sent to the HW wallet? Which would mean that you are sending the previously built transaction to the HW wallet ๐Ÿค”

Have you tried re-signing and/or re-submitting the failed transaction manually after your script failed? Did that work? Could you confirm that the data displayed on Ledger are the data you expect (mainly the fee, which is the only thing which changes between the failed and passed attempts)?

Can't there be some concurrency problem within the scripts you are using? E.g. the transaction file has not yet been fully written before being read, parsed and sent to the HW wallet?

I doubt that, here you can see the sequence of the txfile correction. The filename of the txfile after the building via cardano-cli transaction build-raw is passed. After the correction the file is overwritten with the corrected one and again checked about the error code. After the function the txfile is passed to the hw-cli for signing.
https://github.com/gitmachtl/scripts/blob/e905dd84c1a0c2315aca87ea0b6aa8a1c643f47a/cardano/mainnet/00_common.sh#L1277-L1345

And as you can see in the screen shots, the output of the corrected txfile is directly made via a cat command:

$ cat ${TxBodyFile}

https://github.com/gitmachtl/scripts/blob/e905dd84c1a0c2315aca87ea0b6aa8a1c643f47a/cardano/mainnet/11a_mintAsset.sh#L366
So the corrected one was written out before it is used next with the hw-cli.

Have you tried re-signing and/or re-submitting the failed transaction manually after your script failed? Did that work? Could you confirm that the data displayed on Ledger are the data you expect (mainly the fee, which is the only thing which changes between the failed and passed attempts)?

The timing is a bit hard on that, because once another new block is coming in, it works again. Its really a weird thing, because nothing changes for the transactions, only the input utxo, the slotnumber and the amount of the tokens.

The shown error with the vKey witness is the one for the asset policy, not the payment vkey.

The issue is also showing up with a simple Asset mint and singing via HW-CLI ! This is without additional metadata attached.

Building the unsigned transaction body:  /tmp/ledger-red.payment.txbody

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a500818258201476db8a24ca88ee6ab23e589f7dcdf1776699ed36ff37111b16a3d2180e53800001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a007f9851a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e12021a0002ca8d031a00617e7009a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5f6"
}

Autocorrect the TxBody for canonical order: The transaction CBOR is valid and canonical.

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a500818258201476db8a24ca88ee6ab23e589f7dcdf1776699ed36ff37111b16a3d2180e53800001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a007f9851a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e12021a0002ca8d031a00617e7009a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5f6"
}

Sign the Tx-Body with the ledger-red.payment.skey|hwsfile and assets/machtl.policy.skey|hwsfile:  /tmp/ledger-red.payment.tx

Reading unencrypted file assets/machtl.policy.skey ... OK

Adding the Payment-Witness signing from a local Hardware-Wallet key 'ledger-red.payment.hwsfile', continue? [Y/n]
Cardano App Version 5.0.0 (HW-Cli Version 1.11.0-rc.3) found on your Ledger device!
Please approve the action on your Hardware-Wallet (abort with CTRL+C) ... DONE

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a500818258201476db8a24ca88ee6ab23e589f7dcdf1776699ed36ff37111b16a3d2180e53800001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a007f9851a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e12021a0002ca8d031a00617e7009a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f58406f3c6ab398619c5c765e280a46d976aea0eb14ade686563ecae45edb60d787114595d56c6f5ed30311fd4c53d73c27e97995c9366fbc0eefac05ab1f00c303048258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f02034958403a37b7d93f691641002bff8eb90924bd9bf815ab0fa3bc8bc46deac1b0eb1de9b6ee6f3be11d9c645ec5e50a4b092e0273f0d65c27be5991bf281e5838e5720001818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5f6"
}

Transaction-Size: 448 bytes (max. 16384)


Does this look good for you, continue ? [y/N] y

Submitting the transaction via the node... Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (InvalidWitnessesUTXOW
[VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")]))])

This was tested on PreProd - 1.35.3 node/cli - alonzo era

I can also reproduce it on 1.35.2 node/cli - legacy testnet - babbage era, the errormessage of the 1.35.2 cli is a bit different than:

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (InvalidWitnessesUTXOW [VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")])))])

Downgraded the Cardano-App to 4.1.2 and did a minting Transaction without any other metadata attached, also no auto-canonical-correction:

Building the unsigned transaction body:  /tmp/ledger-red.payment.txbody

{
    "type": "Unwitnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a5008182582020d676faaeb3c26775190960b3cf02046e708e61fd8318d37af4acdeb81ff2320001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a006b9e66a1581
c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e1819021a0002cab9031a006185a909a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a101818200581c45d70e54f3b5e9c5a2b0cd417028
197bd6f5fa5378c2f5eba896678df5f6"
}

Sign the Tx-Body with the ledger-red.payment.skey|hwsfile and assets/machtl.policy.skey|hwsfile:  /tmp/ledger-red.payment.tx

Reading unencrypted file assets/machtl.policy.skey ... OK

Adding the Payment-Witness signing from a local Hardware-Wallet key 'ledger-red.payment.hwsfile', continue? [Y/n]
Cardano App Version 4.1.2 (HW-Cli Version 1.11.0-rc.3) found on your Ledger device!
Please approve the action on your Hardware-Wallet (abort with CTRL+C) ... DONE

{
    "type": "Witnessed Tx AlonzoEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a5008182582020d676faaeb3c26775190960b3cf02046e708e61fd8318d37af4acdeb81ff2320001818258390074976c54afaf444f7cd499bd8519aac6592b13b22b9d5817f0da5c5203d205532089ad2f7816892e2ef42849b7b52788e41b3fd43a6e01cf821a006b9e66a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e1819021a0002cab9031a006185a909a1581c34250edd1e9836f5378702fbf9416b709bc140e04f668cc355208518a1494154414441636f696e01a200828258201287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f584090fd63173c366fc118d490e9f2f530ebf56eb08b9a9e370b4b25b219341b0249a460140707176dbe1a48ccdb38bd70e0c11b2de04814da6602ff14694c4540018258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f020349584020bc5f8ef447372efedf4b2458fbeee32a5ff7fd4a47d5c0437d2b0c38700b4cd0ed02da2ee7ed000f971f8e0301e0ebecf690a72add32e28275059b7141d00901818200581c45d70e54f3b5e9c5a2b0cd417028197bd6f5fa5378c2f5eba896678df5f6"
}

Transaction-Size: 449 bytes (max. 16384)


Does this look good for you, continue ? [y/N] y

Submitting the transaction via the node... Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (InvalidWitnessesUTXOW
[VKey (VerKeyEd25519DSIGN "1287e9ce9e00a603d250b557146aa0581fc4edf277a244ce39d3b2f2ced5072f")]))])

Ok, so it could be a rare issue with the hw-signing and the used policy for the assets. I retried the same transactions over and over again with another policy and i think 15-20 transactions in a row without an issue at all. Than switched back to the original policy and the third try failed again.

Using the same policy with cli key signing for the payment, does not generate a single error at all. I am running automated minting transaction with that policy on the testnets for traffic generation if i am not doing this testing here.

I also downgraded hw-cli to 1.10 and cardano-app to 4.1.2 for that. Will repeat this same test again.

@JaredCorduan @gabrielKerekes SORRY GUYS! Turns out it was a testing issue, i had an additional testroutine running in a loop in the background that also used the same policy and wrote out to the same temporary witness file. So while doing the Signing on the HW-Wallet, the policy witness file changed in the meantime from time to time and was than assembled. That caused of course the witness error for the policy vkey.


But i saw the following: I extracted the secret keys from the Ledger Mnemonic to compare the signing between CLI keys and HW-CLI signing.

The witness via cardano-cli looks like:

{
    "type": "TxWitness AlonzoEra",
    "description": "Key Witness ShelleyEra",
    "cborHex": "8258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f02034958405d25f1333ffe436a318b5877082183d4b1657ff5d012f3124a4a3c6f7652af35519c74e2ecbe54bfff32891d1750895b13f39d911b745d8a7fbd667205754703"
}

same signing keys via HW-CLI witness looks like:

{
    "type": "TxWitness AlonzoEra",
    "description": "",
    "cborHex": "82008258200186abff41121414f856fd8cf613399f9a30e413bb1c75c2413f46121f02034958405d25f1333ffe436a318b5877082183d4b1657ff5d012f3124a4a3c6f7652af35519c74e2ecbe54bfff32891d1750895b13f39d911b745d8a7fbd667205754703"
}

So the HW-CLI adds

82  # array(2)
00  # unsigned(0)

infront, why? Looks like it doesn't bother cardano-cli assemble much, but i was wondering why it is there.

great to hear the mystery is solved @gitmachtl !

I'll try to have a look soon to see what that unsigned(0) is about, and if it's ledger or the cli.

I'm also glad the issue is resolved ๐Ÿ‘

I'm not sure about the 0 ๐Ÿค” It seems that it was used for distinction between Byron and Shelley keys - perhaps cardano-cli used that too at some point? ๐Ÿคท Maybe @janmazak has some more insight.

Anyways, we don't even support Byron keys anymore so if the nested array is an issue, it could be removed, but if it's just a detail I'd rather not touch it.

@gitmachtl @JaredCorduan The 0 in the outer array marks the witness as Shelley witness. The value would be 2 for Byron witness (and it seems to me we still support them? @gabrielKerekes ). Apparently, that's how cardano-cli did it in the past, and they might have changed it in the meantime.

Cardano-hw-cli mimicks behaviour of cardano-cli. However, since lots of that behaviour is undocumented and kind of random (e.g. serialization format not a canonical CBOR), we just observed and copied it as best as we could, and we don't track changes in cardano-cli in detail, so basically while it works, it works, and if something breaks, then we investigate and change something in the hw-cli code.

So I'd agree that while it works, it is best not to touch it. It does not have any effect on tx size and fees, it's just a discrepancy in the temporary file of cli tools.

and it seems to me we still support them? @gabrielKerekes

The following command fails with Error: not implemented because of this line.

cardano-hw-cli address key-gen \
--path 44H/1815H/0H/0/0 \
--verification-key-file byron.vkey \
--hw-signing-file byron.hwsfile

Is this a bug then?

@gabrielKerekes I'd say it is a bug. That function only adds description, getting the key from the HW wallet etc. should not fail. I am not sure what the correct description should be, but I'd go with "Payment Verification Key" (the same as for Shelley) since cardano-cli does not care about derivation paths, it only works with derived keys.

Closing this as the issue is resolved. I created a new issue for the Byron paths #134.