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.
279
questions
0
votes
1
answer
102
views
Question about Plutus smart contract which always succeeds
Can anyone explain in detail why this script, https://github.com/james-iohk/Alonzo-testnet/blob/update-cabal-1.29.0/resources/plutus-sources/plutus-alwayssucceeds/src/Cardano/PlutusExample/...
3
votes
1
answer
105
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 ...
2
votes
2
answers
132
views
Automatically send funds out using a smart contract
I'm looking for an example or tutorial for how to write a smart contract which locks all ADA sent to it until a threshold of at least 1,000 ADA is reached. Once 1,000 ADA is reached, as much ADA as ...
3
votes
2
answers
276
views
Will Cardano ever have anything more than validators on-chain?
I have been looking into creating a blackjack game on the Cardano Blockchain. I started with learning Haskell, and writing a simple blackjack CLI game. It was heaps of fun and a bit of a learning ...
0
votes
2
answers
484
views
How to calculate the collateral minimun required for a Smart Contract Transaction, is always needed a Colateral?
I was asking to myself in which scenarios do I have to add a collateral when consuming an UTXO in a Script Address. I have just read the basics, but do you know if there is minimum needed in each ...
1
vote
2
answers
281
views
Nami wallet address format to addr_test1 format
lets say i have the following address for recieving funds:
addr_test1qzu70xm8hsez6nvmpgk4gjf48ev0y2hw5w7nf8xaxc658lzwczusckqvzzg630pxnzwj3pqza5q4c8r504ffq6v2zh6qgznxt7
when i try and get the wallet ...
0
votes
1
answer
268
views
NativeScript vs PlutusScript
In cardano serialization lib what is the difference between NativeScript and PlutusScript? Is there a way to convert from one to the other? I'm trying to load a minting policy script I made as a ...
3
votes
2
answers
505
views
Can a smart contract only be interacted with once
Im confused if a eUTXO can only be interacted with and used up once how can you do a NFT sale? If I were to make a smart contract to distribute NFT's from a wallet can that be interacted with by ...
1
vote
2
answers
91
views
Is it possible to make a NFT collection by having consumer mint the NFT's
I want to create a NFT collection in which the creator does not have to mint the NFT's but the consumer does through a smart contract that they interact with. Would this be possible to do while sill ...
1
vote
4
answers
676
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 ...
1
vote
0
answers
149
views
User interaction with smart contracts
I want my users to interact with my smart contracts. All transactions come from these users. There are no transactions - except for setting up - that come from my wallets. As entry point for this ...
1
vote
2
answers
169
views
Is there any script or smart contract which send tokens?
I wondering if is there any script o smart contract example which when i send X ada to a wallet after i receive a native token
1
vote
3
answers
250
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
400
views
The Plutus script evaluation failed
Running into this error when attempting to build a tx.
Command failed: transaction build Error: The following scripts have execution failures:
the script for transaction input 1 (in the order of the ...
0
votes
1
answer
107
views
Cardano-cli errors when submitting
I can build and sign a tx with no errors using:
cardano-cli transaction build --alonzo-era \
--testnet-magic 8 \
--tx-in 20445d5c68e1759f1371a86ecca773b76463fba3831f128fd2f7834de38ae6ec#0 \
--tx-in ...
2
votes
1
answer
74
views
Will the size of transaction be affected if the same input script is provided multiple times for different utxos?
If there are multiple --tx-in-script-file for the same plutus script file only with different utxos is that means that multiple times will be sent plutus script and that will affect the size of a ...
3
votes
1
answer
110
views
Do script addresses have a staking part? Is it possible to stake from smart contracts on Cardano?
I heard somewhere that staking from smart contracts may be possible on Cardano, and I wonder if that is because there is a staking part to script addresses on Cardano?
CIP 19 discusses wallet ...
7
votes
1
answer
287
views
Questioning Plutus API design decision
In Lecture 10 from the Plutus Pioneer Programm there is a replica of the Uniswap Smart Contract built on top of Plutus. It is actually part of the standard Plutus use cases Plutus Uniswap
To have a ...
2
votes
1
answer
184
views
Getting Validator Hash
I'm checking the Value locked by certain ValidatorHash of another script that I deployed. Does anyone know how to get Ledger.Address or ValidatorHash from Plutus or cardano-cli? I know the "...
2
votes
2
answers
81
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)
{-# ...
4
votes
3
answers
854
views
How to generate the address of a plutus script using Cardano Serialization Lib?
I am sending some smart contracts using the Cardano Serialization Lib and the nami wallet for signing, everything works fine, but I am not able to get the script address of a Plutus Script. I have ...
1
vote
2
answers
292
views
Is It possible to stake an nft on chain
Is there a way I can use smart contracts to stake nfts and back them with ada tokens. Similar to staking ada except also holding the nft in like a gallery or something.
0
votes
2
answers
340
views
How Do I include MP3/Mp4s into my smart contract?
How Do I include MP3/Mp4 capabilities in my smart contract?
Im interested in minting songs and short videos as CNFTs but I do not see any information online what so ever about how this can be done. ...
1
vote
2
answers
143
views
Airdrop Mechanism
I'm trying to find information about native token Airdrops. What is the mechanism?
For example, the user send 5 ADA to the wallet of the project and the smart contract will send you back (2.5 x Amount ...
2
votes
1
answer
58
views
How can I get a POSIXTime in the Contract monad?
I don't see any way to use IO in Contract and I don't see any functions for getting a POSIXTime from the things I can get within Contract.
6
votes
1
answer
645
views
Smart Contract NFT minting with Rarities
I'm trying to work out how an NFT collection might be sold on Cardano in the future, specifically by making use of smart contracts.
Let's say that I am creating a 10k pfp collection or something of ...
2
votes
1
answer
107
views
How do I export my .hs contract to .Plutus?
How do I export my .hs contract to .Plutus? Please provide step by step guidance.
8
votes
2
answers
505
views
I am completely new to Cardano eco system. To learn it from the absolute basic, where do I start?
This is a broad question but I am sure many might have this in their mind.
I am an upcoming blockchain engineer and my exposure to Cardano eco system is limited to buying the ADA cryptocurrency and ...
2
votes
1
answer
53
views
What is the use case of the mustSpendAtLeast constraint?
What I can figure out:
mustSpendAtLeast is basically just a wrapper around MustSpendAtLeast. This gets processed here, by adding a required value to this thing. These values get turned into outputs in ...
4
votes
1
answer
43
views
Is there a site (or one being developed) that contains a library of Plutus smart contracts?
Can someone direct me to a site where I can search for specific Plutus smart contracts? It would be useful both for inspiration, and also to reduce the amount of redundant work spent creating smart ...
0
votes
1
answer
500
views
How to split transaction into many different UTXOs?
Let's image I want to create a Plutus script, which takes Value as a parameter (ADA or any other coin with specific amount), and locks this value at script's output. How can I split this value into ...
4
votes
1
answer
194
views
How to handle datum in a decentralized way?
What is the best practice of storing the local state of an UTXO to be publicly visible on-chain?
Thinking about how application would function in the future I thought that in a good DeFi ecosystem all ...
2
votes
1
answer
70
views
Parse error on input ']' when running cabal build in my Plutus code
I have a code that compiles and runs well in the Plutus playground, but when I try to run cabal build I get an error when calling mkTypedValidator:
offerValidator :: Scripts.TypedValidator Offer
...
6
votes
2
answers
340
views
How to publish a smart contract on the blockchain?
Let's say I have a Plutus contract written up. How do I actually submit it to the blockchain and start interacting with it?
0
votes
1
answer
121
views
How to validate the correctness of another parameterized script address on-chain
I would like to write a factory script that can initialize another parameterized script address by sending it an NFT. The factory validator gets the parameters of the target script as redeemer and has ...
5
votes
1
answer
259
views
What is the relation of "ptr" with UTXO?
I am working on an app, I am using Nami wallet and cardano-serialization-lib.
When I query UTxO and decode it using cardano-serialization-lib, I get an object with only attribute is something called &...
2
votes
2
answers
272
views
Impossible to use extended keys with cardano-cli transaction build --required-signer flag
We are implementing the vesting contract from Plutus use cases via cardano-cli
In the validator script we have the pubKeyHash of the pubKey authorized to retrieve the funds.
When the owner of this key ...
0
votes
1
answer
160
views
Deploy a smart Contract on Alonzo testnet
Hi I have written a contract in Plutus and test it with PAB and Playground simulations.
The problem I am facing is I cannot find any proper documentation on how to deploy a contract on the test/main ...
1
vote
1
answer
108
views
I have a smart contract in Ethereum. Is there a way to migrate it over to Cardano?
I have a smart contract for an NFT in Ethereum and I'd like to put it in the Cardano eco system as well. How can I do that? Is there any 'smart contract bridge' through which I can port it over?
2
votes
1
answer
398
views
How to create a programmable NFT?
Is it possible to create a gif or video NFT? For example, every time the user clicks on the image, an animation plays once or on repeat over the image. I do not see any guides on this and would ...
3
votes
1
answer
74
views
What does it mean for a contract to "stop"?
I'm working through the week 4 homework for the Plutus Pioneer program. I've found an answer to the homework problem and now I'm trying to get a deeper understanding of the code. I've noticed that the ...
6
votes
2
answers
1k
views
How to run smart contracts in the Cardano Blockchain?
I know that since Alonzo was launched smart contracts can be published in the blockchain now, but I have no idea how to do it.
I have read some articles about the Plutus Application Backend though, it'...
8
votes
4
answers
364
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?
2
votes
1
answer
166
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 ...
4
votes
1
answer
303
views
What's the difference between programmable validators and smart contracts?
Charles Hoskinson indicated in this tweet that he favors the term "programmable validator" to the term "smart contract" with regard to Cardano.
Quoting the tweet Charles Hoskinson ...
3
votes
2
answers
256
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
290
views
Question about Datum and DatumHash
I have a question about findDatum which is used in some of example contracts in Plutus Pioneer Program. According to those lectures, this method is used to get Datum from its DatumHash. I wonder if it ...
1
vote
1
answer
161
views
Should I use Marlowe or Plutus to create my native token?
Should I use Marlowe or Plutus to create my token?
I also want to create a TCG in which my token will have an utility.
Where should i start? (tutorial, how-to, examples ...).
4
votes
2
answers
1k
views
How to deploy plutus/marlowe contract on Cardano blockchain
i am developing smart contract in plutus/marlowe playground which i compiled and simulate contracts successfully but now i want to deploy a contract on Cardano blockchain
3
votes
0
answers
56
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 ...