<p>That payload looks good, just the address seems invalid. Probably need to access the array via <code>addr[0]</code> instead of <code>addr.get(0)</code>, try this:</p>
<pre><code>let namiAPI = await window.cardano.nami.enable();
let addr = await namiAPI.getUsedAddresses();
let payload = &quot;48656C6C6F20576F726C6421&quot;; //hex of &quot;Hello World!&quot;
let signed = await namiAPI.signData(addr[0], payload);
</code></pre>

CC BY-SA 4.0
2022-08-25T07:31:38.743Z
2022-08-25T07:31:38.743Z
sean
<p>I'm facing a problem when I try to sign data with Nami Wallet API.</p>
<p>Here is the code snippet:</p>
<pre><code>let namiAPI = await window.cardano.nami.enable();
let addr = await namiAPI.getUsedAddresses();
let payload = &quot;48656C6C6F20576F726C6421&quot;; //hex of &quot;Hello World!&quot;
let signed = await namiAPI.signData(addr.get(0), payload);
</code></pre>
<p>I get the following error:</p>
<pre><code>{
    &quot;code&quot;: 4,
    &quot;info&quot;: &quot;If a wallet enforces data format requirements, this error signifies that the data did not conform to valid formats.&quot;
}
</code></pre>
<p>What could be the problem? Am I encoding the payload wrong?</p>

<nami-wallet><message-signing>
Can't sign data with Nami Wallet
# Can't sign data with Nami Wallet

(Asked by: username_0 on 2022-08-25)

I'm facing a problem when I try to sign data with Nami Wallet API.
Here is the code snippet:
let namiAPI = await window.cardano.nami.enable();
let addr = await namiAPI.getUsedAddresses();
let payload = "48656C6C6F20576F726C6421"; //hex of "Hello World!"
let signed = await namiAPI.signData(addr.get(0), payload);

I get the following error:
{
    "code": 4,
    "info": "If a wallet enforces data format requirements, this error signifies that the data did not conform to valid formats."
}

What could be the problem? Am I encoding the payload wrong?

**Tags:** nami-wallet, message-signing

---

## 1 answers

### Answer by username_1 on 2022-08-25. Score: 1

That payload looks good, just the address seems invalid. Probably need to access the array via addr[0] instead of addr.get(0), try this:
let namiAPI = await window.cardano.nami.enable();
let addr = await namiAPI.getUsedAddresses();
let payload = "48656C6C6F20576F726C6421"; //hex of "Hello World!"
let signed = await namiAPI.signData(addr[0], payload);


---

