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?

1 Answer 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.


You can learn more about datums and redeemers in the Cardano docs: Working with datums and redeemers.

Other interesting Cardano SE questions:

  • 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
    Jan 25, 2022 at 16:51
  • I've updated my answer, trying to explain more about scripts and redeemers. Jan 25, 2022 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.