Questions tagged [plutus]

A programming language based on Haskell used to write smart contracts on the Cardano blockchain.

Filter by
Sorted by
Tagged with
1 vote
2 answers
72 views

How do I parse multiple values stored in datum in Plutus

So I am storing multiple values in my datum but I don't know how to read them in Plutus code. Also I am very new to Haskell so explain it in a simple way please. 😅
0 votes
0 answers
22 views

Limit the number for each Token (AssetName) within one Currency Symbol (Policy ID)

is there any way to limit number for each tokens within one minting policy, in Plutus validator? For example for policy ab12 I want to allow users minting tokens, in different transactions. Сan the ...
3 votes
2 answers
189 views

How to return funds from a smart contract

If I have assets (can be just ADA for simplicity) locked in a contract, how can I release the funds to the previous owners most efficiently? Some more context regarding the question. I created a pay ...
0 votes
1 answer
40 views

E042:Error: Unsupported feature: Type constructor: GHC.Prim.Addr

Has anyone encountered such an issue? Validator works fine and cborHex is generated when "writeSerialisedScript" run in cabal's repl. But when building with cabal build app, the following ...
0 votes
1 answer
86 views

How to separate continuing outputs to compare datums

In the auction code of the Plutus pioneer program during week 1, the code approves a bid by comparing the datum with previous ones in the Plutus on-chain code. How could you repurpose this so that you ...
1 vote
1 answer
68 views

User error: Caused by: [ (builtin unConstrData) (con data #187b) ] while trying to unlock tokens from contract

hi I am getting this error while trying to unlock tokens from my treasury contract it is already topp up with tokens when trying to unlock with the access token doesn't know the exact reason behind ...
0 votes
1 answer
25 views

plutus-apps nix-shell on Mac M2 segmentation fault

I'm unable to run nix-shell on my new M2 Macbook. I read through the posts from last year on setting up M1 Macbooks with previous plutus-apps tags, but the same steps do not seem to work. Environment: ...
2 votes
2 answers
295 views

What is the recommended way of implementing an NFT sale?

I'm pretty new to crypto development (I've been a professional software engineer for 5+ years now) and would like to get into NFT development using Cardano. Currently, I'd like to start a collab with ...
0 votes
1 answer
19 views

How can I access Haddock documentation for Plutus?

The link to the Plutus documentation - https://playground.plutus.iohkdev.io/doc/haddock/ - is broken. Is there another way to browse the haddock documentation for the latest version of Plutus?
2 votes
1 answer
125 views

InlineDatum on ReferenceOutput in OffChain code

I tried to use the inline datum of a reference input in the minting policy below: {-# INLINABLE validateMinting2 #-} validateMinting2 :: TxOutRef -> BuiltinData -> BuiltinData -> () ...
0 votes
1 answer
61 views

OffChain code for inline datum

I am trying to create a OffChain code for submitting inline datums. gTest :: forall w s. GrabParams -> PlutusContract.Contract w s DataText.Text () gTest GrabParams{..} = do PlutusContract....
1 vote
0 answers
8 views

setup a Plutus project use haskell.nix Error on Mac M1

I'm trying to set up a Plutus project with flake on my Macbook by IOHK document I did the following steps: create default.nix enter command nix flake init --template templates#haskell-nix --impure ...
9 votes
3 answers
202 views

How to properly start a new Plutus project, from scratch

I'm from ETH's ecosystem and recently just decided to get into Cardano development, specifically Plutus dev work thanks to Demeter.Run, and after going through the Plutus starters on there, I noticed ...
0 votes
2 answers
51 views

What's the difference between these two TxOut?

Applying the functions (1) findOwnInput and (2) getContinuingOutputs in a context both return TxOut. What is the difference between these two TxOut?
0 votes
2 answers
29 views

"The second data argument, does not decode to a context" when minting NFT with Mesh

This my script for minting NFT: {-# INLINABLE mkPolicy #-} mkPolicy :: BuiltinData -> PlutusV2.ScriptContext -> Bool mkPolicy _ ctx = traceIfFalse "wrong amount minted" checkNFTAmount ...
0 votes
2 answers
59 views

Error on "cabal build" - Week01 - warning is in EnglishAuction.hs

My cabal build ended in a warning - yet not sure if this needs to be resolved or if build completed ? Seems like build aborted over a warning ? Below is the warning that seems to have aborted the ...
0 votes
2 answers
57 views

How to generate CBOR hex of plutus smart contract

How can i generate the CBOR hex of a plutus smart contract. Does it requires to generate CBOR of onchain code only or both onchain and offchain? Also if have a smart contract which requires parameters ...
0 votes
1 answer
18 views

How can an endpoint receive multiple argument?

How can add multiple arguments on a certain endpoint? How can I add more arguments to “start” function? Like “start x y” or “start x y z”? {-# LANGUAGE ImportQualifiedPost #-} {-# LANGUAGE DataKinds ...
0 votes
1 answer
22 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?...
1 vote
3 answers
94 views

How to convert Address type variable to get "addr_testXXX" format address?

In plutus endpoint, I want to convert Address type value to get addr_testXXX format address. I have try : import Cardano.Api ( SerialiseAddress (deserialiseAddress, serialiseAddress) ) ... -- here, ...
0 votes
1 answer
47 views

How to resolve this "(FromAlonzoUtxoFail (UtxosFailure (ValidationTagMismatch (IsValid True)" transaction submission error on mesh library

I am getting this error on transaction submission. ""transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (...
1 vote
0 answers
11 views

Comparing VALUES in a smart contract. How to know if they will be normalized or not?

I need to make VALUES comparisons on chain. I realized that if a use the (==) operator from Plutus it is very inefficient in matter of memory and cpu steps needed to compute. (https://github.com/input-...
1 vote
3 answers
73 views

How to allow non deterministic spent output

I would like a validator (or a minting policy) to succeed always but only to spend the output if some conditions are met; an example use case of such behaviour is to allow burning token (kind of a &...
1 vote
3 answers
99 views

Ambiguous type variable ‘e0’ arising from a use of ‘endpoints’

I'm writing emulator trace tests for the spacebudz contracts. Here is a minimum example: {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ...
1 vote
1 answer
83 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 = ...
0 votes
1 answer
95 views

On the off-chain code of homework 3 cohort 3

I was solving homework1.hs of week 3 of the third cohort and I think there is something wrong with the off-chain code of the solution given the validator. Namely the following, the off-chain part does ...
0 votes
1 answer
82 views

PublicKeyOutputs at Script Address vs ScriptOutputsAt Validator Hash vs valueLockedBy

Is the line scriptOutputsAt ownHash equivalent to pubKeyOutputsAt scrptAddress? More importantly, is (valueLockedBy (scriptContextInfoTx ctx) ownHash) just the sum of the outputs at the script address?...
0 votes
1 answer
26 views

Plutus Playground - mustPayToTheScript - unexpected char escapes - 0 converted to \NUL, 1 to \SOH

I am having trouble with the mustPayToTheScript function - I am getting this error Contract instance stopped with error: "WalletError (InsufficientFunds \"Total: Value (Map [(,Map [(\\\"...
4 votes
1 answer
162 views

Script unlock cannot submit, budget overspent

I'm trying to unlock some token at a script address, so I create a tx with cardano-cli transaction build ... this passes successfully, then I sign the tx. It is now ready for submit but when I submit ...
0 votes
1 answer
167 views

What is the correct way to compare two instances of Value data type?

Question What is the correct way to compare two instances of Value data type? Context I would like to check if outgoing transaction identified by PubKeyHash has the same Value as Value which was ...
1 vote
1 answer
60 views

cardano-cli not showing utxo but Testnet Blockchain Explorer does

I have requested funds via Faucet, twice in fact because the first one I thought the request didn't go through but when I run: cardano-cli query utxo --address $(cat 01.addr) --testnet-magic ...
3 votes
2 answers
268 views

Will Cardano ever have anything more than validators on-chain?

I have been looking into creating a blackjack game on the Cardano Blockchain. I started with learning Haskell, and writing a simple blackjack CLI game. It was heaps of fun and a bit of a learning ...
0 votes
2 answers
44 views

Unable to deploy Plutus NFT Minting Policy parametrized by TxOutRef using cardano-cli

UPDATE: I'm making progress. It is apparent the TxOutRef stored on-chain has some extra-structure. For evidence I "printed" the TxOutRef's of the 'utxo' hard-wired in my minting policy and ...
0 votes
1 answer
38 views

ConnectionError: There was a problem with the response body: Unexpected token T in JSON at position 0

I am having an issue with compiling any contracts on the local playground. It doesn't matter even when trying to compile the example contracts that are provided I keep getting this error. I have no ...
0 votes
1 answer
58 views

Whether validation checks are necessary

In Plutonomicon github repo it says by the end of the page: For example, you don't need to prevent an unexpected transaction from locking value away - that's the submitter's own problem - but you do ...
1 vote
2 answers
79 views

Does Plutus support floating-point arithmetic for on-chain code?

Plutus provides arithmetic functions for Integers through the modules PlutusTx.Prelude and PlutusTx.Builtins. Are there floating-point arithmetic functions which can be used on chain? If not, why is ...
1 vote
1 answer
60 views

Overuse of resources when comparing for equality of VALUES (==)

I found an strange consumption of mem and CPU when comparting VALUES on-chain. If I do the same comparison with my own writing functions I found is more efficient. How could it be? Everything is ...
0 votes
1 answer
40 views

Need to Retrieve Info from (NFT)Assets in Policy ID to see if they are in a Plutus Contract (smart contract) or Not using Blockfrost API

I have a python script that retrieves the NFT asset name, and addresses of a specific policy ID using blockfrost API. Now I need to amend the script to add to the csv whether or not the specific asset ...
0 votes
2 answers
120 views

Right way to get the Wallet ID when creating?

Having trouble with with the plutus-starter template. The following return null after starting the pab: export WALLET_ID_1=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet....
0 votes
1 answer
16 views

Converting a sum type to BuiltinByteString

I have a type defined as follows: data A = A1 | B2 | A3 deriving (Show, Eq) Is it possible to convert it to and from BuiltinByteString without explicitly having functions as such: ...
1 vote
1 answer
95 views

Error Starting plutus-playground-client

I'm having error running the plutus-playground-client. Not sure where to look, here is the complete error log. Any suggestions on how to fix? 0 info it worked if it ends with ok 1 verbose cli [ 1 ...
1 vote
2 answers
146 views

nix-shell command causes error "invalid character in Base64 string"

I'm following the Plutus Env: Setup Starter Pack guideline to run a Plutus Playground Local Instance. At step 4, when running the command nix-shell, I got the error message error: invalid character in ...
0 votes
1 answer
134 views

nix-build fails to build plutus or plutus-playground server/client with error: reading from file: Is a directory

I'm attempting to finish the setup for plutus pioneers cohort3 on wsl2 (Windows 10) with Ubunutu 20.04 Nix version: 2.5.1 I cloned the plutus-apps repo (and previously tried the plutus repo before ...
1 vote
2 answers
108 views

git checkout 41149926c108c71831cfe8d244c83b0ee4bf5c8a for English Auction doesn't work

According to cabal.project script for the English Auction, the git branch for this plutus script is: source-repository-package type: git location: https://github.com/input-output-hk/plutus-...
0 votes
1 answer
84 views

Webpack warning when starting plutus-playground-client

I am getting a warning when I run npm start on the plutus-playground-client: ℹ 「wds」: webpack output is served from / ℹ 「wds」: Content not from webpack is served from /home/datapool/plutus-apps/plutus-...
7 votes
2 answers
207 views

on multiple eUTxO and the validation proces

I have an in-depth question that needs good knowledge of the ledger rules. I was thinking about how to program efficiently and design apps such that they are parallelizable, a good practice for ...
1 vote
1 answer
61 views

Smart contract configuration

Is it possible to write smart contract validator that would check: if UTXO that contains service price information was included so only script can read what is actual price of the service. UTXO with ...
1 vote
1 answer
77 views

WSL2 Plutus env setup - docker load error: attribute 'devcontainer' in selection path

docker load < $(nix-build default.nix -A devcontainer) error: attribute 'devcontainer' in selection path 'devcontainer' not found -bash: $(nix-build default.nix -A devcontainer): ambiguous redirect ...
0 votes
1 answer
41 views

start-cluster - Command failed: genesis create - */genesis.alonzo.spec.json: openBinaryFile: does not exist (No such file or directory)

After cloning latest cardano-node and running nix-shell successfully I get an error running start-cluster and different error if I run with sudo: Do I need to download the latest genesis jason file? ...
0 votes
1 answer
74 views

Plutus-Starter Starter PAB backend server does not return wallet id

Server seems to have built ok: [nix-shell:~/plutus/plutus-starter]$ cabal build plutus-starter-pab Resolving dependencies... Up to date I am using Plutus-Starter project on Macbook Monterey M1 but ...

1
2 3 4 5
13