0

I've seen a tutorial where a smart-contract was uploaded to Cardano Blockchain using cardano-cli, so I would like to do the same thing using plutus PAB. How would I do that? The tutorial on lecture 6 from PPP only shows using a local machine, don't show how to do it in a blockchain.

2 Answers 2

1

PAB stands for Plutus Application Backend and as a backend is nothing more than a server responding to requests.

The PAB takes care of smart contract interaction through the creation of transactions.

Onchain we have scripts that lock outputs with logic. The scripts have a corresponding address linked to the hash of the script. When someone tries to spend an output at this address, the script has to evaluate to true given its inputs. In the PAB a contract comprises the logic on how to construct a transaction given one or more scripts. In general, we thus do not call it deploying the contract, since it lives off-chain.

A good thing to remember is that transactions in Cardano have no side effects, they are pure and deterministic in their behavior. Because Cardano uses the eUTxO model, wallets have to build transactions where in account model blockchains function call can be made that perform an action that might give access to all your funds.

So, to interact with a script, you just have to send funds to the corresponding script address and spend it according to the logic of it. It doesn't matter whether these transactions are constructed using the client, the PAB or even using JavaScript in the browser, the choice is yours. As to how to use the PAB for this, take a look at (1).

0

Before the Vasil HF (and without script references), there is no real deployment of smart contracts.

The way it works is that you can create outputs at your contract script address just like Michele described - by sending funds to the contract address.

But spending those outputs requires to supply the script to be attached to the transaction. It will be ran to validate if spending from that address is valid or not.

Until we don't have script references (Vasil HF) this is the process of using plutus scripts. Once, script references are available you can actually upload your Plutus script to the chain and are not required to attach it for every following spending transaction.

More information can be found here.

Your Answer

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

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