This project gives a simple nft minter project for using the Plutus Platform.
Alternatively, use the Cabal Nix build if you want to develop with incremental builds, but also have it automatically download all dependencies.
Set up your machine to build things with Nix
, following the Plutus README (make sure to set up the binary cache!).
To enter a development environment, simply open a terminal on the project's root and use nix-shell
to get a bash shell:
$ nix-shell
Otherwise, you can use direnv which allows you to use your preferred shell. Once installed, just run:
$ echo "use nix" > .envrc # Or manually add "use nix" in .envrc if you already have one
$ direnv allow
and you'll have a working development environment for now and the future whenever you enter this directory.
The build should not take too long if you correctly set up the binary cache. If it starts building GHC, stop and setup the binary cache.
Afterwards, the command cabal build
from the terminal should work (if cabal
couldn't resolve the dependencies, run cabal update
and then cabal build
).
Also included in the environment is a working Haskell Language Server you can integrate with your editor.
See here for instructions.
Here, the PAB is configured with one contract, the SimpleNFT
contract from .src/Plutus/Contracts/SimpleNFT.hs
.
- Build the PAB executable:
cabal build simplenft
- Run the PAB binary:
cabal exec -- simplenft
This will then start up the server on port 9080.
- Check what contracts are present:
curl -s http://localhost:9080/api/contract/definitions | jq
You should receive a list of contracts and the endpoints that can be called on them, and the arguments required for those endpoints.
We're interested in the NFTContract
one.
You can create your own client with any client side framework/libraries and set up proxy to connect with the PAB without CORS issues. You can check out this repo for the react client of this simple NFT minter.
Thanks!