<p><code>ff</code> is not a valid PolicyId (aka CurrencySymbol). It must be 28 bytes.</p>
<p>For examples, see this answer on this similar Github issue <a href="https://github.com/input-output-hk/plutus-apps/issues/732#issuecomment-1265261105" rel="nofollow noreferrer">https://github.com/input-output-hk/plutus-apps/issues/732#issuecomment-1265261105</a></p>

CC BY-SA 4.0
2022-12-22T08:51:56.443Z
Thanks. That solves it. "ff" seems to be ok with earlier version of plutus. Not anymore.
Adam
CC BY-SA 4.0
2022-12-21T13:39:11.537Z
2022-12-21T13:39:11.537Z
james
<p>I try to set an initial state of the emulator like so:</p>
<pre><code>test :: IO ()
test = runEmulatorTraceIO' def emCfg myTrace
  where
    dist = Map.fromList [ (senderWallet, Ada.lovelaceValueOf 100_000_000)
                        , (receiverWallet, Ada.lovelaceValueOf 100_000_000)
                        ]
  
    emCfg :: EmulatorConfig
    emCfg = EmulatorConfig (Left dist) def

myTrace :: EmulatorTrace ()
myTrace = do
  void $ Emulator.payToWallet (senderWallet) (receiverWallet) $ Ada.lovelaceValueOf 5_000_000
  void $ Emulator.waitNSlots 1
</code></pre>
<p>It works perfectly. However when I set a custom currency <code>ff</code> with:</p>
<pre><code>    dist = Map.fromList [ (senderWallet, Ada.lovelaceValueOf 100_000_000
                           &lt;&gt; Value.singleton &quot;ff&quot; &quot;TokenName&quot; 100_000_000)
                        , (receiverWallet, Ada.lovelaceValueOf 100_000_000)
                        ]
</code></pre>
<p>The script compiles but after running <code>test</code> I get this error:</p>
<blockquote>
<p>*** Exception: Cannot build the initial state: Tag &quot;toCardanoPolicyId&quot; (Tag &quot;1 bytes&quot; DeserialisationError) CallStack (from HasCallStack):<br />
error, called at src/Wallet/Emulator/Stream.hs:171:12 in
plutus-contract-1.0.0.0-68585fe6251fbab3f7ee7ae8755133e693587e4f6afa588ae8db3b056e79dcc0:Wallet.Emulator.Stream</p>
</blockquote>
<p>This is plutus-apps v.1.0.0. This code works with some other tags.</p>
<p>How do I fix this? Is this a bug?</p>

<plutus><plutus-pioneer-program><simulator><plutus-apps><emulator>
Custom currency error: Cannot build the initial state: Tag "toCardanoPolicyId"
# Custom currency error: Cannot build the initial state: Tag "toCardanoPolicyId"

(Asked by: username_0 on 2022-12-21)

I try to set an initial state of the emulator like so:
test :: IO ()
test = runEmulatorTraceIO' def emCfg myTrace
  where
    dist = Map.fromList [ (senderWallet, Ada.lovelaceValueOf 100_000_000)
                        , (receiverWallet, Ada.lovelaceValueOf 100_000_000)
                        ]
  
    emCfg :: EmulatorConfig
    emCfg = EmulatorConfig (Left dist) def

myTrace :: EmulatorTrace ()
myTrace = do
  void $ Emulator.payToWallet (senderWallet) (receiverWallet) $ Ada.lovelaceValueOf 5_000_000
  void $ Emulator.waitNSlots 1

It works perfectly. However when I set a custom currency ff with:
    dist = Map.fromList [ (senderWallet, Ada.lovelaceValueOf 100_000_000
                           <> Value.singleton "ff" "TokenName" 100_000_000)
                        , (receiverWallet, Ada.lovelaceValueOf 100_000_000)
                        ]

The script compiles but after running test I get this error:

*** Exception: Cannot build the initial state: Tag "toCardanoPolicyId" (Tag "1 bytes" DeserialisationError) CallStack (from HasCallStack):
error, called at src/Wallet/Emulator/Stream.hs:171:12 in
plutus-contract-1.0.0.0-68585fe6251fbab3f7ee7ae8755133e693587e4f6afa588ae8db3b056e79dcc0:Wallet.Emulator.Stream

This is plutus-apps v.1.0.0. This code works with some other tags.
How do I fix this? Is this a bug?

**Tags:** plutus, plutus-pioneer-program, simulator, plutus-apps, emulator

---

## 1 answers

### Answer by username_1 on 2022-12-21. Score: 3 | Accepted answer

`ff` is not a valid PolicyId (aka CurrencySymbol). It must be 28 bytes.

For examples, see this answer on this similar Github issue <https://github.com/input-output-hk/plutus-apps/issues/732#issuecomment-1265261105>

> **Comments:**
> **username_0**: Thanks. That solves it. "ff" seems to be ok with earlier version of plutus. Not anymore.  

---

