Questions tagged [smart-contract]

A digital agreement that specifies where funds/tokens/assets should go, and under what conditions they will be sent, executing a deal only when all the conditions are met.

Filter by
Sorted by
Tagged with
0 votes
1 answer
19 views

How to have a contract on chain for extended periods of time?

In PPP Larz explains that there's a limit to how long a contract can remain on chain, what is that limit and how do I go about extending it?
0 votes
1 answer
17 views

What is a Semantics Model?

In the eUTxO resharch paper by iohk, it mentioned that the eUTxO model is able to enable both expressive smart contracts and keep the simple sematic simplicity of the utxo model. But what does sematic ...
1 vote
1 answer
103 views

Pool Rewards distribution via SmartContract

For the Pool I run I would like to setup a SmartContract which automatically claims the rewards and sends a certain percentage to each of three organisation I support. Is such a thing possible with ...
1 vote
1 answer
16 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, ...
0 votes
1 answer
98 views

What is the correct way to compare two instances of Value data type?

Question What is the correct way to compare two instances of Value data type? Context I would like to check if outgoing transaction identified by PubKeyHash has the same Value as Value which was ...
2 votes
2 answers
47 views

Is there a place where we can find the Haskell library for Marlowe?

I investigated some Code examples, in haskell for Marlowe smart-contract, and used the "cabal repl" with the " :i " command, like this: *Main> :i ValueEQ type Observation :: * ...
0 votes
0 answers
21 views

guess game stuck in "Waiting for script to have a UTxO of at least 1 lovelace"

I have this program which uses the guessGame example, in the testnet, which gets stuck at "Waiting for script to have a UTxO of at least 1 lovelace" when executing "guess": main=...
2 votes
1 answer
30 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
0 answers
10 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 ...
1 vote
4 answers
587 views

Building a transaction using Nami api wallet and cardano-client-lib

I am trying to build a transaction with the libary of cardano-client-lib (java sdk). Inorder to build a transaction one needs to provide an account object which can only be created with the mnemonic ...
3 votes
2 answers
133 views

How to return funds from a smart contract

If I have assets (can be just ADA for simplicity) locked in a contract, how can I release the funds to the previous owners most efficiently? Some more context regarding the question. I created a pay ...
1 vote
1 answer
41 views

Cardano marketplace that allows selling a batch of NFTs

anyone aware of a cardano marketplace that allows us to mint NFTs in batches that will launch with smart contracts launch or at least close to the launch? So e.g. 1 policy ID, 10000 asset names that ...
1 vote
3 answers
172 views

How to deploy a marlowe smart contract on cardano

I'm a beginner, I have the haskell code and I wnat to know the following steps, I couldn't find specific information how can i deploy a smart contract on the mainet or testnet.
0 votes
1 answer
28 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
2 answers
92 views

Is there an OpenZeppelin like library for Cardano?

Developers on EVM compatible blockchains can make use of battle-tested libraries of smart contracts using https://github.com/OpenZeppelin/openzeppelin-contracts I'm thinking about having a basic ...
0 votes
1 answer
30 views

How to Securely Serialise a Plutus Smart Contract Endpoint?

Assuming I made an arbitrary smart contract and want to serialise the endpoint after I have the validator hash and address hash, what should I do to ensure that the serialisation is as safe as ...
0 votes
1 answer
16 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
1 answer
16 views

How can I check the origin of a Token?

A smart contract minted a Token and send it to my wallet, after a time has passed how can I check if that smart-contract in specific did mint the token?
1 vote
1 answer
30 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, ...
2 votes
1 answer
58 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 ...
0 votes
1 answer
25 views

Whats the function to get the current time in Plutus?

Im using the time module in the ledger class to do some custom validation logic, but everything is done as intervals and I cant find the function that gets the current time. What is it?
0 votes
2 answers
41 views

How to securely call Blockfrost or other API service from Smart Contract?

I just spent a few days trying to find a way to access account data from a smart contract using only plutus. Turns out IOG has yet to put that functionality in (at least that's how I understand it) ...
0 votes
1 answer
15 views

How to get transaction info of a pkh?

Given a PubKeyHash (pkh) how can I get the history of that pkh transactions from within a plutus contract?
0 votes
1 answer
10 views

How To Get Address Transaction history into Smart Contract?

If I want the smart contract to alter functionality depending of the history of the signing address, how do I access the history from within the smart contract?
1 vote
1 answer
41 views

How to create a smart contract constant variable?

I am using state machines to create a smart contract. How can I create a variable that will be defined by the user when it runs the first step of the state machine and that then can't be modified ...
0 votes
1 answer
10 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 ...
9 votes
2 answers
436 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
1 answer
14 views

Why does forgeContract receives a PubKeyHash?

The forgeContract is responsible for minting NFT's and in the arguments we have a token name and amount, why do we have a public hash key for minting NFT?
1 vote
3 answers
57 views

Advanced Payment Integration

I understand this is all new and still very early but I'm wondering if more advanced payment integration is possible. I went through the example of accepting payments, but I have an app releasing soon ...
0 votes
1 answer
53 views

valuepaidto - 3 tokens (plus existent) - how to limit the maximum

I'm trying to verify if X tokens are paid to the signer in a smartcontract. I'm using: numTokens = assetClassValueOf (valuePaidTo info (owner ustate)) (AssetClass(policyToken contractInfo, TokenName(...
2 votes
2 answers
33 views

ADA handle NFT royalty address

Is it possible to use an ADA handle as the address for NFT royalties? I’d like a way of changing the address that royalties get sent to if I decide to sell my project in the future. Maybe it would be ...
3 votes
2 answers
34 views

How to Get the Script Address of A Smart Contract?

Once I have written up the smart contract how to I get the script address value to be able to interact with the script whilst its on chain?
1 vote
0 answers
16 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
40 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
1 answer
27 views

How Long Can A Contract Stay On Chain After Validation?

So I have a smart contract that will validate and do some action X but I then require it to wait for user action for a time T and then perform action Y. Questions: What are the limits on T (how long ...
0 votes
1 answer
41 views

Does the redeemer have to be from a wallet address/contract?

Could a contract be programmed such that the redeemer seemingly comes from nowhere from what the node / someone monitoring the blockchain could tell? I am thinking if you gave the contract some ada ...
0 votes
0 answers
8 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 ...
0 votes
0 answers
10 views

How to Look Up a Token Policy ID from The Smart Contract Validator

I have attached a token to the datum and sent it to the smart contract, now I need the validator to check that the token has a certain policy ID before it allows the contract to proceed. How do I do ...
3 votes
1 answer
57 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 ...
0 votes
2 answers
21 views

What are the options for Bitcoin integration on Cardano?

What are the options for Bitcoin integration on Cardano? Is there a way to allow users to deposit BTC, have smart contract rules that adjust balances (based on signed app specific transactions), ...
1 vote
0 answers
9 views

How to Validate A Smart Contract Twice?

I have a smart contract I want to validate at a certain date. Exacute its logic and then revalidate on a second date. The trick is I only want it to be signed once. How do I do this? can I just add ...
0 votes
0 answers
10 views

How to Sign a Smart Contract From a Smart Contract?

I want to run a smart contract (that the user signs) and then wait 10 days and send some ADA from the user's wallet to another address. I can do the waiting with POSXIT Time but if there is not ...
1 vote
0 answers
12 views

How to Send A Token to an Smart Contract Alongside a Datum?

I asked another question (How to Make Sure A Contract Is Signed By a Certain Party?) and got the answer I expected. It raised the secondary Question of how to send a token with a datum to a smart ...
2 votes
1 answer
41 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
28 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
2 answers
47 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 &...
1 vote
1 answer
23 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
2 answers
59 views

Retrieve only digit from TokenName and use onchain

How can I make the following function to retrieve only digit portion from the TokenName and use it on chain? For example I want to retrieve the number 123 from "AAA123" (TokenName) {-# ...
7 votes
4 answers
250 views

What are the best solutions for randomness in Cardano?

I would like to create a gambling Dapp and for this I need a provably fair RNG. What are the best solutions for provably fair randomness in Cardano Will Cardano add Chainlink VRF in the future?
3 votes
1 answer
89 views

Best practice for testing smart contract

Let's say you have your haskell code ready to test as a smart contract on the testnet, what is the best practice to go about testing if your smart contract works as intended? Does the same process ...

1
2 3 4 5