Questions tagged [plutus]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
17 views

Memory constraints for smart contracts

I feel like the memory consumption constraint has never been raised and properly discussed before this blogpost: https://iohk.io/en/blog/posts/2021/11/16/architecting-dapps-on-the-eutxo-ledger/ It is ...
0
votes
1answer
40 views

Why do we need the PAB and how does it work?

We can test Plutus smart contracts using runEmulatorTraceIO which emulates a blockchain and serves as an entry point to post transactions on it (or did I get this wrong?). So if I can fully test my ...
1
vote
1answer
21 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 ...
1
vote
0answers
24 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 ...
0
votes
0answers
11 views

Tried minting from transition in StateMachine an got error MintingPolicyNotFound

I changed transition function in Lecture 7 and added constraint for minting Constraints.mustMintValue: transition ts s r = case (stateValue s, stateData s, r) of (v, _, SetPrice p) | p >= 0 ...
0
votes
0answers
21 views

How to scure 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 ...
0
votes
1answer
26 views

The Plutus script evaluation failed

Running into this error when attempting to build a tx. Command failed: transaction build Error: The following scripts have execution failures: the script for transaction input 1 (in the order of the ...
1
vote
0answers
22 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: ...
0
votes
1answer
30 views

Cardano-cli errors when submitting

I can build and sign a tx with no errors using: cardano-cli transaction build --alonzo-era \ --testnet-magic 8 \ --tx-in 20445d5c68e1759f1371a86ecca773b76463fba3831f128fd2f7834de38ae6ec#0 \ --tx-in ...
1
vote
1answer
20 views

Is there a way to find the total number of tokens in circulation generated by a minting policy

I've wrote a minting policy that will allow minting of some token, the token can then by transferred of course to other wallets. Is there a way to find the total number of tokens in circulation? (...
1
vote
2answers
50 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-...
2
votes
1answer
110 views

How to lock funds in a smart contract?

What I want to do: Send 25 ADA and lock it all at the script address until 1 of the 2 scenarios happen: 100 ADA is sent by Nov 25th (today is Nov 20th) and all ADA at the script address is sent out ...
0
votes
2answers
71 views

Is there any way to debug/log variables in validator?

As a newbie in Plutus and Haskell, I write code by printing/logging variables to see their value, which is the only reason why I managed to write Contract, off-chain Plutus part. My question is, are ...
0
votes
0answers
10 views

Using Wallet.Emulator.Folds to debug scripts

I am trying to use functions from Wallet.Emulator.Folds to log stuff in a trace mintAndTransfer :: EmulatorTrace () mintAndTransfer = do let tn = "USDC" h1 <- ...
4
votes
0answers
103 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 ...
1
vote
1answer
36 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
1answer
28 views

Getting Validator Hash

I'm checking the Value locked by certain ValidatorHash of another script that I deployed. Does anyone know how to get Ledger.Address or ValidatorHash from Plutus or cardano-cli? I know the "...
1
vote
1answer
22 views

Does `AssetId` and `AssetClass` mean the same?

In the Plutus library, AssetId is defined in module Cardano.Api.Value as data AssetId = AdaAssetId | AssetId !PolicyId !AssetName while AssetClass is defined in module Plutus.V1.Ledger.Value as ...
2
votes
1answer
26 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) {-# ...
0
votes
0answers
30 views

How to check the minting policy script for an asset [duplicate]

Given the policy ID of an asset, how can one find out its' minting policy script (validation rules)? I've used CardanoScan so far. It is able to show the current token supply, holders and transactions ...
1
vote
1answer
18 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 ...
2
votes
1answer
44 views

What are the differences between policyId & currencySymbol and assetName & tokenName?

In the Plutus docs, there are references to currencySymbol and tokenName. In the cardano docs there are references to policyId and assetName. Are policyId and currencySymbol the same thing? Are ...
3
votes
2answers
63 views

Plutus starter cabal build issue

Running the instructions at https://github.com/input-output-hk/plutus-starter#readme After opening the container in VSCode, and attempting to run the following in the terminal. [devcontainer]$ cabal ...
1
vote
0answers
37 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 ...
0
votes
1answer
12 views

How can I get a POSIXTime in the Contract monad?

I don't see any way to use IO in Contract and I don't see any functions for getting a POSIXTime from the things I can get within Contract.
2
votes
1answer
54 views

How do I export my .hs contract to .Plutus?

How do I export my .hs contract to .Plutus? Please provide step by step guidance.
0
votes
0answers
24 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?
2
votes
3answers
72 views

How to get all utxos from script with off chain code ordered from the oldest to the newest?

Is it possible to get all utxos from address but with specific order for example from the oldest to the newest ones? I am not sure in which order this function utxosAt returns: https://github.com/...
2
votes
1answer
40 views

What is the use case of the mustSpendAtLeast constraint?

What I can figure out: mustSpendAtLeast is basically just a wrapper around MustSpendAtLeast. This gets processed here, by adding a required value to this thing. These values get turned into outputs in ...
1
vote
2answers
41 views

Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function

I am writing a minting policy that takes half the bytes of one of the eUTXOs being used during mint and encoded them as a base89 readable string then checks that the Asset being minted has as a ...
0
votes
1answer
26 views

Plutus devcontainer build fails with 'devcontainer' not found

I cloned the current plutus repo git clone https://github.com/input-output-hk/plutus And i'm on the current commit 3f8c1e22292d68d92f01f9a62a60621df01cdd4e But building the dev container does not ...
2
votes
0answers
40 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 ...
0
votes
0answers
22 views

ContractInstanceId -> Address?

I have a multiple lock-guess game with many Lockers and many Guess'ers. I initiate each lockers and guessers with: lockcid <- Simulator.activateContract (Wallet 1) Lock lockcid2 <- Simulator....
0
votes
1answer
76 views

How to split transaction into many different UTXOs?

Let's image I want to create a Plutus script, which takes Value as a parameter (ADA or any other coin with specific amount), and locks this value at script's output. How can I split this value into ...
0
votes
1answer
65 views

Hash script data

I want to understand a bit better the hash-script-data functionality from cardano-cli. I checked the source code but had no luck in understanding how this hash is made. From the examples, if we run: ...
2
votes
0answers
39 views

What exactly are language views?

I read the docs for language views here, but I still don't quite understand what they are: https://github.com/input-output-hk/cardano-ledger-specs/blob/master/eras/alonzo/test-suite/cddl-files/alonzo....
2
votes
1answer
57 views

What is a Plutus script witnessed tx input?

I'm getting the following error when trying to consume a UTXO at a script address. Command failed: transaction build Error: The following scripts have execution failures: the script for transaction ...
0
votes
1answer
38 views

How to call a endpoint with a new wallet in a already instantiated contract

So I have this code which uses a modified version of the [guess game] (https://github.com/agocorona/DAppFlow/blob/main/ContractExample/GuessGame.hs) which parameterizes the validateGuess script with a ...
1
vote
2answers
76 views

What exactly is the script context on plutus context?

I believe the best way to answer this question would be to give examples of the type of information that the script context could contain.
1
vote
3answers
88 views

Can a smart contract create a transaction on someone else's behalf?

Must someone send their ADA/tokens to a smart contract address in order for the ADA/tokens to be used in the contract OR, for example with Nami wallet connected on a web page, is it possible for a ...
3
votes
1answer
59 views

Empty txInfoSignatories after building transaction with cardano-cli

In the Plutus Pionner Lectures, Lars instructed us to use txSignedBy in order to ensure that a user signed the transaction. The function tries to find a public key hash in the txInfoSignatories list, ...
1
vote
1answer
24 views

Parse error on input ']' when running cabal build in my Plutus code

I have a code that compiles and runs well in the Plutus playground, but when I try to run cabal build I get an error when calling mkTypedValidator: offerValidator :: Scripts.TypedValidator Offer ...
2
votes
1answer
58 views

Convert Redeemer, Datum or Script Parameter to JSON

By following the alonzo-testnet exercises, I'm right now having to build a transaction with cardano-cli. One of the arguments necessary to consume a script is the datum, another is the redeemer, both ...
1
vote
1answer
138 views

How to convert a cardano address into a public key hash?

After spending some time learning Plutus with emulators, I decided to start learning how to actually deploy and use the scripts in the testnet. In this process, I installed cardano-cli and created ...
2
votes
2answers
58 views

Insufficient funds when trying to use script unspent output

I was following the example from the basic split app and changing it a bit to try to make a simple sell/buy NFT transaction. For now I'm just trying to transfer the NFT from one wallet to another. My ...
1
vote
1answer
53 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 = ...
0
votes
1answer
30 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 ...
5
votes
2answers
166 views

How to publish a smart contract on the blockchain?

Let's say I have a Plutus contract written up. How do I actually submit it to the blockchain and start interacting with it?
0
votes
1answer
54 views

How to validate the correctness of another parameterized script address on-chain

I would like to write a factory script that can initialize another parameterized script address by sending it an NFT. The factory validator gets the parameters of the target script as redeemer and has ...
1
vote
0answers
84 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 ...

1
2 3 4 5