<p>I finally found the issue and I think I might not be the only one to fall into this trap.</p>
<p>What happened is that I defined an asset class that I used as a placeholder for a stable coin in my smart contracts. I chose the following values that I saw in one tutorial:</p>
<pre><code>stableCoinSymbol :: CurrencySymbol
stableCoinSymbol = &quot;ff&quot;

stableCoinTokenName :: TokenName
stableCoinTokenName = &quot;USDT&quot;
</code></pre>
<p>I then used this stable coin in the UTxOs of my transactions. Interestingly this works fine in the emulator, but throws a serialisation error (of course) because ff is not a valid <code>CurrencySymbol</code>.</p>
<p>So changing ff to a random valid one (e.g. <code>8d803516132f6fb8ddfcf168065886bf44ecc9e0023b570963b4bac8</code>) fixed the issue.</p>

CC BY-SA 4.0
2021-12-19T22:24:30.657Z
2022-04-24T09:48:57.787Z
2022-04-24T09:48:57.787Z
Jey
<p>When converting my <code>UnbalancedTx</code> to an <code>ExportTx</code> using the <code>export</code> function, I get this error:</p>
<pre><code>Left (Tag \&quot;toCardanoPolicyId\&quot; (Tag \&quot;1 bytes\&quot; DeserialisationError))
</code></pre>
<p>What is very strange is that when I submit the unbalanced transaction with <code>submitUnbalancedTx</code> in the emulator it works and the transaction gets executed. So it should be fine. I feel like this is a bug but I could also be missing something. Before digging deeper, I wanted to post this issue to see if someone can help me. Does anybody see what could be the reason for this issue ?</p>
<p>The error comes probably from function <code>toCardanoMintValue</code> on line 531 here: <a href="https://github.com/input-output-hk/plutus-apps/blob/main/plutus-ledger/src/Ledger/Tx/CardanoAPI.hs" rel="nofollow noreferrer">https://github.com/input-output-hk/plutus-apps/blob/main/plutus-ledger/src/Ledger/Tx/CardanoAPI.hs</a></p>
<p>The contract that I have looks like this:</p>
<pre><code>buyTokensTx :: forall w s. TokenPool -&gt; BuyTokensParams -&gt; Contract w s Text (Either ToCardanoError ExportTx)
buyTokensTx pool param = do
  m &lt;- findTokenPool pool
  case m of
    Nothing -&gt; do
      logInfo @String $ &quot;no token pool found with nft: &quot; &lt;&gt; show (nft pool)
      return (Left $ TxBodyError &quot;Error: cannot find token pool&quot;)
    Just (oref, o, state) -&gt; do
      logInfo @String $ &quot;found token pool with nft: &quot; &lt;&gt; show (nft pool)
      let lookups = ...
      let txc = ...
      case Constraints.mkTx @TokenPool lookups txc of
        Right ut -&gt; do
          let unbalTx = Constraints.adjustUnbalancedTx ut
          return (export def myNetworkId unbalTx)
        Left err -&gt; return (Left $ TxBodyError $ &quot;UnbalancedTx error:&quot; &lt;&gt; show err)
</code></pre>

CC BY-SA 4.0
2022-09-08T11:45:00.303Z
I have the same issue as this error `Left (Tag \"toCardanoPolicyId\" (Tag \"1 bytes\" DeserialisationError))` Thank you so much for the solution ;)
Kỳ Anh
<plutus><transaction><nami-wallet>
DeserialisationError when exporting UnbalancedTx
# DeserialisationError when exporting UnbalancedTx

(Asked by: username_0 on 2021-12-18)

When converting my UnbalancedTx to an ExportTx using the export function, I get this error:
Left (Tag \"toCardanoPolicyId\" (Tag \"1 bytes\" DeserialisationError))

What is very strange is that when I submit the unbalanced transaction with submitUnbalancedTx in the emulator it works and the transaction gets executed. So it should be fine. I feel like this is a bug but I could also be missing something. Before digging deeper, I wanted to post this issue to see if someone can help me. Does anybody see what could be the reason for this issue ?
The error comes probably from function toCardanoMintValue on line 531 here: https://github.com/input-output-hk/plutus-apps/blob/main/plutus-ledger/src/Ledger/Tx/CardanoAPI.hs
The contract that I have looks like this:
buyTokensTx :: forall w s. TokenPool -> BuyTokensParams -> Contract w s Text (Either ToCardanoError ExportTx)
buyTokensTx pool param = do
  m <- findTokenPool pool
  case m of
    Nothing -> do
      logInfo @String $ "no token pool found with nft: " <> show (nft pool)
      return (Left $ TxBodyError "Error: cannot find token pool")
    Just (oref, o, state) -> do
      logInfo @String $ "found token pool with nft: " <> show (nft pool)
      let lookups = ...
      let txc = ...
      case Constraints.mkTx @TokenPool lookups txc of
        Right ut -> do
          let unbalTx = Constraints.adjustUnbalancedTx ut
          return (export def myNetworkId unbalTx)
        Left err -> return (Left $ TxBodyError $ "UnbalancedTx error:" <> show err)

**Tags:** plutus, transaction, nami-wallet
> **Comments:**
> **username_1**: I have the same issue as this error `Left (Tag \"toCardanoPolicyId\" (Tag \"1 bytes\" DeserialisationError))` Thank you so much for the solution ;)  

---

## 1 answers

### Answer by username_0 on 2021-12-19. Score: 0 | Accepted answer

I finally found the issue and I think I might not be the only one to fall into this trap.
What happened is that I defined an asset class that I used as a placeholder for a stable coin in my smart contracts. I chose the following values that I saw in one tutorial:
stableCoinSymbol :: CurrencySymbol
stableCoinSymbol = "ff"

stableCoinTokenName :: TokenName
stableCoinTokenName = "USDT"

I then used this stable coin in the UTxOs of my transactions. Interestingly this works fine in the emulator, but throws a serialisation error (of course) because ff is not a valid CurrencySymbol.
So changing ff to a random valid one (e.g. 8d803516132f6fb8ddfcf168065886bf44ecc9e0023b570963b4bac8) fixed the issue.


---

