3

We can test Plutus smart contracts using runEmulatorTraceIO which emulates a blockchain and serves as an entry point to post transactions on it (or did I get this wrong?).

So if I can fully test my smart contracts only using runEmulatorTraceIO why do I need the PAB ? If the PAB is necessary to interact with the blockchain, why can I test my contracts without it ?

The purpose of the PAB has not been explained in a clear way, I think. I have tried to get information from the Plutus Pioneer Programm, IOHK and other sources but I'm still confused.

1 Answer 1

4

This is my understanding. the runEmulatorTraceIO was executing transactions on an "Emulated chain" and "Emulated Wallet" and had did not interact with the outside world or real Cardano Blockchain in testnet or mainnet (did not interact with outside endpoint).

The contract application containing business logic is written in Haskell has to run on a user computer and only the validator script written in Plutus runs is executed by the Cardano nodes. As per the blog PAB : Supporting dApp

The PAB helps with building the UTXO transactions in two ways:

  • Read path - That is, getting information from the chain, and reacting to events that happen on the blockchain.
  • Write path - This is where we actually construct the transactions that run the Plutus scripts

PAB thus provides means to interact with blockchain as if it is a file using the Haskell program and also helps to interact with the wallet.

1
  • Ok, so the emulator trace can be setup with a predefined set of transactions and then run. But it cannot be started and then execute transactions on the go.
    – Jey
    Dec 1, 2021 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.