Hot answers tagged

19 votes
Accepted

What's the difference between "on-chain" and "off-chain" in plutus smart contracts?

I think the Plutus core specification gives pretty good explanation. Plutus Core code (and code intended for execution on a blockchain in general) can be executed in two different environments: off-...
Tim P.'s user avatar
  • 306
18 votes
Accepted

How can smart contracts interact each other?

It can't. But that doesn't mean different smart contracts can't interact. The interaction must simply happen in the same transaction. As an example, imagine you have some Uniswap-like liquidity pool ...
Lars Brünjes's user avatar
14 votes
Accepted

Plutus Pioneer Program - Lecture #1 Problem with cabal build

It looks like your cabal version is too old. You can make sure you have the right one if you first start a nix-shell at the top-level directory of the plutus-repository, then cd to the code folder of ...
Lars Brünjes's user avatar
13 votes

On-chain and off-chain for Plutus SCs

I know that the valididation script is onchain but the whole code is in one file, so how can later on some of that run offchain? Technically, everything you see in the file is off-chain code. It is ...
Mitchell Turner's user avatar
12 votes
Accepted

How to convert posixTime to slot number on Cardano Testnet

I share this code snippet with the converter. module Week03.Converter ( posixTimeToSlotTestnetConverter ) where import Ledger ( POSIXTime(POSIXTime), Slot(Slot) ) import Ledger.TimeSlot ( ...
kindofdev's user avatar
  • 1,284
11 votes
Accepted

What does @ prefix means?

It means type application. In this case, the function is polymorphic with the following type: logInfo :: forall a effs. Member (LogMsg a) effs => a -> Eff effs () by using TypeApplications ...
sorki's user avatar
  • 497
11 votes
Accepted

How to convert a cardano address into a public key hash?

I think you're looking for this: cardano-cli address key-hash --payment-verification-key STRING cardano-cli address key-hash --payment-verification-key-file FILE You should use your payment.vkey
georgeos's user avatar
  • 1,734
10 votes
Accepted

Hardcoding currency symbol and token name in validator script

The problem is in your sealsToken function, where you use a ByteString-literal. This is not possible if you want to compile to Plutus Script. A trick to work around this issue is to add an additional ...
Lars Brünjes's user avatar
10 votes
Accepted

Plutus Contracts Delegation

No, as the smart contract cannot produce blocks. However, funds within a smart contact can be delegated to a pool.
Marek Mahut - StakeNuts's user avatar
10 votes

Is there a good tutorial to mint Cardano NFT using plutus script?

I am answering my own question. After several days of studies and testing, I finally mint NFT using plutus script. Please find my articles below: https://edwardtam919.medium.com/how-to-mint-cardano-...
Tam Edward's user avatar
9 votes

How to access the current slot in a Plutus validator script?

Accessing any runtime information (including current slot) should not be possible in the validator by design. The reason is that transaction validity needs to be deterministic on construction. The ...
tobxy123's user avatar
  • 321
9 votes

Why do we need parameterized contracts? Can't we just use datum?

Yes. It's important to have both options though. Remember that the script address is derived from a hash of the compiled script code. So, if you parameterize parts of the script, the script address ...
Mitchell Turner's user avatar
9 votes
Accepted

Where does a smart contract exist, in EUTxO?

BACKGROUND: A smart contract is the combination of off-chain and on-chain code that interact to form some desired behavior. The on-chain smart contract code is called a script. The script can be ...
Mitchell Turner's user avatar
8 votes
Accepted

Why not just simply use Haskell instead of Plutus?

There are many reasons. For example: You need tooling for the communication between the on-chain and the off-chain code and many other tasks. You need tooling that generates code where the on-chain ...
Robertino's user avatar
  • 141
8 votes
Accepted

Chain Indexers with Stream Endpoints

Hi there (Kupo's maintainer here)! Given the use case you're describing, Scrolls seems the most suited solution at present -- especially because this is exactly the direction Scrolls is moving into. ...
KtorZ's user avatar
  • 495
7 votes
Accepted

What should I be doing to become a top tier Plutus Developer?(Besides Plutus-Pioneer-Program)

Fellow Plutus Pioneer here. Besides following the lectures closely and doing the homework (potentially several times), I would recommend digging into the actual plutus project, go through the source ...
Matthias Sieber's user avatar
  • 1,527
7 votes

I'm having issues with nix-shell

It may help to use IOHK's binary caches. You can set these up globally for your system by adding/creating these lines in /etc/nix/nix.conf: substituters = https://hydra.iohk.io https://iohk....
Matthias Sieber's user avatar
  • 1,527
7 votes
Accepted

When a UTxO becomes available for consumption?

That is correct. For a UTxO to be consumed it first has to exist on the blockchain. For it to exist on the blockchain the transaction that created it must exist in a block that has been confirmed by ...
nalyd88's user avatar
  • 1,732
7 votes

As I front-end developer, how should I start learning more about blockchain and should I start with Plutus?

Smart contracts on Cardano are actually developed using Haskell which is then compiled into Plutus Core by the Plutus Tx compiler. Plutus Core is a very low-level programming language and programming ...
Marek Mahut - StakeNuts's user avatar
7 votes
Accepted

Where is the on-chain code actually stored?

As stated by Samuel, the code that a validator runs to check whether a transaction is valid is sent and stored in the transaction body as an input. So all scripts, be they Plutus or Native scripts, ...
Fermat's user avatar
  • 1,812
7 votes
Accepted

How to publish a smart contract on the blockchain?

The plutus contract that you have written is in template haskell. Now to convert this to something that can be used on chain one needs to compiled it to plutus core. From an educational point of view ...
Fermat's user avatar
  • 1,812
7 votes
Accepted

How can I enforce a datum type to be correct?

Hopefully I'm following your question... I'm not aware of any type checks performed at validation, but I'm also not aware of any situation that a validator/script would need to spend resources ...
Mitchell Turner's user avatar
7 votes
Accepted

What is the Cardano's equivalent to the Ethereum's EVM?

There is no Cardano equivalent to the EVM because code execution on Cardano is mostly an off-chain process. In short, "smart contracts" is a bit of a misnomer because of how very different ...
zhekson's user avatar
  • 3,539
6 votes
Accepted

How can I write unit tests for Plutus contracts?

You can use the EmulatorTrace monad introduced in Lecture #4 for unit testing. You find examples of such tests in https://github.com/input-output-hk/plutus-apps/tree/main/plutus-use-cases/test/Spec .
Lars Brünjes's user avatar
6 votes

Why Strict Evaluation Operator "!" used in record definition implemented in Plutus Core?

This is correct. Plutus Core uses eager evaluation. You can see this in the first section of the Plutus Core Specification. I'm not sure why however I'd expect it is to allow you to accurately ...
Eddy Schauman-Haigh's user avatar
6 votes
Accepted

Confused by compilation message in plutus playground (week 5 pioneer program)

The Playground needs some boilerplate added to a module: mkSchemaDefinitions ''NAMEOFYOURSCHEMA mkKnownCurrencies []
Lars Brünjes's user avatar
6 votes

How do nodes access the validator code?

A validator script is compiled into Plutus Core by the Plutus Tx compiler. (It's actually a bit more complicated: see https://iohk.io/en/blog/posts/2021/02/02/plutus-tx-compiling-haskell-into-plutus-...
Johannes Sirsch's user avatar
6 votes

Referencing onchain contract as 3rd party

In short: In my understanding, the actual smart contracts are always shipped with the transaction, so you need all code that you want to execute. Merely the script hash ensures that actually the right ...
Johannes Sirsch's user avatar
6 votes

What are the ways of making NFTs unique?

NFTs have to be minted in some way or the other. In order to mint you will have to run a script with monetary policy for which you have to pay a fee, so might as well use that UTxO. You can mint ...
monolith's user avatar
  • 313
6 votes

On-chain and off-chain for Plutus SCs

The on chain part is basically every piece of code that runs when the nodes perform validations on whether you have the rights to spend UTOXs or you can mint or burn currencies (validator script and ...
AngelCastillo's user avatar

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