Hot answers tagged

14 votes
Accepted

What is a Redeemer?

From https://iohk.io/en/blog/posts/2021/04/13/plutus-what-you-need-to-know/: When validating an address, the script will access the data being carried by the output, the transaction being validated, ...
  • 1,507
11 votes

What is a Redeemer?

In simple terms, redeemer is the data that the user of the smart contract provides to the smart contract. In the simple UTxO model, redeemer is your signature. By providing your signature, you prove ...
6 votes

Can ADA locked on a script be staked?

An Ada address is made up of 2 separate credentials, one for payment and one for staking. These are both treated independently and one, the other or both can be script hashes instead of plain key ...
5 votes

What is a Redeemer?

Before (E)UTxO - There Was UTxO Understanding how a UTxO model works (such as BTC) may help you understand the implementation of (E)UTxO in Cardano. The UTxO Model A UTxO model, meaning: unspent ...
  • 201
3 votes
Accepted

Can ADA locked on a script be staked?

When you create an output with a script address, you can put whatever staking key you like on it. That staking key behaves exactly like staking keys do in all other outputs. Scripts can see staking ...
3 votes
Accepted

Plutus script execution at every end of epoch

As mentioned by Jey earlier, blockchains and smart contracts remain latent until triggered by a user submitted transaction. One way you could pull this off is that you could use the cardano-cli ...
3 votes
Accepted

Hash script data

The missing step would be converting the ScriptData into CBOR prior to hashing. In the case of ScriptDataNumber 42 the CBOR Hex is "182a" which is a bit simplified for Numbers vs more ...
  • 46
3 votes

How to get Policy Script for a specific policy-ID

As stated in other answers the minting policy script is used as a witness in the minting transaction and thus available on chain. Community members made tools for extracting such data. Here is a great ...
  • 1,505
3 votes
Accepted

How to Get Started with Cardano Native Script

You can find fairly extensive documentation on Cardano Native Script (aka Simple Script) here. In short, you can define a JSON object with a simple set of rules known as scripts to validate operations ...
  • 411
3 votes

Is it possible to call the `mkValidator` inside the same / another `mkValidator` function for script composibility?

In this case, when compiling your validator, compiler is trying to compute a value (which is only available after successfully compiled your validator) to complete compiling your validator, thus, it's ...
2 votes

Convert Plutus Address Credential to real-net address

Check here please: https://cardano.stackexchange.com/a/8808/6196 I answered a similar question in a different post
  • 160
2 votes
Accepted

Re-Implementing Policy Hashing in Python

It seems I was close, but the str.encode() function was not the correct one to use. Also a zero byte needs to be prepended to the data to be hashed. Thanks to user bwbush from the cardano forum for ...
  • 180
2 votes

Can ADA locked on a script be staked?

Yes. There are a few projects doing this, one of them is StakingDAO, which is in Catalyst Fund 7. I cannot give you details about how this is done, but I heard a few other people saying this is ...
2 votes
Accepted

How to build a script transaction if the validator expects it to be signed

I am afraid that via the cardano-cli, you will not be able to do that. Indeed the cli evaluates the execution units before you get to sign the transaction. Signatories are however available in the ...
  • 390
2 votes

How to obtain wallet addresses of stake pool delegators?

You were onto the right idea, try the blackfrost approach again. After calling /accounts/{stake-address}/addresses endpoint you will see a list of addresses linked to the stake address. Pick any ...
2 votes
Accepted

How to PlutusTx.compile work with multiple arguments to mkPolicy

We have wrapMintingPolicy :: UnsafeFromData r => (r -> ScriptContext -> Bool) -> WrappedMintingPolicyType. In the first case, we can spell out the details like: policy :: PaymentPubKeyHash ...
2 votes

Discovering the script source based on address

You can't get the Smart contract code starting from its address. As @zhekson already mentioned, smart contract addresses are hashes of the code (the serialization of the untyped Plutus core to be ...
  • 619
2 votes
Accepted

Script to only accept payments in 100 Ada

Cardano is a decentralized system, anyone can send anything to any address with any datum attached to it (no one can be censored). There is no way of stopping anyone from sending something to an ...
  • 1,505
2 votes
Accepted

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

You could use a combination of a plutus validator script with a specific datum and a minting policy. The minting policy just checks for the validator script has ran. And the validator script checks ...
2 votes
Accepted

Plutus Script Validation Metadata

If the NFT was minted using a transaction with metadata (cardano-cli), then the Plutus script won't be able to access this information. This is because you can only feed UTxOs to Plutus validator ...
2 votes
Accepted

Whats Your Mental Model For Monads?

Just read one definition: A monad is just the minimal amount of structure needed to overload a function composition in a way that performs an extra computation on the intermediate value. My ...
1 vote

checkDeadline function always returning False

Make sure you are adding your time constraints in your off-chain code as well. Here is an example of the constraints in the auction contract. Background: This can be kinda unintuitive to some people, ...
1 vote
Accepted

Script Witness Not Validating for Multisig

Finally I was able to sort this out. You can use this library to create the multisig: https://github.com/tango-crypto/cardano-wallet-js The code I ran was the following: multisig.js const { ...
1 vote

How to generate script address from plutus script cborhex

I've answered this here, but as a reference I'll copy my answer below: Plutus-Core script bytes are wrapped twice in a CBOR bytearray. Use the following steps to calculate the script address: unwrap ...
1 vote

Plutus script execution at every end of epoch

Scripts are executed as part of a transaction validation. That means: no transaction -> no script execution. The blockchain has no mechanism of timed or automatic script execution. What you can do ...
  • 1,356
1 vote

Discovering the script source based on address

Firstly, the address you referenced in your question is a Byron address, as pointed out by Samuel. Byron addresses are payment only, and are not associated with scripts (smart contracts) or staking. ...
  • 3,254
1 vote

Discovering the script source based on address

That's a Byron address, not a plutus script address. Likely being sent to an exchange.
1 vote

Contract deployment in week03 is failing with "beneficiary signature missing"

Turns out I was using the wrong vesting.addr - so the gotchas here were NEED TO "cabal repl" after updating the deploy.hs get the correct vesting.addr and use it in the give.sh and grab.sh ...
  • 31
1 vote

How to obtain wallet addresses of stake pool delegators?

What I do is query & grab all the data I need from: https://cardanoscan.io/pool/f8e64037e3917cd7cb94969a5374e11b9e6c939b4b69118a8eb4509f?tab=delegators And then send whatever I want using cardano-...
1 vote

Verifiying a digital signature in a Plutus script

You can use this function to verify signature from a validator

Only top scored, non community-wiki answers of a minimum length are eligible