Questions tagged [datum]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
23 views

Unable to convert BuiltinString to JSON

I would like to include a BuiltinString in a datum but am unable to do so as BuiltinString has neither a FromJSON nor a ToJSON instance. Is there an alternative to implementing these instances by hand?...
  • 55
0 votes
1 answer
28 views

What are the differences between different kinds of datums (datum, datumhash, inlineDatum, inlineDatumHash)?

I sent some ADA to a smart contract address with the non inline datum of "1234" and when i queried the utxo with cardano-cli, I got this result. "...
0 votes
1 answer
24 views

Understanding Script Failure Error Relating to Order TxIds - (script hash not known)

trying to claim back the first player bet after deadline in the ZeroOneGame from ppbl gimbalabs course on pre-production_testnet I get an error when trying to build the claim transaction. I have this ...
0 votes
1 answer
34 views

PlutusV2: Error when spending script output

This is how I spend script's utxos with the Emulator. This one from this example. grab :: forall w s e. AsContractError e => Contract w s e () grab = do utxos <- utxosAt scrAddress ...
  • 323
1 vote
1 answer
72 views

How do you interact with smartcontract on jpg.store

Does anyone know how you interact with smart contract on jpg. store Do we need this? https://github.com/jpg-store/current-jpg-store-contracts if so how do we do so?
3 votes
1 answer
70 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
0 votes
2 answers
49 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. ...
  • 76
1 vote
0 answers
24 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 ...
0 votes
1 answer
97 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....
  • 121
1 vote
3 answers
210 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
222 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,088
0 votes
1 answer
51 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
0 answers
22 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
18 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
33 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 ...
3 votes
2 answers
197 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 ...
0 votes
2 answers
74 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 ...
1 vote
2 answers
57 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 ...
0 votes
1 answer
61 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,284
3 votes
2 answers
311 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 ...
  • 91
1 vote
1 answer
179 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 ...
1 vote
1 answer
66 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
0 answers
19 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
88 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 ...
  • 472
1 vote
1 answer
84 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
2 votes
1 answer
125 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 ...
  • 1,088
9 votes
2 answers
175 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
1 vote
1 answer
81 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,284
7 votes
2 answers
172 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
0 votes
2 answers
45 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
1 vote
1 answer
65 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
3 answers
213 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 ...
1 vote
1 answer
203 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
0 votes
1 answer
83 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
8 votes
2 answers
364 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
5 votes
1 answer
542 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
182 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. ...
1 vote
1 answer
212 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 ...
5 votes
2 answers
170 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 ...
3 votes
1 answer
142 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
293 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-...
4 votes
2 answers
303 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 ...
1 vote
1 answer
342 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 ...