<p>Following suggestion from <a href="https://github.com/input-output-hk/plutus/issues/4282#issuecomment-992130598" rel="nofollow noreferrer">here</a>, I got it working by doing following modification: <a href="https://i.sstatic.net/UUwZ0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UUwZ0.png" alt="TxOutRef Construction" /></a></p>
<p>As <code>TxId</code> has an instance for <code>IsString</code> derived via <code>LegerBytes</code>. In particular, <a href="https://cardano.stackexchange.com/a/4904/7049">this</a> answer is also helpful.</p>

CC BY-SA 4.0
2022-11-06T06:02:43.020Z
2022-11-06T06:38:22.960Z
2022-11-06T06:38:22.960Z
Sourabh
<p>I am building an NFT minting policy which takes an argument of type <code>TxOutRef</code> as parameter. To this when I pass my parameter, it doesn't match with what is actually given in the transaction. Here is my policy: <a href="https://i.sstatic.net/s4zcJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/s4zcJ.png" alt="My policy code" /></a></p>
<p>Suppose my <code>tx-in</code> (in context of <code>cardano-cli</code>) is <code>bccdfb39bcf97b9bc499ef19c02f33c64df1d7e68cfcff7f65a737c9c6ce4224#0</code>. Then this is how I am passing it to compiler: <a href="https://i.sstatic.net/JT0r2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JT0r2.png" alt="passing TxOutRef" /></a></p>
<p>I tried comparing what I passed with what is actually received in my <code>mkPolicy</code> but surprisingly, if I remove out <code>firstInput</code>, it is able to print my error message, else with <code>firstInput</code> being present, I get the following in my console: <a href="https://i.sstatic.net/4IyGc.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4IyGc.jpg" alt="error by firstInput" /></a></p>

<nft><policy><mint><mintingpolicy>
How to construct `TxOutRef`?
# How to construct `TxOutRef`?

(Asked by: username_0 on 2022-11-06)

I am building an NFT minting policy which takes an argument of type `TxOutRef` as parameter. To this when I pass my parameter, it doesn't match with what is actually given in the transaction. Here is my policy: [![My policy code](https://i.sstatic.net/s4zcJ.png)](https://i.sstatic.net/s4zcJ.png)

Suppose my `tx-in` (in context of `cardano-cli`) is `bccdfb39bcf97b9bc499ef19c02f33c64df1d7e68cfcff7f65a737c9c6ce4224#0`. Then this is how I am passing it to compiler: [![passing TxOutRef](https://i.sstatic.net/JT0r2.png)](https://i.sstatic.net/JT0r2.png)

I tried comparing what I passed with what is actually received in my `mkPolicy` but surprisingly, if I remove out `firstInput`, it is able to print my error message, else with `firstInput` being present, I get the following in my console: [![error by firstInput](https://i.sstatic.net/4IyGc.jpg)](https://i.sstatic.net/4IyGc.jpg)

**Tags:** nft, policy, mint, mintingpolicy

---

## 1 answers

### Answer by username_0 on 2022-11-06. Score: 0 | Accepted answer

Following suggestion from [here](https://github.com/input-output-hk/plutus/issues/4282#issuecomment-992130598), I got it working by doing following modification: [![TxOutRef Construction](https://i.sstatic.net/UUwZ0.png)](https://i.sstatic.net/UUwZ0.png)

As `TxId` has an instance for `IsString` derived via `LegerBytes`. In particular, [this](https://cardano.stackexchange.com/a/4904/7049) answer is also helpful.


---

