Getting started with Plutus Tx
Plutus-Tx-Template repository
The easiest way to create a Cardano smart contract is to start with the template provided in the Plutus-Tx-template repository. Follow the instructions in the README file to setup your environment and run the example project.
Overview of creating a validator script using the template repo
- Clone the Plutus-Tx template repo.
- Install Nix. See the Nix setup guide for installing and configuring nix to work with projects at IOG. Add the IOG binary cache to your nix configuration to speed up builds.
- From the repo, run
nix develop
(selecty
for all question prompts). - Run
cabal update
. - Using
cardano-cli
, generate a pubKeyHash. - Set posix time and pubKeyHash in
Main.hs
. - Run
cabal build plutus-tx-template
. - Run
cabal exec plutus-tx-template
.
Expected result
The expected result is that the above process will have created the validator.uplc
script.
Deploying and interacting with your script
Use cardano-cli
to deploy your script.
Use an off-chain framework, such as cardano-transaction-lib and mesh, to interact with your script.
All these are based on the Cardano API, a low-level API that provides the capability to do the off-chain work with a local running node.