IntersectMBO / IntersectMBO/cardano-api

[BUG] Transaction serialiseToRawBytes outputs unsorted body map keys, causing hardware-wallet hash mismatches

Open
#1,045 3 comments 0 reactions 0 assignees View on GitHub
Stale
Dominant language
Haskell
Stars
40
Forks
30
Avg merge
2d 5h
Merged PRs (30d)
30

Description

The transaction CBOR produced by serialiseToRawBytes does not emit the transaction body map keys in ascending order. Although the transaction body is a CBOR map, key order is still significant for hardware wallets.

Devices like Ledger do not use the provided CBOR directly. They extract the fields, reconstruct the body internally, and then compute the transaction hash. Their reconstruction uses a sorted (ascending) key order. When the output is unsorted, the hardware wallet computes a different hash and produces an invalid signature.

To maintain hardware-wallet compatibility, the transaction body map should be sorted before serialisation. This is a straightforward change.

Note: The Cardano network itself is order-agnostic. The issue is strictly related to hardware-wallet signing behavior.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.