Skip to main content

Questions tagged [plutus]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
127 views

Why do we need the ```plutus-chain-index``` to run and why does it take so long to sync

I'm trying to set up a PAB in order to test my contracts Currently I have: fully synced a cardano-node running on testnet fully synced cardano-wallet tracking one wallet a plutus-chain-index syncing ...
Michele Nuzzi's user avatar
0 votes
1 answer
63 views

How to achieve a minting policy script that locks after certain number of images (assets) have been minted on the fly

Let's say I want to run an NFT campaign, where the minting policy only allows minting of 100 NFTs (each one is different), and then the policy should lock. If this minting policy were a Plutus script, ...
Kurt Hartmann's user avatar
0 votes
1 answer
55 views

How can I code a liquidity pool?

I am really interested in how i can code a liquidity pool using Plutus. What are the mechanics & the components I need to handle? Is there a specific pattern, skeleton to follow?
Tasos Valtinos's user avatar
0 votes
2 answers
88 views

Using custom datum for `mustPayToOtherScript` in off-chain code

Lets say I on-chain i have a Datum like so: data RandomDatum = RandomDatum { { tn :: !TokenName , cs :: !CurrencySymbol , nn :: !Integer } deriving (Show) Off chain I'm trying to form and ...
KugisMugis's user avatar
1 vote
0 answers
51 views

setting up the PAB - could not start the plutus-chain-index

I'm trying to follow the lesson 6 of iteration 3 of the plutus-pioneer-program when trying to start che chain index trough the command (fromn the plutus-apps repository) plutus-chain-index --config ./...
Michele Nuzzi's user avatar
0 votes
2 answers
87 views

Diagnosing a POSIXTime discrepancy

My computer's date command is returning a timestamp wildly different from what testnet wants. Using this formula, > slotToEndPOSIXTime testnetConf 55047601 POSIXTime {getPOSIXTime = 1651015217999} ...
waalge's user avatar
  • 403
1 vote
0 answers
125 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?
KryptoKing's user avatar
0 votes
1 answer
261 views

Plutus transaction error PT5

I am building a transaction where I use the following function to make my datum and redeemer, writeJSON :: PlutusTx.ToData a => FilePath -> a -> IO () writeJSON file = LBS.writeFile file . ...
Fermat's user avatar
  • 1,892
0 votes
1 answer
57 views

What is the data type returned from the function utxosAt scriptAddress

I want to use the value returned from the function utxosAt scriptAddress. What is the value that this function will return ? Is it going to be in a list , json etc.....
szhang9921's user avatar
4 votes
1 answer
229 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?
KryptoKing's user avatar
1 vote
2 answers
76 views

StateMachines on Testnet : How to step a client?

I want to run a statemachine on testnet. The SM runs in the emulator, and I can initialize on testnet, but if I try to make a new client it throws an error. The error comes from transition failure, ...
waalge's user avatar
  • 403
3 votes
2 answers
179 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 ...
Domy2018's user avatar
2 votes
1 answer
65 views

What can certificate scripts do?

While looking through the options of the cardano-cli transaction build options I saw the options, --certificate-file CERTIFICATEFILE Filepath of the certificate. This ...
Fermat's user avatar
  • 1,892
1 vote
0 answers
22 views

How convert TxOut CtxUtxo era to Plutus Map TxOutRef TxOut

At least can someone give a hint how to convert TxOut CtxUtxo era to TxOut Ctx era. I found that it's possible to convert to Ledger.UTxO and then ...
ViktorYasterbov's user avatar
4 votes
2 answers
444 views

Plutus datum and redeemer on cardano-cli

I'm trying to deploy a smart contract on cardano-cli after its implementation on plutus playground. Imagine that I have: data TradeDatum = StartBid | Bid TradeDetails | Offer TradeDetails ...
pprs's user avatar
  • 101
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 -> ...
brightman11's user avatar
1 vote
0 answers
25 views

How to see the values of things as you code

How do I test different plutus functions to see if its applicable to be used in my code. How would I create the parameters that these functions would take in. For example below is a Vesting contract ...
szhang9921's user avatar
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 ...
Fermat's user avatar
  • 1,892
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 &...
Michele Nuzzi's user avatar
0 votes
1 answer
67 views

nix attribute not found setting up Dapp repo

I modified slightly cabal.project of the plutus-apps to serve as base for my own application repo. It includes another repo of my own that is also a sligh modification of the plutus repo. If my own ...
agocorona's user avatar
1 vote
2 answers
544 views

How to install cardano-node and cardano-cli on Mac M1

I tried to install cardano-cli and cardano-node using this documentation and stuck on below step mkdir -p $HOME/.local/bin cp -p "$(./scripts/bin-path.sh cardano-node)" $HOME/.local/bin/ cp -...
Irwan's user avatar
  • 9
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 ...
Fermat's user avatar
  • 1,892
2 votes
0 answers
144 views

Building alonzo transaction using cardano-cli and signing it with serialization-lib

I created an API that based on a request builds the body of a transaction with cardano-cli and returns the cbor to the front-end. In the front-end, I'm using the cardano-serialization-lib to load the ...
Mateus's user avatar
  • 988
2 votes
2 answers
107 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 ...
Michele Nuzzi's user avatar
0 votes
1 answer
149 views

Select only one UTxO from script address

I need to get only one UTxO from the script address, where its datum hash matches the redeemer hash. For example I have locked two UTxO with 10 Ada and the DatumHash "house" at the script ...
John_Bones's user avatar
0 votes
1 answer
65 views

could not build or repl plutus-pioneer-program

I'm trying to build the plutus-pioneer program, and I assume that having the environment working is important also in order to build real smart-contracts; I've set up nix and cache and I'm also sure ...
Michele Nuzzi's user avatar
0 votes
1 answer
50 views

Connection between functions, modules, and packages

I have determined (by analyzing all the .hs files) that for weeks 1-8, the following modules are variously imported: import qualified Prelude import qualified Prelude as P import ...
XiTouch's user avatar
  • 349
2 votes
1 answer
76 views

Certification for Plutus Smart Contracts

What does the process look like for certification and auditing of Plutus Smart Contracts? What are required steps to prepare your dApp for certification?
dailyinvention's user avatar
1 vote
0 answers
34 views

How to get the address which locked the fund on a smart contract?

I have two users. The first user locks 1 ADA with a Datum at a script address. The second one unlocks the 1 ADA with the same Datum and should now send 5 ADA to user one. Can I now implement a logic ...
John_Bones's user avatar
0 votes
0 answers
13 views

How to Ensure Constant Timing in Contracts Given Slots can be Changed?

The amount of time a slot represents can be changed. This means if I code a smart contract that has some sort of waiting function for N slots, the amount of time it waits for will change with the slot ...
KryptoKing's user avatar
0 votes
1 answer
34 views

How to check whether my two pubkeyHash is different or not using Haskell?

I'm using this script to check but this doesn't works for me import Prelude hiding (Eq) mkPolicy :: PubKeyHash -> PubKeyHash -> TokenName -> BuiltinData -> ScriptContext -> Bool ...
Karthikeyan Balusamy's user avatar
5 votes
2 answers
139 views

How to optimize Plutus smart contracts?

Context I'm creating scripts with hardcoded parameters in my smartcontract and I would like to reduce footprint of them to reduce transaction fees. Right now i'm doing so using parameterized ...
KugisMugis's user avatar
0 votes
1 answer
54 views

What is the exact transaction lifecycle?

Something which is still fuzzy to me. What is the exact transaction lifecycle? What happens after we submit a transaction via the cli? Does the transaction get broadcasted to the nodes directly for ...
Tasos Valtinos's user avatar
4 votes
1 answer
165 views

How to implement Vesting smartcontract with time period longer than 36 hours?

Context In third weeks plutus pioneer lecture lars said that Vesting period shouldn't be longer than 36 hours. He argued that this is because time is calculated in slots on-chain and that this ...
KugisMugis's user avatar
5 votes
2 answers
413 views

Can you burn/lock/self-destruct NFTs in a a smart contract?

I am involved in an NFT project where there is a policy locking date coming up, but I would like to give the option burn/lock/self-destruct the NFT through a smart contract (SC) at any time after that ...
Thomas Enoch's user avatar
1 vote
1 answer
175 views

What is an unbalanced transaction? How does adjusting an unbalanced tx actually work?

In Week06, there was an implementation of adjusting an unbalanced transaction in the plutus script. Can someone explain what an unbalanced transaction really is? And how does it actually work when we ...
Tasos Valtinos's user avatar
2 votes
0 answers
78 views

Issues running Chain-index on WSL2 - fully syncing but not running the webserver

I've run into an issue with the chain-index while trying to run a PAB testnet environment. The index will start up, sync to 100%, update to new blocks, but the webserver will never start. In fact, the ...
RustyCamel's user avatar
1 vote
1 answer
70 views

How to make module Week07.EvenOdd fairer with player2 in case player2 wins the game

In week07 lecture Lars refers that Week07.EvenOdd contract is a bit unfair with player2 in the case of player2 wins . Why 😢 ? Well, player2 has to pay minAdaTxOut (2 ADA) to player1 in order to send ...
kindofdev's user avatar
  • 1,304
1 vote
0 answers
52 views

How Do I Deploy a Plutus Contract From the Browser?

I want the user to go to my website and enter some details into a form. This data should then be converted into an input for my parameterised smart contract (written in Plutus). I can do the website ...
KryptoKing's user avatar
0 votes
1 answer
52 views

How do you Connect ATALA to Plutus Smart Contracts [closed]

I think they use diffrent programming languages, but how can I use DID inside my Plutus contracts?
KryptoKing's user avatar
3 votes
3 answers
63 views

How to Make a Successful CIP?

I am finding the current state of Plutus is not suitable for my purposes, as such I wish to make a CIP. How do I make the CIP? What should I do to optimise the CIP and maximise the chances of it being ...
KryptoKing's user avatar
1 vote
1 answer
60 views

How to know which module to import?

Let's say my smartcontract needs BuiltinData. Quicksearch in documentation reveals that BuiltinData is in: Plutus.V1.Ledger.Api Plutus.V2.Ledger.Api PlutusTx.Builtins.Internal PlutusTx PlutusTx....
KugisMugis's user avatar
2 votes
3 answers
235 views

How to get a base 16 hex BuiltinString from getTxId

I am trying to find a way to inspect the base16 hash from a Tx on-chain using plutus. I get a BuiltinByteString from the txInputs here: getTxIdBBS :: TxInInfo -> BuiltinByteString getTxIdBBS txInfo'...
lley154's user avatar
  • 297
0 votes
2 answers
74 views

How can you use Ledger.Constraints in the Validator?

Hi i have noticed that you can get the unspent UTxOs in an wallet address using the Ledger. Constraints module. I want to know can I use it the same in the mkValidator as in the Endpoints? The general ...
KryptoKing's user avatar
1 vote
0 answers
60 views

How to use Endpoints and Schema

I doing the PPP but Lars does not cover Endpoints or schema declarations in sufficient detail. I imagine that this is a problem that Plutus devs must overcome, but I cannot find suitable documentation ...
KryptoKing's user avatar
1 vote
1 answer
51 views

Difference between `PlutusTx.TH.compile` and `PlutusTx.compile`?

I've been reading the official Plutus docs and saw that in the explanation about Template Haskell, there is information about PlutusTx.TH.compile, to use it for producing the quoted Plutus Core ...
Piotr N.'s user avatar
1 vote
1 answer
318 views

Get public key into PubKeyHash and use it in mustBeSignedBy

A user provides me with his wallet pub key as BultinByteString (or Haskell string, fine either way). From that, I need to get the PubKeyHash, but I am not sure how to hash it or if I need to hash it ...
Martin Drozdík's user avatar
2 votes
1 answer
117 views

Plutus: Integer->Value?

I give to Integer via an endpoint function, multiply them and give them to Constraints.mustPayToTheScript. For this I need the result to be converted into an Value. Does Anyone know how to do this? ...
John_Bones's user avatar
1 vote
0 answers
78 views

Exception from validator is not shown when using cardano-serialization-lib

I have this simple validator: newtype BreedConfig = BreedConfig { feeAddr :: PubKeyHash } deriving (Generic, ToJSON, FromJSON) PlutusTx.makeIsDataIndexed ''BreedConfig [('BreedConfig, 0)] ...
CryptoDinoAdamuso's user avatar
1 vote
1 answer
56 views

Referencing between scripts and application to state machines

(This is not related to CIP-33.) I want a validator to ensure another validator is also run. Naively I could construct one, get the hash, and hard code it into the other. Presumably two validators can'...
waalge's user avatar
  • 403

1
3 4
5
6 7
13