11 votes
Accepted

What does @ prefix means?

It means type application. In this case, the function is polymorphic with the following type: logInfo :: forall a effs. Member (LogMsg a) effs => a -> Eff effs () by using TypeApplications ...
  • 477
5 votes

What are the benefits of using Plutarch?

This is covered pretty nicely in the project README. https://github.com/Plutonomicon/plutarch#why-plutarch In short, Plutus Tx attempts to replicate Haskell-like lazy semantics inside of Untyped ...
  • 96
4 votes
Accepted

Couldn't match expected type ‘BuiltinData’ in locally run playground

The local playground code is compiled to a version that is too recent for week 2. It needs to be compile to the correct commit for week 2. The change to BuiltinData only happened at week 04. Check the ...
  • 460
3 votes
Accepted

Is it possible to not compile data constructors with plutus-tx?

I think you must be using the datatype in some way if you're doing anything with this type. However, perhaps you just don't care about the Nat index. It would be nice to be able to ignore this, but ...
3 votes

What exactly is the script context in Plutus context?

Aiming to contribute to the great answer from Mitchell, I'll add this: Script context can be understood like the summary of the transaction and can be used to validate it. This includes all inputs ...
  • 1,664
3 votes
Accepted

What exactly is the script context in Plutus context?

The context includes two parts: TxInfo and ScriptPurpose. data ScriptContext = ScriptContext{ scriptContextTxInfo :: TxInfo, scriptContextPurpose :: ScriptPurpose } When people are talking ...
3 votes
Accepted

Is it possible to have an On-chain Set data structure?

Any type that works with PlutusTx.unstableMakeIsData (or its equivalent) should work, since Datum & Redeemer are wrappers for BuiltInData which is a "wrapper" for Data. EDIT: I tried the ...
  • 711
2 votes

Writing basic validator scripts

Although there may have been changes, this remains a valid question. The code shown in the question is the boilerplate code that accompanies a validator implementation for on-chain execution. A simple ...
  • 460
2 votes
Accepted

Are Validators pretending transaction already completed?

Yes, a validator is called prior to the start of the transaction as it part of the constraints that determines if the transaction can proceed. A validator that executes on-chain has no visibility of ...
  • 460
2 votes

Constraints.mustPayToPubKey requires txSignedBy?

Does the validator need to check that the transaction sees that pkh? Yes. There is more than one way to organize the logic though. Whichever way you structure the lottery, I will assume that the ...
2 votes

(Lecture #6 It #2 - Core.Hs) : Explaining lookups use of both typedValidatorLookups and otherScript?

This one is a bit technical it has to do with looking up and updating the constraints of an already existing transaction (that belongs to the script address). See Case ii) to skip my synopsis. Just a ...
  • 488
2 votes
Accepted

How does `submitTxConstraintsWith` make usage of the ScriptLookups?

The family of submitTx functions all create transactions from the constraints submitted in the arguments. The most general implementation of the function is submitTxConstraintsWith :: ScriptLookups ...
  • 460
2 votes

How to calculate fees for Plutus Smart Contract?

You can now use fee estimator at https://testnets.cardano.org/en/testnets/cardano/tools/plutus-fee-estimator/
2 votes
Accepted

Confusion regarding findOwnInput function with on-chain code

Calling findOwnInput in a validator returns the value contained in the Script-UTxO that is currently being validated. In your example above it is the one with 2 Ada in it. Your example above is, ...
  • 1,356
2 votes
Accepted

Understand purpose of tx-out-datum-hash in Lars' lobster NFT minting example

That value is the hash value of an empty list. You can calculate it in the repl as follows: import Ledger qualified import PlutusTx qualified emptyListDatum = Ledger.Datum $ PlutusTx.toBuiltinData ([]...
  • 1,264
2 votes

String in Datum

Not really sure what you mean by "end user to see the datum in the script" and how having a Text or String in the datum would make any difference to this. Datums are not easily visible to ...
2 votes

How to get a base 16 hex BuiltinString from getTxId

I was able to resolve this issue by converting (encoding) the BuiltinByteString from getTxId into a hex format. From there I was able to inpsect the hex digits. Below is an onchain encodeHex ...
  • 221
1 vote
Accepted

cardano-serialization-lib ExUnits

These two are the maximum computation resources you're declaring your contract needs. I believe the easiest way to get the "right" value, is to interact with your contract on testnet in ...
  • 66
1 vote

How expressive & secure is the Plutarch eDSL?

I'm approaching the tool so I would not consider myself a Plutarch expert however to my understanding, Plutarch is designed to be compatible with the entire PlutusTx API since the real code of smart ...
  • 619
1 vote

can't understand which part of the code is not "PlutusTx"

The name wrappedMintingPolicy in the where statement is not indicated with the INLINABLE pragma. Maybe adding the line {-# INLINEABLE wrappedMintingPolicy #-} solves the problem.
  • 56
1 vote

Difference between `PlutusTx.TH.compile` and `PlutusTx.compile`?

Hi man Lars answered this in the 7th Q&A video of the Plutus pioneers program cohort 3. If you don't want to watch the video the long and short of it is that the PlutusTx.TH.compile module is just ...
1 vote

How do I run doctests?

To run doctest, you don't need to add that to your cabal file. You need to install the doctest executable, and then run cabal repl --with-ghc=doctest. See the doctest documentation.
  • 359
1 vote

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

There are multiple ways to do that. Option 1: If you have "script-wide" constants, like your mentioned example of an auction house fee, I suggest parameterizing your contract like it is done ...
1 vote

Canonical example of Smart Contract Verification?

I tried to start a conversation about this here, remains to be seen whether I'll be successful in generating dialogue. But outside of Cardano internals like Ouroboros or the plutus metatheory, the ...
1 vote

Is there any eth_sign equivalent signing method in plutus?

You can find functions for message signing and signature checking in packacke plutus-ledger, module Ledger.Oracle. Also, why whould you need a smart contract for this?
1 vote

plutus pioneer week01 src code explain

This is part of Template Haskell. It is the way to have Haskell compiled at runtime basically. This link may help https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/template-haskell.html $$...
1 vote

How do I build a debug configuration of a Plutus project?

mkPolicy is an on-chain validator code, is lifted to template Haskell and it gets compiled to core plutus and executed when the UTXO locked by that script is spent. AFAIK, core-plutus is not Haskell, ...

Only top scored, non community-wiki answers of a minimum length are eligible