Questions tagged [plutus]
A programming language based on Haskell used to write smart contracts on the Cardano blockchain.
632
questions
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 ...
0
votes
1
answer
20
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?
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
...
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
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-...
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: ...
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 ...
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
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
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
1
answer
23
views
Error when trying to build my Plutus project
I am getting the following error after trying to execute cabal build:
cabal: Could not resolve dependencies:
[__0] next goal: cardano-crypto-class (user goal)
[__0] rejecting: cardano-crypto-class-2.0....
2
votes
1
answer
74
views
Unclear error during Plutus ScriptContext construction (force headList [])
I ran into an error while trying to autobalance a transaction body:
module Foo.Offchain where
import Plutus.V1.Ledger.Scripts (MintingPolicy)
import Plutus.V1.Ledger.Address (Address)
import Hydra....
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
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 ...
1
vote
1
answer
103
views
How to deploy the Plutus smart contract
I am following Plutus-pioneer-program to learn smart contract development in Cardano. I have tried the onchain and offchain code, compiled and tested in Plutus playground and also in emulator trace. ...
0
votes
0
answers
64
views
Data from Mesh to Plutus
I created this datum with Mesh
const datumMD: Data = new Map<Data, Data>();
datumMD.set('name', assetName );
datumMD.set('question', input);
datumMD.set('answers', []);
datumMD.set('...
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:
...
0
votes
0
answers
21
views
cardano-ledger-shelley failing to build in martify contract
I am trying to compile the martify contract over here and I am failing to do so. It gives
Configuring library for cardano-ledger-shelley-0.1.0.0..
Preprocessing library for cardano-ledger-shelley-0.1....
0
votes
1
answer
26
views
Error when executing nix-shell in plutus-apps
I am getting...
error: experimental Nix feature 'flakes' is disabled; use '--extra-experimental-features flakes' to override
...when trying to run nix-shell from plutus-apps repo.
Does anybody know ...
0
votes
0
answers
4
views
Paying to Script when initializing a state machine
How does one verifiy the constraint mustPayToTheScript in the onchain code while initializing a state machine?
Constraints seem to only be enforcable when a change of state is being undertaken and not ...
0
votes
0
answers
23
views
Error when running nix-shell on WSL
I'm a newcomer to Cardano trying to learn Plutus. After cloning IOHK's Plutus-apps (https://github.com/input-output-hk/plutus-apps) repo and already installing nix, I found this error when running nix-...
0
votes
1
answer
25
views
Submit transactions to the blockchain in Plutus
Currently my workflow is like this:
write a validator script in Plutus
test the script in by creating functions/endpoints to submit transactions to Plutus.Trace (Emulator)
if the test goes well, I ...
0
votes
1
answer
22
views
suppress errors in trace emulator
I would like to suppress this error. How can I do that ?
Slot 00013: *** CONTRACT LOG: "PassingTest [TEST_TAG:3] -- caught error: WalletContractError (ValidationError (ScriptFailure (...
0
votes
1
answer
34
views
PlutusV2: Error when spending script output
This is how I spend script's utxos with the Emulator. This one from this example.
grab :: forall w s e. AsContractError e => Contract w s e ()
grab = do
utxos <- utxosAt scrAddress ...
0
votes
1
answer
38
views
Example/documentation of Reference Input (CIP31) and Inline Datum (CIP32) with Emulator?
I am finding an example implementation of Reference Input (CIP31) and Inline Datum (CIP32) and want to test it with the Plutus.Trace.Emulator. I see some answers like here talking about ...
0
votes
1
answer
23
views
Custom currency error: Cannot build the initial state: Tag "toCardanoPolicyId"
I try to set an initial state of the emulator like so:
test :: IO ()
test = runEmulatorTraceIO' def emCfg myTrace
where
dist = Map.fromList [ (senderWallet, Ada.lovelaceValueOf 100_000_000)
...
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 ...
2
votes
2
answers
75
views
How to run a simple Fib function offline?
On Ethereum, I'm able to run and test a Fibonacci function by writing a Solidity smart-contract with a fib method, compiling to the EVM, deploying and running offline by using any EVM implementation, ...
2
votes
1
answer
70
views
Getting the CurrencySymbol of PlutusV2 MintingPolicy
I'd like to get the CurrencySymbol of a PlutusV2 MintingPolicy. There's a function defined in Plutus.Script.Utils.Scripts with the following signature:
scriptCurrencySymbol :: Versioned MintingPolicy -...
0
votes
1
answer
39
views
Unable to compile script
I'm stuck trying to compile my minting policy - getting the following error message:
• Couldn't match type ‘Colony’ with ‘BuiltinData’
Expected type: template-haskell-2.16.0.0:Language....
0
votes
0
answers
35
views
PaymentPubKeyHashes don't match
I have a structured datum like:
data VestingDatum = VestingDatum
{ beneficiary :: PaymentPubKeyHash
, deadline :: POSIXTime
} ...
0
votes
1
answer
29
views
Unable to attach two reference inputs to a transaction with Plutus Emulator
I have written a script that will fail unless it receives both oref1 and oref2 as reference inputs. I have the following emulator code:
let rule = mempty
<> C....
0
votes
1
answer
32
views
nix shell did not work in plutus-apps
I checkout to branch c2b310968d0915e2af0ea4680186b41ad88ffbe9 and run nix-shell at plutus-apps. No error, nothing change when I run nix-shell.I reinstalled nix, changed iohk-cache, reinstalled ubuntu. ...
0
votes
0
answers
15
views
traceIfFalse not showing in cardano-cli output
I have a minting policy:
mkNftValidator :: NftParams -> BuiltinData -> ScriptContext -> Bool
mkNftValidator _ _ _ = (traceIfFalse "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ...
0
votes
1
answer
52
views
Module `Ledger.Typed.Scripts' does not export `wrapValidator'
I try to compile code from Plutus Pioneer Program week 4. These lines cause error.
typedValidator :: Scripts.TypedValidator Vesting
typedValidator = Scripts.mkTypedValidator @Vesting
$$(PlutusTx....
1
vote
2
answers
147
views
Nix-shell in plutus-apps
I'm using Ubuntu 20.04.5 with an 11th Gen Intel® Core™ i7-1195G7 @ 2.90GHz × 8.
After cloning the plutus-apps repo and setting my nix config, i can't get pass the following nix-shell error:
trace: To ...
0
votes
0
answers
13
views
ownPaymentPubKeyHash == wallet address?
According to this documentation, ownPaymentPubKeyHash is:
Get the hash of a public key belonging to the wallet that runs this contract. * Any funds paid to this public key hash will be treated as the ...
0
votes
1
answer
94
views
How can I interact with smart contract created from Marlowe in the testnet/mainnet?
I create a smart contract with Marlowe from https://play.marlowe-finance.io
I now want to deploy the contract in the preview testnet and later mainnet. I imagine it must be somehow converted into ...
2
votes
1
answer
77
views
getDirectoryContents:openDirStream: does not exist
Running cabal update within nixos in my app fails with the following:
$HOME/my-app/dist-newstyle/src/plutus-ap_-cbcc5c6ab544aad6/web-ghc: getDirectoryContents:openDirStream: does not exist (No such ...
0
votes
1
answer
41
views
Plutus: multiple-utxo withdraw fails, single-utxo withdraw succeeds
A beneficiary tries to withdraw the maximum amount from 2 utxo's of a smart contract in one transaction but that fails. If the beneficiary does it in two steps it succeeds.
Why does the first one fail?...
0
votes
0
answers
8
views
reference is not a tree error in week03 of pionner program
Hello everyone I was just going through second cohort of pioneer program. When I run cabal repl in week03 it's giving me reference is not a tree error. Could anyone please tell me how to fix this
...
0
votes
0
answers
25
views
mustMintValueWithRedeemer - Number of tokens minted
On the Offchain code I am trying to mint a token using the following snippet
Constraints.mustMintValueWithRedeemer r (assetClassValue cTk 1)
In the validation code of the minting script I am trying ...
0
votes
1
answer
48
views
Can't use PlutusTx.Foldable from other module
I want to write a PlutusTx validator which just checks if a transaction was signed by one of the whitelisted public keys.
This would be a first, naiive implementation:
-- | The whitelist used by '...
0
votes
1
answer
17
views
Problems with HLS with some versions of Plutus Apps: INFO hie-bios: error: cannot lock ref 'refs/remotes/origin/599'
I need some help with this problem.
With some version of Plutus Apps, HLS and VCode works perfect.
But with some specific versions, like this one:
commit cbc2df9e5d47d60505c28f321d75187d9ea85b07 (HEAD)...
0
votes
0
answers
25
views
Error building in the latest Plutus Apps: Failed to build postgresql-libpq-0.9.4.3* Missing (or bad) C library: pq
Im having problems building my projects using the the latest plutus apps:
commit 33c6e81ba4ab9cbb42870bbb6f916f8b4e2c7b3e (HEAD -> main)
Starting postgresql-libpq-0.9.4.3 (all, legacy fallback)
...
7
votes
0
answers
87
views
Developers are having dismal experience building on Cardano [closed]
When developers get into plutus playground, 10 out pf 10 expect it to work like remix, an IDE. You put a code in. You compile and deploy. And then start interacting with the dApp. All in the same ...
3
votes
1
answer
47
views
How To Verify The Code Of A SmartContract?
There's a lot of talk about open-source code on Cardano, but how can I verify that the SmartContract(s) in a git repo are the actual SmartContracts the project has deployed to the Blockchain?
I want ...
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 ...
2
votes
1
answer
33
views
Which address types are allowed for collateral inputs
Collateral inputs are required to be added to a transaction when any Plutus script is executed within that tx (i.e. spending a Plutus address utxo or minting a Plutus policy asset).
Obvious that a ...