All Questions
Tagged with plutus smart-contract
145
questions
1
vote
0
answers
15
views
redeeming from PlutusV3 script fails
This is the code of my smart contract. It basically requires exactly 3 reference inputs to pass validation.
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ...
0
votes
0
answers
32
views
In which cases Plutus compiler is producing expensive code?
I have heard a couple of times, that is hard to make Plutus produce non-costly code, and one should consider writing scripts on a level with Plutarch's help instead. Still, I never get real reasons ...
2
votes
1
answer
62
views
How to handle sensitive data in smart contracts?
I'm interested in creating an escrow smart contract using Plutus, where a seller stores an encryption key in the Datum and sells it for a price. The key should only be accessible to a buyer who pays ...
0
votes
2
answers
160
views
Different types of Datums
I have a good understanding of the role of Datums in Cardano's Extended UTXO model, including their use in representing the state of a smart contract. However, I'm seeking further clarification on the ...
3
votes
2
answers
467
views
Can a smart contract execute itself automatically?
I was wondering wether a smart contract can execute automatically or not. For example, let's say I have a vesting contract that, when a certain deadline passes, automatically executes and send some ...
3
votes
2
answers
339
views
Which would be the future language for writing smart-contract?
As we might know well-known approaches for writing smart contracts on Cardano are using Plutus Tx or Marlowe based on specific requirements. However, according to the growth of the Cardano community, ...
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
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 ...
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
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
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 (...
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
159
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 ...
3
votes
1
answer
99
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 ...
10
votes
3
answers
349
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 ...
4
votes
3
answers
149
views
How do users interact with smart contract?
In plutus playground, there is an example called “Vesting”. In the simulation, users can interact with this smart contract by click on “vest fund” or “retrieve funds”.
Now suppose that we compile this ...
0
votes
1
answer
47
views
Printing a plutus validators cborhex to a file
I was hoping to get some advice re printing a plutus validators cborhex to a file. Im kinda basing my logic off of an example in week03 in the pioneer program but need to make some adaptations.
Below ...
0
votes
1
answer
51
views
Use a parameterized currencySymbol within a Plutus Validator. Unsupported feature: Type constructor: GHC.Prim.ByteArray#
I have a minting policy which is parameterized by PaymentPubKeyHash and a script which checks that a token from that minting policy has been burned. The script also takes PaymentPubKeyHash as a ...
0
votes
1
answer
34
views
Plutus Playground - mustPayToTheScript - unexpected char escapes - 0 converted to \NUL, 1 to \SOH
I am having trouble with the mustPayToTheScript function - I am getting this error
Contract instance stopped with error: "WalletError (InsufficientFunds \"Total: Value (Map [(,Map [(\\\"...
1
vote
0
answers
55
views
Plutus Playground WalletError: InsufficientFunds
I am running my smart contract on the plutus-playground and getting the error below:
Contract instance stopped with error: "WalletError (InsufficientFunds \"Total: Value (Map [(,Map [(\\\&...
1
vote
1
answer
65
views
Is there an equivalent of Bitcoin Script Opcodes or the EVM instruction set in Cardano
Is there some lower level code that Plutus code compiles to (akin to Solidity => EVM bytecode, or BSV sCrypt => OP_codes)?
Related (but distinct) how the state changes: https://cardano....
4
votes
5
answers
506
views
Smart contract is not working after Vasil Hardfork in testnet
My smart contracts deployed in testnet stoped working after the Vasil Hardfork. i get this error:
""transaction submit error ShelleyTxValidationError
ShelleyBasedEraBabbage (ApplyTxError [...
2
votes
3
answers
113
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, ...
3
votes
1
answer
154
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 ...
2
votes
1
answer
88
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 ...
0
votes
1
answer
66
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?
1
vote
1
answer
54
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, ...
0
votes
1
answer
20
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....
0
votes
2
answers
82
views
How to get transaction info of a public key hash in a plutus smart contract?
Given a PubKeyHash (pkh) how can I get the history of that pkh's transactions from within a plutus smart contract?
1
vote
1
answer
26
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 ...
2
votes
0
answers
41
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 ...
2
votes
2
answers
57
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 ...
0
votes
3
answers
108
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 ...
4
votes
1
answer
88
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 ...
2
votes
1
answer
50
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 ...
0
votes
1
answer
119
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 ...
1
vote
1
answer
85
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 ...
2
votes
1
answer
119
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 ...
1
vote
0
answers
132
views
Whats the Diffrance between Plutus scripts and Cardano Native Scripts?
What are the key differences between Cardano native scripts and Plutus scripts, from a developer's perspective?
4
votes
1
answer
230
views
How do I make a Sidechain
I want to make a side chain on Cardano to so something that the protocol says should be done on a sidechain, but how do I make one?
Can I use Plutus or am I limited to the CLI?
1
vote
2
answers
44
views
checkDeadline function always returning False
I am trying to make a minting policy that fails after a certain deadline.
I have tried something like this
{-# INLINABLE mkTokenPolicy #-}
mkTokenPolicy :: TxOutRef -> TokenName -> Integer -> ...
2
votes
1
answer
89
views
How expressive & secure is the Plutarch eDSL?
The Plutarch eDSL tries to control how plutus core is generated to create a smaller and thus a more efficient validator script (their GitHub).
I am not an in depth user of this tool. Does its approach ...
2
votes
3
answers
95
views
How to allow non deterministic spent output
I would like a validator (or a minting policy) to succeed always but only to spend the output if some conditions are met;
an example use case of such behaviour is to allow burning token (kind of a &...
2
votes
1
answer
79
views
How to take powers in validator
I was trying to implement some El Gamal cryptography in plutus, basic verification of statements. But while trying to implement an efficient modular exponential function I noticed that the current ...
2
votes
2
answers
108
views
can't understand which part of the code is not "PlutusTx"
I'm trying to write a very simple NFT minting policy myself and I can't get rid of the following error
Program error: GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a ...