<p>The error you're seeing is related to deserialization. It suggests that the data format you're trying to read doesn't match the expected format. In Cardano, the data structures are often serialized using Concise Binary Object Representation (CBOR).</p>
<p>Here are some things to check:</p>
<ul>
<li><p>Data Type Mismatch: Make sure that the data type of the signedData you're trying to deserialize matches what is expected. Your error message indicates that it's expecting a CBOR Map, but it received an Array instead.</p>
</li>
<li><p>Correct Libraries: Ensure you're using the right versions of the @emurgo/cardano-message-signing-nodejs and @emurgo/cardano-serialization-lib-nodejs libraries.</p>
</li>
<li><p>Method Mismatch: If you're trying to verify a signed transaction, make sure you're using the appropriate methods for transaction verification and not the ones meant for message signing.</p>
</li>
<li><p>Documentation and Examples: Check any provided examples or documentation to ensure you're using the correct data formats and methods.</p>
</li>
</ul>
<p>It's hard to pinpoint the exact issue without more code or context, but checking these areas might help you resolve the issue. If I have to guess, you are giving it a string instead of array of bytes.</p>

CC BY-SA 4.0
2023-09-13T00:17:22.627Z
2023-09-13T00:17:22.627Z
Spawn
<p>I am building dApps on cardano, and I faced an issue.</p>
<p>I was trying to let the users sign message to verify them. (using <code>signData</code> method of wallet)</p>
<p>But <code>signData</code> method is not supported for ledger type wallet yet.</p>
<p>So I try to fix this using <code>signTx</code> method which is supported both for ledger and seed-phrase account.</p>
<p>And I got the <code>signedTx</code> (hex string) and the <code>transaction string</code> and</p>
<p>build the signedData like this.</p>
<pre><code>const signedData = {
    signature: transaction string,
    key: signed transaction
}
</code></pre>
<p>And I tried to verify this in the same way I verify the signed message using</p>
<pre><code>@emurgo/cardano-message-signing-nodejs
@emurgo/cardano-serialization-lib-nodejs
</code></pre>
<p>But I got error like this.</p>
<pre><code>Deserialization failed in TransactionWitnessSet because: Invalid cbor: not the right type, expected Map' byte received Array'.
</code></pre>
<p>Can anyone help me with this issue?</p>
<p>Thank you very much.</p>

<transaction><cardano-serialization-lib><message-signing>
How to verify signed Tx and signer's address?
# How to verify signed Tx and signer's address?

(Asked by: username_0 on 2023-09-08)

I am building dApps on cardano, and I faced an issue.
I was trying to let the users sign message to verify them. (using signData method of wallet)
But signData method is not supported for ledger type wallet yet.
So I try to fix this using signTx method which is supported both for ledger and seed-phrase account.
And I got the signedTx (hex string) and the transaction string and
build the signedData like this.
const signedData = {
    signature: transaction string,
    key: signed transaction
}

And I tried to verify this in the same way I verify the signed message using
@emurgo/cardano-message-signing-nodejs
@emurgo/cardano-serialization-lib-nodejs

But I got error like this.
Deserialization failed in TransactionWitnessSet because: Invalid cbor: not the right type, expected Map' byte received Array'.

Can anyone help me with this issue?
Thank you very much.

**Tags:** transaction, cardano-serialization-lib, message-signing

---

## 1 answers

### Answer by username_1 on 2023-09-13. Score: 1

The error you're seeing is related to deserialization. It suggests that the data format you're trying to read doesn't match the expected format. In Cardano, the data structures are often serialized using Concise Binary Object Representation (CBOR).

Here are some things to check:

* Data Type Mismatch: Make sure that the data type of the signedData you're trying to deserialize matches what is expected. Your error message indicates that it's expecting a CBOR Map, but it received an Array instead.
* Correct Libraries: Ensure you're using the right versions of the @emurgo/cardano-message-signing-nodejs and @emurgo/cardano-serialization-lib-nodejs libraries.
* Method Mismatch: If you're trying to verify a signed transaction, make sure you're using the appropriate methods for transaction verification and not the ones meant for message signing.
* Documentation and Examples: Check any provided examples or documentation to ensure you're using the correct data formats and methods.

It's hard to pinpoint the exact issue without more code or context, but checking these areas might help you resolve the issue. If I have to guess, you are giving it a string instead of array of bytes.


---

