Questions tagged [plutus]
A programming language based on Haskell used to write smart contracts on the Cardano blockchain.
64
questions
1
vote
1
answer
210
views
Ensuring NFT collection uniqueness using counter as asset name?
I would like to be able to mint a collection of NFTs across different transactions that fall under the same policy id.
A method I would like to try is making a 'dummy' nft that holds a counter as its ...
9
votes
3
answers
200
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 ...
7
votes
2
answers
430
views
How to convert posixTime to slot number on Cardano Testnet
I'd like to obtain the slot number corresponding to a posixtime on Cardano Testnet.
For example, this might be useful if you need to set a slot number in cardano-cli, say building a transaction: ...
16
votes
4
answers
1k
views
On-chain and off-chain for Plutus SCs
Hi I am currently at lecture 5 of the Plutus Pioneers Programm and I was wondering which part of the code is on chain and which is offchain. I know that the valididation script is onchain but the ...
14
votes
6
answers
2k
views
The Concurrency Issue
Are there any solutions to the concurrency issue so far without sacrificing decentralization? MinSwap testnet was experiencing this last night and just looking for some clarification, haven't seen ...
9
votes
2
answers
587
views
Is there a good tutorial to mint Cardano NFT using plutus script?
I used to mint Cardano NFT using "Time locking" following this guide https://developers.cardano.org/docs/native-tokens/minting-nfts/. But I know the more formal way is to use plutus script ...
5
votes
1
answer
207
views
Hash MisMatch Error on Plutus and Nix
I keep getting the Hash Mismatch Error, anyway I can resolve it or get around it?
hash mismatch in fixed-output derivation '/nix/store/7y3jr1jvzkj2146h7sivw0sfr2bhap3j-ghc-8.4.4-x86_64-deb8-linux.tar....
5
votes
1
answer
535
views
How do I read the datum of an output?
How do I get the datum of an output from cardano-graphql (or another service)? I have attached it using the --tx-out-datum-embed-file flag already when building the tx using cardano-cli.
Thanks!
4
votes
2
answers
302
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 ...
3
votes
4
answers
219
views
Plutus Playground Client fails to load: npm ERR! code ELIFECYCLE
$ nix --version
nix (Nix) 2.5.1
$ ghci --version
The Glorious Glasgow Haskell Compilation System, version 8.10.4.20210212
$ cat /etc/issue
Ubuntu 21.10 \n \l
I have the plutus playground server ...
2
votes
3
answers
169
views
How to Start a New Project
Let's say I have downloaded all the necessary things needed to start developing on Cardano and I just opened up the terminal. I want to start building a new project. What are the commands I run.
...
2
votes
1
answer
145
views
HLS Compiler Error PPP (WSL2 + VSCode)
I'm trying to get HLS (Haskell Language Server) working in VSCode using WSL2 so I can get type hints. I've already ran through the week01 instructions so I have a working nix installation. However, ...
2
votes
1
answer
110
views
Why would ">:i " work in the repl but not "> :t "?
Doing week 04, watching "PPP 030403 - The EmulatorTrace Monad"
In the repl, having already imported as follows
>import Data.Char
>import Text.Read
>import Plutus.Trace.Emulator
>import Data....
1
vote
2
answers
188
views
What is the Cardano's equivalent to the Ethereum's EVM?
What is Cardano's smart contract engine called?
Smart contract language:
Solidity (Ethereum) => Plutus (Cardano) Simple enough, I get this.
Smart contract "engine":
EVM (Ethereum) => ?...
1
vote
1
answer
151
views
plutus-playground-client npm start error (MacOs Intel i7)
[Updated]
✖ 「wdm」: ERROR in Error: Child compilation failed:
Module not found: Error: Can't resolve '/Users/fanik/development/plutus_pioneer_program/plutus-apps/plutus-playground-client/undefined/...
16
votes
3
answers
524
views
What's the difference between "on-chain" and "off-chain" in plutus smart contracts?
Smart contracts written in Plutus can be divided in two: an on-chain part and an off-chain part. What's the main difference between these two?
15
votes
2
answers
331
views
Append metadata to transaction from Plutus code
Is there a way to append metadata to transactions that are send from plutus code?
Right now we send transactions from the contracts like follows (or something alike):
ledgerTx <- ...
14
votes
2
answers
966
views
Where does a smart contract exist, in EUTxO?
In particular, I want to know whether the smart contract is somehow its own entity in the blockchain, or if a smart contract is just a property that EUTxOs may pick up.
EUTxOs are bound by smart ...
10
votes
2
answers
353
views
Why do we need parameterized contracts? Can't we just use datum?
While writing validation as:
mkValidator :: SomeContractParam -> SomeDatum -> () -> ScriptContext -> Bool
Could't we pass the same thing to Datum instead of using Contract Parameter?
9
votes
1
answer
211
views
plutus starter course
So I am trying to start a plutus project from scratch, as we are always just editing the .hs source files in the plutus pioneering program homeworks, wondering what are the bare necessary files needed ...
8
votes
2
answers
159
views
Referencing onchain contract as 3rd party
In solidity and EVM, it is possible to reference external contracts by providing the address and interface to the contract:
address ckAddress = 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d;
...
7
votes
1
answer
433
views
Problem when starting a nix-shell in the plututs repo [duplicate]
I was doing the plutus pioneer program and ran into an error when starting a nix-shell at the top-level directory of the plutus-repository.
I ran into the same error on Ubuntu 20.04.2 LTS (GNU/Linux ...
7
votes
3
answers
833
views
Problem starting a plutus devcontainer in windows
After I upgraded my container to the commit from plutus pioneer programm lecture 3 the VsCode server won't spawn anymore in the dev container.
VSCode tells
could not fetch remote environment
Failed ...
6
votes
5
answers
2k
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 ...
6
votes
2
answers
505
views
I'm having issues with nix-shell
I keep getting this error, any thoughts? I have re-downloaded nix 3 times now and it's the same error as before. Not sure if it's the profiles or channels but this is what it gives me:
'''trying https:...
5
votes
1
answer
366
views
Transaction memory and cpu usage limits
Let's imagine I have AlwaysSucceeds Plutus validator script, which is:
mkValidator :: Params -> Datum -> Redeemer -> ScriptContext -> Bool
mkValidator _ _ _ _ = True
I locked many ...
5
votes
2
answers
93
views
Disable contract after purpose achieved
After a contract has fulfilled its mission in life (such as pay beneficiary), is it proper to delete or disable said contract? If so, how exactly is this done?
Offhand, I would think that if the ...
5
votes
1
answer
217
views
Change minted tokens recepient
I am trying to create a dApp in which "accounts" are authenticated using a minting policy script. It should work by only allowing the minting of tokens if they are sent to an arbitrary ...
4
votes
1
answer
132
views
How to calculate fees for Plutus Smart Contract?
How can someone calculate fee for executing Plutus smart contract given that they know CPU and Memory Units required for executing Plutus Script?
4
votes
2
answers
176
views
What documentation works with handling utxos at the Plutus Script?
I am trying to make a Plutus smart contract which takes tokens locked to the contract and then on endpoint call (purchase) sends 1 to the caller and then the rest back to the contract. I cant find a ...
4
votes
1
answer
150
views
Does txInfoValidRange adjust as time continues on?
Given that the function A contains B is true when all of B is contained in A, and false otherwise, wouldn't that mean that the txInfoValidRange info would have to move its "start point" in ...
4
votes
1
answer
205
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?
4
votes
1
answer
308
views
Find PubKeyHash from String
Given the variable s from
import qualified Wallet.Emulator.Wallet as W
import qualified Ledger
-- Has value of "35dedd2982a03cf39e7dce03c839994ffdec2ec6b04f1cf2d40e61a3"
s :: String
s = ...
4
votes
3
answers
220
views
Structure of the Address type from Plutus.V1.Ledger.Address
When I use scriptAddress on a validator of my SC I got the following result:
Address {addressCredential = ScriptCredential 22261390d0b365fef5a12bc33a29987fe10b28ed58e1036d27b0db43c613edad, ...
3
votes
2
answers
173
views
Empty TokenName Literal Overloading in Week05 Homework2
This doesn't work
mkPolicy oref () ctx = traceIfFalse "UTxO not consumed" hasUTxO &&
traceIfFalse "wrong amount minted" checkMintedAmount
...
3
votes
1
answer
220
views
Referencing an external plutus script
I would like to understand how one can reference an external plutus script in one transaction. In solidity (for the other script), one can import the contract interface into their script, create an ...
3
votes
0
answers
115
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 ...
3
votes
2
answers
390
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 ...
3
votes
3
answers
237
views
Logging in validator
I'm working through the Plutus Pioneer program and I have a bug in my implementation of the validator for homework one. I'd like to add some logging to the validator to get more insight into what I'm ...
3
votes
1
answer
323
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 ...
2
votes
0
answers
83
views
How to calculate fees in Plutus
Let's say I have an Ledger.Constraints.UnbalancedTx with consumed regular UTxOs, script UTxOs and minting scripts, how can I calculate the fees of this transaction in Plutus ? This function would ...
2
votes
3
answers
270
views
Sandbox error when running nix build on macOS
I'm trying to get the exercises for week 1 of the plutus pioneer program working. I've installed nix and have set the IOHK caches.
When I try to run nix build -f default.nix plutus.haskell.packages....
2
votes
1
answer
132
views
Getting the address of a parameterized contract from within the validator of another script
Suppose I have one contract, Contract 1, that is parameterized by type
Contract1Params{
tokenName :: BuiltinByteString
}
and I have a minting policy that will only mint a token with tokenName tn ...
2
votes
2
answers
152
views
Starting a new Plutus Project
I've read a few threads on Cardano Stack exchange on how to start a new Plutus project, but there doesn't seem to be a satisfying answer. I've read the following:
plutus starter course
How to Start a ...
2
votes
1
answer
49
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 ...
2
votes
1
answer
159
views
Deploy a local testnet
To test plutus scripts and transactions, I want to have a lightweight environment which I can use when I have no internet. So, how can I deploy a local testnet in the Babbage era for testing?
2
votes
1
answer
124
views
InlineDatum on ReferenceOutput in OffChain code
I tried to use the inline datum of a reference input in the minting policy below:
{-# INLINABLE validateMinting2 #-}
validateMinting2 :: TxOutRef -> BuiltinData -> BuiltinData -> ()
...
2
votes
1
answer
386
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 ...
2
votes
1
answer
103
views
How does a Cardano DApp client authorize a payment?
Am I correct in thinking that this requires a DApp connector on the same device as the User's wallet?
Or could you have an app on the user's device that doesn't connect to their wallet, but somehow ...
2
votes
2
answers
293
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-...