input-output-hk / plutus-apps

The Plutus application platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can we run PAB in non-simulator mode?

woofpool opened this issue · comments


This is more of a question than a bug, but I'm wondering if we can run the PAB in a non-simulator mode, so that the off-chain transactions against Testnet are actualized?

Steps to reproduce

In all the example code in plutus-apps, I see these imports

import Plutus.PAB.Simulator (SimulatorEffectHandlers)
import Plutus.PAB.Simulator qualified as Simulator

and the code that links in the Builtin contracts has handler function definitions like:

handlers :: SimulatorEffectHandlers (Builtin AppContracts)
handlers =
    Simulator.mkSimulatorHandlers def def
    $ interpret (contractHandler Builtin.handleBuiltin)

After setting up PAB services to run against Testnet backend, and invoking contract endpoints, I'm not sure that the transactions are submitting to Testnet. For instance, if I run code like the following, the PAB logs show a successful call, but I cannot see any transaction data in the Testnet cardano explorer. Is it because of the simulator handlers?

lock :: Promise () GameSchema GameError ()
lock = endpoint @"lock" @LockParams $ \(LockParams secret amt) -> do
    logInfo @Haskell.String $ "Pay " <> amt <> " to the script"
    let tx         = Constraints.mustPayToTheScript (hashString secret) amt
    void (submitTxConstraints gameInstance tx)

Expected behavior

PAB should be able to run for real against Testnet.

Follow up question

If PAB is only simulated, what is the ETA for release tag of plutus-apps with non-simulator handlers?

Hello @woofpool you can indeed use PAB to talk to the testnet, the steps can be found here. These are for an integration test but include everything you will need to sync your node and interact with the testnet chain. The only caveat is that you must update your pab-config.yml to match the one referenced in this PR.

I went through the steps to verify that the current tutorial's steps work from start to finish as long as you have that pab-config.yml.

Wish you happy testnet testing!

ezoic increase your site revenue