Questions tagged [datum]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
9 votes
2 answers
162 views

What is where executed and when?

To wrap my around what happens when I where, I tried to visualize it. In order to be able to show the interaction between two different systems generating transactions, I have a Generator A and ...
  • 172
8 votes
2 answers
300 views

Is there complete cardano-cli documentation?

Hello all I can find is the cardano-cli help and https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/cardano-node-cli-reference.md/ I am trying to get information on things like ...
  • 263
7 votes
2 answers
152 views

Plutus pattern/technique for finding original datum preimage of TxOutDatumHash?

Every UTXO at a script address must have a TxOutDatumHash (or will be unspendable). To spend the UTXO at the validator you provide a datum and a redeemer, the script must validate with your redeemer, ...
  • 83
5 votes
2 answers
152 views

How can I enforce a datum type to be correct?

Most types in Plutus are simply wrappers around BuiltinByteString. For instance the bytes in PubKeyHash are not serialized/deserialized to an actual pubkey hash and checked for correctness. So ...
5 votes
1 answer
370 views

How do I read the datum of an output?

How do I get the datum of an output from cardano-graphql (or another service)? I have attached it using the --tx-out-datum-embed-file flag already when building the tx using cardano-cli. Thanks!
5 votes
1 answer
166 views

Where is the Datum stored in PAB?

In utxo we store only the hash of the datum, so whenever you work with the Cardano cli to run a transaction - you should provide datum or its hash via tx-out-datum-embed-file, tx-in-datum-file, etc. ...
4 votes
2 answers
216 views

How to retrieve the datum added with the option –tx-out-datum-embed-file from the tx witness data

I have been thinking recently about the way we are predominately creating NFTs on Cardano, right now the trend is to add the NFT attributes to the transaction metadata, however, I think this is not ...
3 votes
1 answer
59 views

Is function "isPayToScriptOut" unsafe?

As far as i understood, function "isPayToScriptOut" assumes every output that has a datum hash is a script output. But what if we create new output with datum, assigned to some pub key (for ...
  • 35
3 votes
1 answer
101 views

How can I secure a Datum value in a smart contract?

I am trying to figure out how to write a script where you can make sure the datum value doesn't change each time an output gets consumed. For example, in the auction script in the pioneer program each ...
  • 263
2 votes
2 answers
150 views

Plutus datum and redeemer on cardano-cli

I'm trying to deploy a smart contract on cardano-cli after its implementation on plutus playground. Imagine that I have: data TradeDatum = StartBid | Bid TradeDetails | Offer TradeDetails ...
  • 81
2 votes
1 answer
96 views

How to create Datum with ownPaymentPubKeyHash?

I have defined two endpoints. One for creating a UTxO at the script address with a Datum that contains the wallet's own PaymentPubKeyHash. And a second endpoint that spends such UTxOs from the script ...
2 votes
2 answers
135 views

PlutusData construction using @emurgo cardano-serialization-lib-browser

I have a JSON format needed for PlutusData serialization (but the format is not a standard datum in a list). The datum is wrapped in Maybe monad, so you'll note the nested lists (an array inside the ...
2 votes
2 answers
239 views

How does custom Plutus data type map to cardano-cli --tx-in-datum-file content?

Let's say I have validator, which checks datum against two numbers, hash, time and a string and there are some funds locked at this script address and I would like to unlock these funds using cardano-...
1 vote
3 answers
128 views

Get Value of Datum from a UTXO

I currently have a utxo that i am getting like this. initalMatchPool <- Map.filter (findInitalAmount fundAddress) <$> utxosAt scrAddress How do i get the value of the datum attached to this ...
1 vote
2 answers
42 views

What is the mkValidator Script

In Plutus scripts there is a mkValidator where it takes in the datum , redeemer , and script context. In the plutus-pionner-program , the plutus scripts they show us uses these three parameters to ...
1 vote
1 answer
151 views

Ensuring NFT collection uniqueness using counter as asset name?

I would like to be able to mint a collection of NFTs across different transactions that fall under the same policy id. A method I would like to try is making a 'dummy' nft that holds a counter as its ...
1 vote
1 answer
271 views

How to specify the new output datum value (not hash) using the CLI

I have written a script that basically keeps a counter and every time it is spent increases said counter, the way it guarantees that the counter was increased is by checking the current datum of the ...
1 vote
2 answers
114 views

How to provide Datum value using serialization lib

I am consuming a script output and also create a new one at the same script address. The validator script requires the output producer to provide the datum value due to making assertions on it. ...
1 vote
1 answer
45 views

Missing datums in db-sync

From time to time I encounter transactions which contain UTXOs associated to script addresses with datum hashes for which no corresponding entries are available in the datum table of a fully-synched ...
  • 113
1 vote
1 answer
70 views

How does Constraints.mustHashDatum work?

I'm trying to understand how Constraints.mustHashDatum works but I'm not able to figure out the purpose of this Constraint. Any help would be great.
  • 1,264
1 vote
1 answer
63 views

How does the final transaction in the auction example know who did the bid?

In the second transaction of the auction example, these are the output EUTxO's. In the final transaction, only wallet 1 and the script are inputs. How does the script know that wallet 3 has done the ...
  • 172
1 vote
1 answer
161 views

How to add datum to UTXO in nami

Datum is hashed and assigned to an UTXO When you send the transaction you can add optional parameters like metadata and/or datum datum is used by smart contract since it's the only data that smart ...
  • 11
1 vote
0 answers
13 views

How to Send A Token to an Smart Contract Alongside a Datum?

I asked another question (How to Make Sure A Contract Is Signed By a Certain Party?) and got the answer I expected. It raised the secondary Question of how to send a token with a datum to a smart ...
1 vote
0 answers
17 views

what info is in datum value and how can we extract it

In the case for spend purposes e.g. Value: {"fields": [{"bytes": "10dc9481577ae0ac7a2b828bae9f2ba163b79ce73069d75fd609bc88"}, {"bytes": "a20a"}], &...
  • 433
1 vote
1 answer
69 views

Documentation for filtering through the inputs of a Plutus Script

I Have 1000 utxo's sitting at a script address with unique datums is there documentation for a validator so that when collectFromScript is called it only pulls 1 utxo based on the user input matching ...
  • 470
1 vote
1 answer
58 views

What is the correct way to compare DatumHash?

What is the correct way to compare DatumHash? I imported the Eq function from PlutusTx import PlutusTx.Prelude (Eq((==))) ... checkDatumHash :: TxOut -> Bool checkDatumHash txOut = ...
  • 21
0 votes
1 answer
39 views

A Script With Multiple Different Datum Types

I have 4 different Datum Data Types in my script because for 4 different use cases in my script. data FundCreationDatum = FundCreationDatum { vFundOwner :: PaymentPubKeyHash, vPrizeAmount :: ...
0 votes
1 answer
45 views

Is it possible to send funds to a scriptAddress using a lightweight wallet?

I would like that an user using Yoroi/Nami/etc could send funds to a script address which expected an empty datum: (). EDIT (Pretty obvious, but the UTxO should be spendable later by a transaction) I ...
  • 1,264
0 votes
2 answers
44 views

Is Redeemer similar to <ScriptSig> in bitcoin context?

In the (e)UTxO model, discussed in the 1st lecture of PPP#3, I am trying to understand the differences between the UTxO model of Bitcoin and the (e)UTxO model of Cardano. From what I understand, the &...
  • 100
0 votes
2 answers
38 views

Providing a list of mappings from datum hashes to values while creating a transaction

I noticed that TxInfo datatype has a txInfoData field which carries a list of mappings from datum hashes to datum values. This seems very useful for validating transactions with multiple input UTxO's. ...
  • 66
0 votes
1 answer
69 views

Attaching Datum Value with CSL 10.x

I generate my datum like so: // Build datum const sellerAddressPKH = changeAddressValue.slice(2,58); const datumFields = CSL.PlutusList.new(); datumFields.add(CSL.PlutusData.new_integer(CSL.BigInt....
  • 111
0 votes
1 answer
20 views

Different Data tyoes for datum

I have two main actions that user can do. They both require sending utxos to a script address. The datum I want produced by these two actions are different. I want one of the datum like this data ...
0 votes
2 answers
53 views

Using custom datum for `mustPayToOtherScript` in off-chain code

Lets say I on-chain i have a Datum like so: data RandomDatum = RandomDatum { { tn :: !TokenName , cs :: !CurrencySymbol , nn :: !Integer } deriving (Show) Off chain I'm trying to form and ...
0 votes
1 answer
69 views

What is the role of datum in spending a transaction

So i am going over the plutus-pionner-program right now and he keeps on iterating this point. Transaction that spends a script output need to provide the datum of that script. Transaction that send ...
0 votes
3 answers
163 views

How to pass TxOutDatumNone when building a script transaction with cardano-cli

I'm trying to consume a UTxO from a script address. When querying the script address with cardano-cli query utxo, I have the following UTxO: TxHash ...
0 votes
0 answers
15 views

Parsing Values in a Nested Datum Type

I am filtering through transactions like this.Datum is represented as d in the below function. utxos <- Map.filter (isSuitable (cpFund cp)) <$> utxosAt scrAddress isSuitable :: Integer -> ...
0 votes
0 answers
17 views

Applying filter function on a datum with two different data types

I am filtering through transactions like this. utxos <- Map.filter (isSuitable (cpFund cp)) <$> utxosAt scrAddress isSuitable :: Integer -> ChainIndexTxOut -> Bool isSuitable fundRound ...
0 votes
1 answer
54 views

Embedding address into the datum using the CLI

I have a validator that uses Address in datum. I also have an address generated (payment.vkey, payment.skey, payment.addr, stake.vkey, stake.skey, stake.addr). I'm able to get PubKeyHash using command ...
  • 31