Skip to main content
added 1362 characters in body
Source Link

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:

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.

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:

deleted 2 characters in body
Source Link

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 eUTXOsUTXOs of this type of contract. If the off-chain code finds these specific type of eUTXOsUTXOs, 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.

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 eUTXOs of this type of contract. If the off-chain code finds these specific type of eUTXOs, 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.

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.

deleted 5 characters in body
Source Link

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 eUTXOs of this type of contract. If the off-chain code finds these specific type of eUTXOs, 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 also 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.

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 eUTXOs of this type of contract. If the off-chain code finds these specific type of eUTXOs, 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 also 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.

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 eUTXOs of this type of contract. If the off-chain code finds these specific type of eUTXOs, 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.

added 17 characters in body
Source Link
Loading
added 38 characters in body
Source Link
Loading
Source Link
Loading