Questions tagged [plutus]
A programming language based on Haskell used to write smart contracts on the Cardano blockchain.
642
questions
0
votes
1
answer
29
views
Why is writeToScript reporting that my script costs 0 resources?
I have the following minting script:
{-# INLINABLE verify_mint #-}
script :: () -> V2.ScriptContext -> Bool
script () _ = (3::Integer) == 2+1
and the following off-chain code to mint a token:
...
0
votes
2
answers
84
views
playground-common package giving 'Failed to build scrypt-0.5.0' error
I'm trying to run my own little smart contract in the plutus-pioneer-program [fourth iteration] docker container and I'm having some problems. I've just added an extra folder alongside the other weeks....
1
vote
1
answer
23
views
how to use ownPubKey and RedeemerType and DatumType
My code is here.
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ...
2
votes
1
answer
26
views
Expecting one more argument to ‘RedeemerType’
My code is here
marketConstraints :: Market -> TxConstraints (RedeemerType -> ScriptContext -> Bool) (DatumType, ())
marketConstraints market = mustValidateIn (to $ scriptAddress market)
I ...
1
vote
2
answers
174
views
Unable to build project using latest version of plutus-apps using nix develop
When I run cabal repl on my project using nix develop I get the following error:
Warning: Requested index-state 2023-02-20T00:00:00Z is newer than
'hackage.haskell.org'! Falling back to older state (...
1
vote
0
answers
24
views
PlutusTx TxInfo Type Mismatch
I am building a PlutusTx V1 Smart Contract for NFT Royalty distribution. Part of that requires totaling up the amount of Lovelace sent to the contract from the most recent tx. I came up with the ...
1
vote
4
answers
173
views
Is it possible to obtain the cbor hex/script bytes from a bech32 script address?
I would like to get the script bytes from the bech32 address of a script. Is this possible?
1
vote
1
answer
37
views
Need to access documentation for Plutus.Contract.Oracle but not available in https://input-output-hk.github.io/plutus/master/
Playground is discontinued but the updated documentation seems to be lacking in components that I have been working with.
I did try to look up the other versions they have listed in their gh-pages ...
0
votes
1
answer
87
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 ...
1
vote
1
answer
268
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
39
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
32
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
16
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
127
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
62
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
68
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
82
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
3
answers
142
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
202
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
79
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....
3
votes
1
answer
137
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
26
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
97
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
227
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
1
answer
97
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
23
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
1
answer
70
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
1
answer
45
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
29
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
53
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 ...