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
1 answer
14 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, ...
user avatar
0 votes
0 answers
9 views

How To Convert Old Plutus Scripts to Vasil Reference Scripts?

One of the fun things, the Vasil hardfork gives us is the ability to reduce the size of transactions and so put more of them into a block (speeding up the chain). My question is how to change the ...
user avatar
0 votes
1 answer
14 views

How to reduce tx size using typed Plutus script with Vasil fork PlutusV2?

With the recent Vasil fork script references allow to reduce transaction size. Even though Vasil has been already launched on the testnet I could not find information on how to reduce the size of ...
user avatar
2 votes
1 answer
26 views

How to create an unspent UTXO with specific value

I want to create a script (smart-contract) utxo with a specific number of tokens (it can be an output of a transaction before) in cardano-serialization-lib - javascript. I need this utxo to be part of ...
user avatar
  • 69
1 vote
0 answers
20 views

How to consume and produce new UTXO to same script with different Datum?

I am trying to consume old UTXO at stript and produce new one with new Datum. Validator is validating ok but not sure why new utxo with updated datum is not available. current utxos holds one utxo ...
user avatar
  • 11
0 votes
1 answer
27 views

Cannot wrap my head on NFTs

I am running through the Plutus Pioneer Program and I have reached week 5. Also as a reference, I will use the LobsterChallenge repository. I am a bit confused about how NFTs work for the Cardano ...
user avatar
0 votes
1 answer
28 views

Is there a way to see which Plutus code is deployed on a specific script address?

On Ethereum, for example, there is a way to see the Solidity code that is deployed in a specific address (as long as the code gets verified). Is there a way to achieve this same behaviour in Cardano?
user avatar
1 vote
0 answers
10 views

Why can't I use the same wallet more than once in Plutus Playground?

I'm currently testing my app in the "Plutus Playground" and the simulation will not let me call an endpoint from the same contract more than once. When I try to use the same wallet, the ...
user avatar
1 vote
1 answer
98 views

What is this Pop Up Screen on Cardano Documentation?

When searching the docs it helps to use ctrl + F to find something fast, however, when I use it on the plutus docs I get a weird pop-up screen I'm not used to. (Image Below) My Questions are: What is ...
user avatar
1 vote
1 answer
29 views

Is possible to create a cNFT that depends on 'proof of ownership' in order to be own by a wallet?

I'm thinking on a way to create a cNFT that requires 'proof of ownership' to be minted and own by a wallet, by proof of ownership I refer to something the receipt owns and can pass to others or loss, ...
user avatar
  • 113
0 votes
1 answer
16 views

Where Do I Go To Find All The ScriptContexts Feilds and Functions?

Hi im getting lost in the documentation, I have found some things I was looking for but am failing to find the info and functions for script contents. Im using this link https://playground.plutus....
user avatar
1 vote
1 answer
23 views

How does valuePaidTo work?

How does valuePaidTo work ? Does it give the value paid by the script to the pubkeyhash or is it the total value of the pubkeyhash for the pending transactions ? Consider the following TxOut txOutputs ...
user avatar
  • 13
0 votes
1 answer
15 views

How to get transaction info of a pkh?

Given a PubKeyHash (pkh) how can I get the history of that pkh transactions from within a plutus contract?
user avatar
0 votes
0 answers
8 views

How can I make a minting contract that never closes?

I am trying to change some old contracts to take advantage of the reference scripts coming whenever vasil comes out. How can I make a contract that will mint new coins upon activation, I'm talking ...
user avatar
0 votes
1 answer
10 views

Do I Need A Contract Monad For a Burn Wallet?

If I make a script address to be a burn address, I end up having a validator that never validates i.e. returns false all the time. Does a Smart Contract that never can validate need an instance of the ...
user avatar
1 vote
1 answer
39 views

How do I test my smart-contract on Cardano

I'm from EVM background and I've started learning about Cardano lately. I was just wondering how do I write unit tests for my smart-contract written in Haskell? Since i've been doing unit testing in ...
user avatar
0 votes
1 answer
32 views

How To Get Transaction Royalityies on Fungable Tokens

I want to make a fungible token (FT) that has a royalty attached (N%). The problem is UTxOs are purely passive so how can I get my N% of the transaction value on P2P transactions using code is law. To ...
user avatar
1 vote
0 answers
16 views

Whats a Good Example of Interconnected Smart Contracts?

In the Contract Monad we have the use of w s e a. Now w is used to connect contracts is there a good example of how this is done, in particular how to validate a contract using the w of another ...
user avatar
0 votes
0 answers
20 views

guess game stuck in "Waiting for script to have a UTxO of at least 1 lovelace"

I have this program which uses the guessGame example, in the testnet, which gets stuck at "Waiting for script to have a UTxO of at least 1 lovelace" when executing "guess": main=...
user avatar
0 votes
1 answer
27 views

How Long Can A Contract Stay On Chain After Validation?

So I have a smart contract that will validate and do some action X but I then require it to wait for user action for a time T and then perform action Y. Questions: What are the limits on T (how long ...
user avatar
2 votes
2 answers
39 views

Whats Your Mental Model For Monads?

I was asked by a friend trying to learn plutus what a monad was, so I began talking about category theory. It seems that this confused him further how would you explain monads to a noob? Whats your ...
user avatar
0 votes
1 answer
53 views

valuepaidto - 3 tokens (plus existent) - how to limit the maximum

I'm trying to verify if X tokens are paid to the signer in a smartcontract. I'm using: numTokens = assetClassValueOf (valuePaidTo info (owner ustate)) (AssetClass(policyToken contractInfo, TokenName(...
user avatar
  • 69
0 votes
0 answers
8 views

How Can You Prevent A Burn Address From Polluting The Cardano Ledger?

Making a Burn Address on the blockchain is currently done by using a script address with a validator that always returns False and so never validates. This ties up ADA and causes the size of the ...
user avatar
3 votes
1 answer
57 views

Referencing (U)TxO's

When Vasil HF is here with the new plutus version, can we only reference unspent transaction outputs or even spent ones? Is there some documentation on these newly added functions? Preferably haddock ...
user avatar
  • 896
2 votes
1 answer
41 views

How to Make Sure A Contract Is Signed By a Certain Party?

I'm thinking about making a parameterised contract between two users. User A can be anyone i.e. any customer, But User B should always be the company. I want to make it so that the validator only ...
user avatar
0 votes
1 answer
78 views

How do I add the staking part of an address in OffChain code

I am currently on tag: v2022-04-06 of plutus-apps and was wondering how to create Lookup and Constraints for a typedValidator that checks whether the input was returned to the script with the correct ...
user avatar
0 votes
0 answers
18 views

Using `curSymbol` function in Validator script

supposed I have a mintingpolicy script (simple one time minting policy, parameterizing TxOutRef) and a validator script. I want to validate if the token with correct CurrencySymbol is spent in a ...
user avatar
0 votes
0 answers
11 views

How to do on-chain Integer pattern matching?

I want to do Integer pattern matching on-chain but always get an error: GHC Core to PLC plugin: E042:Error: Unsupported feature: Use of Haskell Integer equality, possibly via the Haskell Eq typeclass ...
user avatar
0 votes
1 answer
28 views

Can't create ```TokenName``` using ```tokenName``` with error ```GHC Core to PLC plugin: E042:Error: Unsupported feature: ...```

I'm not sure is relevant but the code in question is for a generic Validator (with Datums and Redeemers) used to get a forwarded minting policy the problem should be clear from the title, I can't get ...
user avatar
  • 392
1 vote
1 answer
22 views

"'Inputs do not conform to this spec or are otherwise invalid.'" - extract balance from smart contract

I'm implementing a smart-contract in Plutus and I'm with a doubt. For example, Ethereum has some function only to owners, that enables to implement a withdraw of balance for only owner addresses. I ...
user avatar
  • 69
0 votes
1 answer
17 views

CNFT metadata structure

So I am working on a NFT minting and I checked the CIP-25 for metadata descriptions and I am confused regarding the naming of the NFT. What is really the name of the NFT? (as in recognized by JPG....
user avatar
  • 456
0 votes
0 answers
13 views

When is Contract instance actually finished running?

I'm trying to write tests for my smart contracts. I want to test if my contract has finished running by using this predicate: -- | A 'TracePredicate' checking that the wallet's contract instance ...
user avatar
0 votes
1 answer
19 views

Plutus: how to obtain wallet details. Do I have to use the wallet web interface or there is some direct library call?

I need to know the amount of Ada remaining in an account in a off-chain Haskell plutus program. Should I use the wallet web interface of the kind: http://localhost:8090/v2/wallets/$WALLET_ID or there ...
user avatar
0 votes
3 answers
44 views

How to compare BuiltinByteStrings onchain?

I want to check on-chain if a given TokenName is of a specific pattern, for example: aaa1 aaa2 aaa3 I have something like this, but it throws an interpreter exception: checkValidMint :: TokenName -&...
user avatar
0 votes
1 answer
16 views

Do I need to validate for minADAUTxO output in Smart Contract validator?

I have a spending validator that currently expects an output with an NFT to be recreated at its own address. Is it necessary to also include a check whether the output's value has a greater equal ADA ...
user avatar
1 vote
1 answer
22 views

Where does the PAB run?

I understand that PAB is a backend that: provides a standardized environment in which Plutus applications run provides disciplined state management presents discoverable interfaces to the external ...
user avatar
0 votes
0 answers
12 views

Can I forcefully run phase 2 validation in PAB locally?

Transaction validation happens in two phases: https://docs.cardano.org/plutus/transaction-costs-determinism https://iohk.io/en/blog/posts/2021/09/07/no-surprises-transaction-validation-part-2/ https://...
user avatar
0 votes
1 answer
26 views

How to check if validator ran inside minting policy

I want to check within a minting policy whether a specific spending validator script is being run by checking if I can find an input that belongs to that spending validator's script address. If there ...
user avatar
1 vote
2 answers
37 views

Is there a precedent or example for using a cardano NFT for permission verification?

I would like to use ownership of a Cardano NFT as a requirement for editing an online document. i.e. if you own the nft then you will be capable of writing to the document,but if you do not own the ...
user avatar
  • 21
0 votes
0 answers
9 views

Can a json files keys and values be a prerequisite for a minting policy?

I was wondering if a policy script can mint CNT-20 tokens with a metadata.json TX. Can Scripts take the JSONs keys and values as an added prerequisite before minting? I know Plutus can be used too ...
user avatar
  • 1
0 votes
0 answers
9 views

Is there a way that I can use to deploy a liquidity pool on the testnet blockchain as plutus script using the uniswap example in plutus-use-case?

Is there a way that I can use to deploy a liquidity pool on the testnet blockchain as plutus script using the uniswap example in plutus-use-case. I have the node running on my local machine and I 've ...
user avatar
1 vote
1 answer
33 views

Plutus Script Validation Metadata

I have a question but I cannot find a concrete answer for that. I have a smart contract developed in Plutus for managing locking and withdraw of Tokens/NFTs. I'm wondering if I can validate some ...
user avatar
  • 69
1 vote
1 answer
25 views

Why are some Plutus types defined multiple times in different packages?

I would like to know why certain types are defined multiple times in different packages and whether that's suppose to dictate which types to use for on-chain code and which for off-chain code? Example:...
user avatar
1 vote
1 answer
19 views

How to specify differerent inputs coming from a smart contract on Cardano Cli

I am currently testing a plutus script on cardano-cli, I need to use 2 inputs from a SC address that have different datum, how can I specify both --tx-in-datum-file for the transaction? Thanks
user avatar
1 vote
1 answer
73 views

Using Endpoints in a PAB Schema

I am trying to find a way to integrate endpoints from a native token staking contract and implement them into the PAB. I am assuming I will heavily be using the getSchema instance. Like so: instance ...
user avatar
0 votes
1 answer
19 views

Contract is not stopping execution if validation script fails (happened after 2022-04-06 PAB Release)

Before the 2022-04-06 PAB Release Contracts used to stop execution after validation script failed the transaction sent by submitTxConstraintsWith, but after this release Contract is not stopping its ...
user avatar
  • 111
1 vote
0 answers
24 views

How to Count plutus transactions?

i'm connected to the cardano-db-sync, someone knows how to count the ammout of transactions that use plutus script? i'm using two methods here select block.epoch_no, count(distinct tx.id) as ...
user avatar
0 votes
0 answers
32 views

How to fix `cabal build` in Plutus Starter Dev Container

I have seen other people with this problem on Github. Broken cabal build Following these instructions, I am able to get to the line that says: cabal build from the terminal should work (unless you ...
user avatar
2 votes
1 answer
61 views

How precise is the time inside a plutus script?

It is a known fact that you can calculate time inside a plutus validator script by looking at the txInfoValidRange attribute. Now, since this value is a range and not an exact time, it makes me wonder ...
user avatar
  • 753
0 votes
1 answer
19 views

ConstraintResolutionError

I'm getting the following error during the ledgerTx line of code "ConstraintResolutionError (TxOutRefNotFound (TxOutRef {txOutRefId = ...
user avatar

1
2 3 4 5
11