Questions tagged [plutus]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
17 views

Define a native token minting policy restricted by NFT

I have found examples indicating that a minting policy can be single shot or restricted by PubKeys, however I would like to secure minting and burning of a token based on if a specific NFT is present ...
1
vote
2answers
30 views

How to parse TokenName to Integer

I have information encoded in the TokenName of an asset. These token names represent integers. According to the Plutus source code, the TokenName is of type BuiltinByteString. How can I parse it to ...
1
vote
0answers
4 views

Sandbox error when running nix build

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....
1
vote
1answer
13 views

using an output of a transaction in the same transaction

is it possible to implement a plutus script that consumes two UTXO's where the output of one is used as an redeemer for the second?
2
votes
0answers
23 views

PAB recovering from Errors

In the current version of the Plutus starter repo (commit a85818 which uses plutus-1.0.9), it seems difficult to know where to handle errors. For example, using the Game contract after initialization ...
3
votes
1answer
60 views

Can a smart contract read the presence of an NFT in the redeemers wallet?

I want to use an NFT as a form of authentication for a Plutus contract. I know I can attach the NFT in the Datum when constructing the transaction and return the NFT in the output however I am worried ...
1
vote
0answers
34 views

What is the recommended way of implementing an NFT sale?

I'm pretty new to crypto development (I've been a professional software engineer for 5+ years now) and would like to get into NFT development using Cardano. Currently, I'd like to start a collab with ...
2
votes
0answers
22 views

Test for logError in Trace monad

How do I write a Tasty unit-test for an error that may be logged from inside the Trace monad? import Control.Monad.Freer.Extras (logError, throwError) trace1 :: Input -> Trace.EmulatorTrace () ...
0
votes
1answer
22 views

Plutus-starter - cannot start contract instance

I am following the link below. I've successfully built the docker image (literally had to upgrade to 32 GB of RAM, it used 15 GB at peak RAM usage during cabal build). I have the PAB server running ...
1
vote
0answers
18 views

Plutus Pioneer Program Week01 : Installing plutus - Unable to start server if syncing plutus with plutus-pioneer-program version

In the plutus-pioneer-program/code/week01 folder, I got the tag as tag: ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4 The git log tag for plutus was 9879b31579d0deb863f3cdf27f93419deec3b4bb So I used git ...
0
votes
2answers
36 views

Right way to get the Wallet ID when creating?

Having trouble with with the plutus-starter template. The following return null after starting the pab: export WALLET_ID_1=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet....
1
vote
0answers
45 views

Prefund wallets for PAB

How does one prefund wallets for PAB (Plutus Application Backend)? I do not want to introduce minting code just for this purpose.
1
vote
0answers
37 views

Specify balance during wallet creation in PAB simulator

Using the PAB Simulator from the plutus-starter (version 1.0.9, commit: a85818c27926f34d627225636f463cc6698706fc), I'm getting some odd behavior in terms of wallet creation. I've created a simple ...
3
votes
0answers
47 views

Where is the on-chain code actually stored?

I've just read something that suggests Validators aren't actually kept on the blockchain. To save the space, only the hash of the Validator is kept at the UTxO and users willing to spend it must ...
0
votes
1answer
26 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 ...
1
vote
0answers
14 views

Error Starting plutus-playground-client

I'm having error running the plutus-playground-client. Not sure where to look, here is the complete error log. Any suggestions on how to fix? 0 info it worked if it ends with ok 1 verbose cli [ 1 ...
0
votes
3answers
61 views

Can a smartcontract access the state of its own address?

As the title says, is there a way for the smart contract to read all UTxOs on its own address and also verify that all UTxOs were used to determine token count on the address. For example users send ...
0
votes
2answers
55 views

Can same UTXO be consumed multiple times in a same slot/block?

Lets imagine I have UTXO sitting with some Datum, for example storing information about some USDT balance, which I am currently selling to anyone (as in lecture 8 of iteration 2). Can there be for ...
0
votes
1answer
43 views

`Integer` as `Datum` in offchain code

In the onchain validator I used Integer type for Datum and everything was fine but when I want to use mustPayToOtherScript tx constraint in the offchain code I get the following error: • Couldn't ...
0
votes
0answers
16 views

`Constraints.unspentOutputs` in `lookup`

I have a question regarding lookups, there is an option Constraints.unspentOutputs, why is it needed? Because in the txConstraint MustSpendScriptOutput I already supply TxOutRef as an input. The ...
0
votes
0answers
14 views

Can a function be passed in as an endpoint argument?

Can a function be passed in as an endpoint argument? IOW,how can I instantiate a function for FromJSON?
1
vote
1answer
47 views

How to instantiate ToSchema for ADT?

If I have data Thing1 = I Integer | S String how do I instantiate ToSchema for it? Note that deriving doesn't work. And how about for data Thing2 = I Integer | S
2
votes
1answer
57 views

Documentation for smart contract deployment on testnet & mainnet

Can somebody point out where I can get the doc for smart contract deployment on testnet & mainnet? I am testing on plutus playground now and would deploy on testnet to try. Thanks in advance.
1
vote
2answers
61 views

Why does the Plutus script need be provided in the transaction?

Why does the Plutus script need be provided in the transaction? My understanding is that a script address is just a hash of the script. In order to spend a UTxO from a script address the spending ...
5
votes
4answers
189 views

How to prevent economic DOS attacks against Plutus contracts

Many people wrote about the eUTXO model and the benefits it brings compared to Ethereum. However, eUTXO also comes with some challenges. In particular, eUTXO is susceptible to "economic denial of ...
2
votes
0answers
75 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 ...
0
votes
1answer
32 views

PAB requesting CONFIG_FILE on CLI

Trying to run PAB by executing: cabal exec -- myapp-pab webserver returns the following error: [Error] The --config option is required However, the lecture by Prof. Lars (PPP Lecture 6) didn't make ...
0
votes
0answers
37 views

Why Cabal will not build Cardano api?

Hi I was just following lecture 1 when trying to build the Auction contract. Plutus commit: ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4 I ran Cabal clean, Cabal update, then added brew install libsodium-...
1
vote
1answer
12 views

nix-shell stuck on Building library for hnix

I'm just gonna post a problem that I've been experiencing for a few days (and having a hard time searching for the answer on the internet) and the solution, so that future questions can refer to this ...
0
votes
1answer
94 views

Finding the redeemer of another UTxO in a transaction

I want to have a minting policy that checks some conditions of another input-utxo of the transaction. Fetching all transaction inputs and iterating over them is possible using txInfoInputs (see plutus-...
1
vote
1answer
55 views

How to submit a script transaction using `cardano-cli`

I'm trying to go through the Alonzo Testnet exercises to get more familiar with the deployment process for Plutus contracts. I've gotten confused by the instructions in sheet 3: Download the pre-...
1
vote
2answers
44 views

Is awaitTxConfirmed mandatory?

I am running into timing issues, and am considering leaving out awaitTxConfirmed. Is that wise?
2
votes
1answer
54 views

Issues with oracle concurrency

I'm sort of running into an issue with the oracle described in the PPP. It looks like there is race between the oracle to update the exchange rate and the users to use the exchange rate in a swap. We ...
2
votes
1answer
59 views

Plutus pioneer program - Lecture #1 - Can't understand behaviour of transactions

Why is the second bid of wallet 2 getting ignored when I test it like this? If the first transaction of wallet 2 was also valid, then the second suceeds. I'm just curious if this is somehow expected ...
3
votes
1answer
154 views

How do I deploy a smart contract from another smart contract?

If I want to create one top level contract for creating a bunch of other, similar contracts, lets say a top level Uniswap contract that creates liquidity pool contracts and keeps track of the total ...
2
votes
0answers
28 views

SOLVED: Plutus-Start for Windows - Cannot get the docker repository to run (A mount config is invalid.)

I am following : https://github.com/input-output-hk/plutus-starter I have downloaded VSCode and Docker. I downloaded the Remote Development extension in VSCode. I then ran "mkdir -p ~/.cabal/...
4
votes
1answer
40 views

Choosing Ubuntu over WSL for Plutus development

I use a low end laptop as my daily driver running a WSL Ubuntu-20.04 as my platform of choice. When trying to run the plutus-playground it often crashes. Should I try using Ubuntu or any other Linux ...
11
votes
6answers
1k 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 ...
2
votes
0answers
24 views

Launch.json for VSCode/Haskell? Learning Haskell Plutus

I have VSCode all set up with the necessary Haskell plugins (except I have GHCI 9.x installed via Chocolatey and the plugins want 8.x, ouch! Unfortunately Chocolatey won't accept an 8.x "--...
3
votes
1answer
68 views

Length of Plutus Slot

Is it correct that the length of a Plutus time slot is one second? I recall that at one point it was twenty seconds, but I understand that that is no longer the case. Where in the Plutus codebase can ...
2
votes
1answer
35 views

Error with cabal build using plutus-starter-devcontainer on macOS Big Sur

I'm working to set up the plutus-starter-devcontainer integration with VSCode. Dev Environment: macOS Big Sur 11.5.2 Docker Desktop 4.0.0 Following the instructions from here: https://github.com/...
1
vote
0answers
32 views

How to make payment to a payment address using Plutus?

In Plutus, Ledger.Constraints has the following Constraints mustPayToOtherScript, mustPayToPubKey, mustPayToTheScript, Is there a similar constraint that can used send funds to a payment address in ...
2
votes
1answer
68 views

How to run Plutus code on Alonzo Purple without the PAB?

I am trying to run my Plutus code on Alonzo Purple. However, the PAB currently isn't able to connect to the Alonzo Purple testnet. Since the off-chain code lives in the Contract monad, do I need to ...
3
votes
1answer
56 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 = ...
2
votes
0answers
25 views

Convert Plutus Address Credential to real-net address

So in Plutus we have the Address type which has two constructors ScriptCredential which is a ValidatorHash or PubKeyCredential which is a PubKeyHash but all these are not encoded in the same way as ...
2
votes
1answer
43 views

Funding emulator wallets with custom currencies

How exactly can I fund the emulator wallets with custom currencies? Please show an emulator example doing so.
1
vote
0answers
46 views

What is achieved by invoking endpoint for wallet in the emulator?

As per entire code below, give always mandates that Wallet 2 be given: thePkh :: PubKeyHash thePkh = pubKeyHash $ walletPubKey $ Wallet 2 theVal :: Value theVal = ADA.toValue (ADA.Lovelace 3_000_000) ...
2
votes
0answers
16 views

Slow settlement for safe wallet in Plutus

The problem I'm trying to solve -- I want to move my crypto off exchange, but I'm afraid I will be hacked or lose my keys. Solution -- wallet that takes 1 day to settle every outgoing transaction. ...
1
vote
1answer
52 views

Hypothetically, could someone other than the Cardano Foundation or IO publish an application back end first?

The Plutus Application Backend remains to be published. Could someone else put one up first? What would happen?
2
votes
1answer
47 views

Is it possible to withdraw rewards with smart-contracts?

I would like to automatically withdraw my rewards and send it in different wallets. Is it already technically possible? Thanks, Regards, Anthony