Questions tagged [plutus]

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

101 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
1answer
109 views

Fetching all Tokens that belong to a Minting Policy

Is there a way to programmatically get all the TokenNames belonging to a CurrencySymbol with Plutus?
5
votes
0answers
111 views

Plutus-Start for Windows - Cannot get the docker repository to run (A mount config is invalid.)

I am following : https://github.com/input-output-hk/plutus-starter I have downloaded VSCode and Docker. I downloaded the Remote Development extension in VSCode. I then ran "mkdir -p ~/.cabal/...
5
votes
0answers
89 views

Convert Plutus Address Credential to real-net address

So in Plutus we have the Address type which has two constructors ScriptCredential which is a ValidatorHash or PubKeyCredential which is a PubKeyHash but all these are not encoded in the same way as ...
5
votes
0answers
99 views

How to spend two outputs of two different scripts

I've got a problem. I've tried to implement a logic which can spend 2 outputs of 2 different scripts and create 2 new utxos like a following lookups = Constraints.typedValidatorLookups instance1 ...
5
votes
1answer
196 views

Questioning Plutus API design decision

In Lecture 10 from the Plutus Pioneer Programm there is a replica of the Uniswap Smart Contract built on top of Plutus. It is actually part of the standard Plutus use cases Plutus Uniswap To have a ...
4
votes
0answers
31 views

How to calculate fees for Plutus Smart Contract?

How can someone calculate fee for executing Plutus smart contract given that they know CPU and Memory Units required for executing Plutus Script?
4
votes
0answers
46 views

Launch.json for VSCode/Haskell? Learning Haskell Plutus

I have VSCode all set up with the necessary Haskell plugins (except I have GHCI 9.x installed via Chocolatey and the plugins want 8.x, ouch! Unfortunately Chocolatey won't accept an 8.x "--...
4
votes
1answer
96 views

Setting up Plutus environment for Apple Silicon computer

I'm trying to setup dependencies to write and test plutus contracts, but I'm worried that the dependencies may not be compatible with the M1 chip. I have been following these instructions https://www....
4
votes
0answers
78 views

Invoking lock endpoint on the plutus-starter guessing game is giving me "endpoint not available" error

Using the nix-shell approach, I'm able to build and execute the plutus starter PAB project, which includes the guessing game contract. GIT repo link In a separate terminal window, I can run the GET ...
4
votes
0answers
117 views

Using Plutus PAB for development instead of Playground

trying to migrate away from the playground and seems like PAB is the way to go. The plutus starter repository orignally seems to be the best place to start but it seems to be outdated (i.e. still ...
3
votes
0answers
42 views

What happened to {-# INLINABLE ____ #-}

What happened to the use of INLINABLE why don't I see it used like it was before in the Plutus pioneer program. Was their an update?
3
votes
0answers
84 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 ...
3
votes
0answers
86 views

Question about plutus-pab

I am trying to understand plutus-pab. I read in the documentation that PAB will give to a wallet an unsigned and unbalanced transaction, then the wallet will balance and sign it and then will send it ...
3
votes
0answers
41 views

PAB recovering from Errors

In the current version of the Plutus starter repo (commit a85818 which uses plutus-1.0.9), it seems difficult to know where to handle errors. For example, using the Game contract after initialization ...
3
votes
0answers
32 views

Test for logError in Trace monad

How do I write a Tasty unit-test for an error that may be logged from inside the Trace monad? import Control.Monad.Freer.Extras (logError, throwError) trace1 :: Input -> Trace.EmulatorTrace () ...
3
votes
1answer
60 views

How to make payment to a payment address using Plutus?

In Plutus, Ledger.Constraints has the following Constraints mustPayToOtherScript, mustPayToPubKey, mustPayToTheScript, Is there a similar constraint that can used send funds to a payment address in ...
3
votes
1answer
113 views

plutus-playground-server: user error (Error evaluating simulation: JsonDecodingError

I'm following the first lecture in the plutus pioneer program but I cannot set up the local environment. The error happens when running npm start on a nix-shell after initializing the playground ...
3
votes
1answer
117 views

How to solve the Plutus scalability issue?

This issue is one that'll plague projects trying to build on Cardano. Let's consider Lecture 10 of the first iteration of the Plutus Pioneers Program (https://www.youtube.com/watch?v=Dg36h9YPMz4&...
3
votes
1answer
88 views

awaitTxConfirmed not returning

Under what conditions does awaitTxConfirmed not return? It stopped returning since I updated my cabal.project file to make use of the latest plutus tag plutus-starter-devcontainer/v1.0.7. It worked ...
3
votes
0answers
79 views

ZeroKnowledge Proofs in Plutus?

From what I heard Plutus / Smart Contracts will bring also the possibility to do Zero Knowledge Proofs. But I struggled to find further Details in the Documentation. So here are my Questions: Anyone ...
3
votes
1answer
110 views

Implementing a nested state machine

I am trying to implement a nested state machine with plutus and I'm wondering if it is even a possibility.
2
votes
0answers
79 views

How can I get a fully build transaction from the PAB

According to the Plutus team, the standard way of generating signed transactions containing smart contracts is to have the off-chain code generate a so called unbalanced transaction that is then, in a ...
2
votes
1answer
62 views

Best practice for testing smart contract

Let's say you have your haskell code ready to test as a smart contract on the testnet, what is the best practice to go about testing if your smart contract works as intended? Does the same process ...
2
votes
0answers
44 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 ...
2
votes
1answer
87 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 ...
2
votes
1answer
44 views

Retrieve only digit from TokenName and use onchain

How can I make the following function to retrieve only digit portion from the TokenName and use it on chain? For example I want to retrieve the number 123 from "AAA123" (TokenName) {-# ...
2
votes
0answers
43 views

Is it possible to use a parameterised CurrencySymbol inside another validator script? Unsupported feature: Type constructor: GHC.Prim.ByteArray#

I am having trouble using a parameterised CurrencySymbol inside another validator script. It seems to work (not shown here) when the currency symbol is unparametrised but not otherwise: GHC Core to ...
2
votes
1answer
83 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 ...
2
votes
1answer
176 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 ...
2
votes
1answer
52 views

How to get latest version of Plutus in project file of plutus-starter-devcontainer

I've been trying to get the latest version of plutus on my project but I get the following error message when I run nix-shell: error: attribute '8a20664f00d8f396920385947903761a9a897fe0' missing, at /...
1
vote
0answers
9 views

On the composabilty of plutus validator scripts

we love from Haskell the great level of abstraction and with that the modularity and composabilty it offers with it great type system. In extension of this I was wondering how modular and composable ...
1
vote
1answer
33 views

HLS Compiler Error PPP Week01 (WSL2 + VSCode)

I'm trying to get HLS (Haskell Language Server) working in VSCode using WSL2 so I can get type hints. I've already ran through the week01 instructions so I have a working nix installation. However, ...
1
vote
3answers
45 views

Seller pays the fees?

Is it always the case the seller pays the fees? Is this built in the protocol or is it possible to have buyer pay the fees?
1
vote
0answers
33 views

plutus-playground-client npm start error (MacOs Intel i7)

[Updated] ✖ 「wdm」: ERROR in Error: Child compilation failed: Module not found: Error: Can't resolve '/Users/fanik/development/plutus_pioneer_program/plutus-apps/plutus-playground-client/undefined/...
1
vote
2answers
77 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-...
1
vote
5answers
115 views

WSL2 install - plutus fails to build, unable to open db file in 'nix/var/nix/db/db.sqlite'

I'm attempting to finish the setup for plutus pioneers cohort3 on wsl2 (Windows 10) with Ubunutu 20.04. When I run the command: nix --extra-experimental-features nix-command build -f default.nix ...
1
vote
2answers
63 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 ...
1
vote
1answer
45 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 ...
1
vote
0answers
22 views

How to mint mint NFT with StateMachine

I would like to mint an NFT in a particular state of the state machine Does anyone know where I can find some examples?
1
vote
1answer
35 views

How do I call the amount of ADA sent to a validator script in an Integer

I am trying to create a validator function that only lets the user send ADA to the creator of the script if the user sends x amount of ADA how to I find out the amount of ADA the user sent and then ...
1
vote
1answer
30 views

How to create an NFT collection sale validator script

If I have a wallet that currently stores x amount of NFT's and I make a validator script that provides one NFT from that wallet in exchange for ADA what would I call to make sure 1 unique NFT goes out ...
1
vote
0answers
62 views

Who is using the Plutus Application Backend (PAB) here in this forum?

My last three questions all concerned the PAB and have received no answers. This got me wondering if anyone in this forum is actively using the PAB and if so, how he/she is using it. This is more a ...
1
vote
0answers
58 views

How to export a transaction from Plutus for the wallet

I have a contract that returns an unbalanced transaction: buyTokensTx :: forall w s. TokenPool -> BuyParams -> Contract w s Text (Either MkTxError UnbalancedTx) From what I understand, I need ...
1
vote
0answers
42 views

Maximum transaction size

As far as I know the maximum transaction size is 16kB including metadata https://github.com/cardano-foundation/CIPs/blob/master/CIP-0009/CIP-0009.md However, I recently submitted successfully several ...
1
vote
0answers
30 views

Are on-chain validator Integer comparing functions working correctly?

In the validator, I have defined: txInfo :: TxInfo txInfo = scriptContextTxInfo ctx feePaid :: Integer feePaid = Ada.getLovelace (Ada.fromValue (txInfoFee txInfo)) the strange thing is, when I do: ...
1
vote
1answer
25 views

How can I pinpoint a specific UTxO using ContractModel

I'm trying to create a contract where a TxOutRef is supplied to it which tells it a specific UTxO to use in the contract. This seemed fine until I started working with ContractModel. I can't find any ...
1
vote
0answers
44 views

Is it possible to validate on-chain if two different wallet addresses come from the same person?

My goal is: I would like to create a smart contract which would verify if unlocking transaction comes from the same person as the wallet address which is known before hand. What I have tried: I have ...
1
vote
1answer
45 views

Verifiying a digital signature in a Plutus script

Is there a function like signedBy that I can call in a Plutus script to verify a digital signature?
1
vote
1answer
54 views

How to get the final balances using the PAB+ the simulator?

I'm using the GuessGame: https://github.com/input-output-hk/plutus/blob/a36af17fd38db591865679916c819079ad51fda2/plutus-playground-server/usecases/Game.hs under the simulator, with this code main = ...
1
vote
0answers
117 views

Impossible to use extended keys with cardano-cli transaction build --required-signer flag

We are implementing the vesting contract from Plutus use cases via cardano-cli In the validator script we have the pubKeyHash of the pubKey authorized to retrieve the funds. When the owner of this key ...