user2255: I want to use an NFT as a form of authentication for a Plutus contract.
I know I can attach the NFT in the Datum when constructing the transaction and return the NFT in the output however I am worried this will "lock" the NFT such that the user can only submit a single transaction.
My use case is an invite mechanism that only holders of a specific NFT are able to execute, this endpoint will generate a UTXO that is used as a required input into the actual signup endpoint.

So based on this example, can the invite endpoint read the presence of the AM NFT in the redeemers wallet without it being sent into the transaction?

Note I am new to a lot of this so feel free to tell me I have got this wrong.


user1130: I'd check out using mustSpendPubKeyOutput in your off-chain transaction constraints.
To answer your question directly:

Can a smart contract read the presence of an NFT in the redeemers wallet?

No. A validator script will only validate what's included in a transaction.
But you can include your NFT in the transaction without "lock"ing it. You will want to spend it in the redeeming transaction and return it to the redeemers wallet.
For the transaction to succeed, the validator will  check the UTxOs included in the ScriptContext and if the NFT is included among the values, it will say "yes". The off-chain code could be designed in whatever way that includes the NFT in the transaction, but it sounds like you want to ensure it is returned to the transaction builder's wallet (I'm pretty sure that will be the default behavior if you don't specify a recipient of any UTxOs, but of course check that with tests, etc).

2255: <p>I want to use an NFT as a form of authentication for a Plutus contract.</p>
<p>I know I can attach the NFT in the Datum when constructing the transaction and return the NFT in the output however I am worried this will &quot;lock&quot; the NFT such that the user can only submit a single transaction.</p>
<p>My use case is an invite mechanism that only holders of a specific NFT are able to execute, this endpoint will generate a UTXO that is used as a required input into the actual signup endpoint.</p>
<p><a href="https://i.stack.imgur.com/tRHvk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tRHvk.png" alt="enter image description here" /></a></p>
<p>So based on this example, can the invite endpoint read the presence of the AM NFT in the redeemers wallet without it being sent into the transaction?</p>
<ul>
<li>Note I am new to a lot of this so feel free to tell me I have got this wrong.</li>
</ul>
 1130: <p>I'd check out using <a href="https://alpha.marlowe.iohkdev.io/doc/haddock/plutus-ledger/html/Ledger-Constraints.html#v:MustSpendPubKeyOutput" rel="nofollow noreferrer"><code>mustSpendPubKeyOutput</code></a> in your off-chain transaction constraints.</p>
<p>To answer your question directly:</p>
<blockquote>
<p>Can a smart contract read the presence of an NFT in the redeemers wallet?</p>
</blockquote>
<p>No. A validator script will only validate what's included in a transaction.</p>
<p>But you can include your NFT in the transaction without &quot;lock&quot;ing it. You will want to spend it in the redeeming transaction and return it to the redeemers wallet.</p>
<p>For the transaction to succeed, the validator will  check the UTxOs included in the <code>ScriptContext</code> and if the NFT is included among the values, it will say &quot;yes&quot;. The off-chain code could be designed in whatever way that includes the NFT in the transaction, but it sounds like you want to ensure it is returned to the transaction builder's wallet (I'm pretty sure that will be the default behavior if you don't specify a recipient of any UTxOs, but of course check that with tests, etc).</p>
