<h2>Finding transactions</h2>
<p>Bob (the person) doesn't have to necessarily know that there's an auction going in the blockchain, but he can launch a transaction and look for UTXOs of this type of contract. If the off-chain code finds these specific type of UTXOs, then he can fetch the datum associated to it, and therefore he can place a bid.</p>
<p>If you look in the <code>EnglishAuction.hs</code> file, line 334:</p>
<pre><code>findAuction :: CurrencySymbol
            -&gt; TokenName
            -&gt; Contract w s Text (TxOutRef, ChainIndexTxOut, AuctionDatum)
findAuction cs tn = do
    utxos &lt;- utxosAt $ scriptHashAddress auctionHash
    ...
</code></pre>
<p>This is the function responsible for this. This happens when bidding (line 277):</p>
<pre><code>(oref, o, d@AuctionDatum{..}) &lt;- findAuction bpCurrency bpToken
...
</code></pre>
<p>...or closing the auction (line 309), or with any other endpoint the contract opens to the public.</p>
<h2>UTxOs, scripts and redeemers</h2>
<ul>
<li>Scripts are not &quot;giving&quot; different types of UTxOs, rather, scripts
are attached, linked to UTxOs.</li>
<li>UTxOs contain the hash of the
datum attached to them.</li>
<li>They are not stored in any database, the
blockchain is the &quot;database&quot; itself for these UTxOs, scripts, etc...</li>
</ul>
<p>The Cardano node in charge of processing the transaction or the script will reach the UTxOs via the script address, or vice-versa, if needed, and then validate according to its logic, evaluate the script, and create new resulting UTxOs.</p>
<p>On the other hand, the script will know about the redeemer because the person who sends a transaction to the blockchain for this concrete script will attach it. <strong>The redeemer is the data the user provides to the smart contract</strong>.</p>
<h2>References</h2>
<p>You can learn more about datums and redeemers in the Cardano docs: <a href="https://docs.cardano.org/plutus/datums-redeemers" rel="nofollow noreferrer">Working with datums and redeemers</a>.</p>
<p>Other interesting Cardano SE questions:</p>
<ul>
<li><a href="https://cardano.stackexchange.com/questions/471/what-exactly-is-a-redeemer">What exactly is a Redeemer?</a></li>
<li><a href="https://cardano.stackexchange.com/questions/2537/what-does-it-mean-that-a-utxo-sits-at-script-address">What does it mean that a UTxO sits at script address?</a></li>
</ul>

CC BY-SA 4.0
2022-01-25T16:51:38.897Z
Thanks for your answer! This generates more questions though... I understand different scripts give different types of UTXOs and have different script hashes. Are all the scripts public? This is the only way I can see for identifying specific types of UTXOs. When you say "fetch" you mean there is a database somewhere where the datum for each type of UTXO is stored? Also, say we are looking at a different example, not the Auction, how do I know the redeemer? Is it a completely off-chain process?
user44722
CC BY-SA 4.0
2022-01-25T19:24:32.940Z
I've updated my answer, trying to explain more about scripts and redeemers.
joaquimgamero
CC BY-SA 4.0
2022-01-24T18:49:09.257Z
2022-01-25T19:22:33.717Z
2022-01-25T19:22:33.717Z
joaquimgamero
<p>When Bob places a bid...</p>
<ul>
<li><p>He places a transaction/bid that takes in his UTXO (for which he has the private key as he is the owner) and the UTXO sitting at the script address.,</p>
</li>
<li><p>It outputs a new UTXO to a script address and potentially other UTXOs to individual.</p>
</li>
</ul>
<p>To do that Bob needs to provide the redeemer and the actual datum associated with the script.</p>
<p>Where does he get that information from?</p>

<redeemer>
Auction example: How does Bob know the redeemer of the UTXO sitting at the script address?
# Auction example: How does Bob know the redeemer of the UTXO sitting at the script address?

(Asked by: username_0 on 2022-01-24)

When Bob places a bid...

* He places a transaction/bid that takes in his UTXO (for which he has the private key as he is the owner) and the UTXO sitting at the script address.,
* It outputs a new UTXO to a script address and potentially other UTXOs to individual.

To do that Bob needs to provide the redeemer and the actual datum associated with the script.

Where does he get that information from?

**Tags:** redeemer

---

## 1 answers

### Answer by username_1 on 2022-01-24. Score: 1

Finding transactions
Bob (the person) doesn't have to necessarily know that there's an auction going in the blockchain, but he can launch a transaction and look for UTXOs of this type of contract. If the off-chain code finds these specific type of UTXOs, then he can fetch the datum associated to it, and therefore he can place a bid.
If you look in the EnglishAuction.hs file, line 334:
findAuction :: CurrencySymbol
            -> TokenName
            -> Contract w s Text (TxOutRef, ChainIndexTxOut, AuctionDatum)
findAuction cs tn = do
    utxos <- utxosAt $ scriptHashAddress auctionHash
    ...

This is the function responsible for this. This happens when bidding (line 277):
(oref, o, d@AuctionDatum{..}) <- findAuction bpCurrency bpToken
...

...or closing the auction (line 309), or with any other endpoint the contract opens to the public.
UTxOs, scripts and redeemers

Scripts are not "giving" different types of UTxOs, rather, scripts
are attached, linked to UTxOs.
UTxOs contain the hash of the
datum attached to them.
They are not stored in any database, the
blockchain is the "database" itself for these UTxOs, scripts, etc...

The Cardano node in charge of processing the transaction or the script will reach the UTxOs via the script address, or vice-versa, if needed, and then validate according to its logic, evaluate the script, and create new resulting UTxOs.
On the other hand, the script will know about the redeemer because the person who sends a transaction to the blockchain for this concrete script will attach it. The redeemer is the data the user provides to the smart contract.
References
You can learn more about datums and redeemers in the Cardano docs: Working with datums and redeemers.
Other interesting Cardano SE questions:

What exactly is a Redeemer?
What does it mean that a UTxO sits at script address?

> **Comments:**
> **username_0**: Thanks for your answer! This generates more questions though... I understand different scripts give different types of UTXOs and have different script hashes. Are all the scripts public? This is the only way I can see for identifying specific types of UTXOs. When you say "fetch" you mean there is a database somewhere where the datum for each type of UTXO is stored? Also, say we are looking at a different example, not the Auction, how do I know the redeemer? Is it a completely off-chain process?  
> **username_1**: I've updated my answer, trying to explain more about scripts and redeemers.  

---

