Skip to main content

NFT Contract with PSP34

Using the examples provided, you will build and deploy a NFT smart contract using ink! with functions commonly seen in NFT projects. The standard for NFT smart contract will be PSP34 which is very similar to ERC721 and it is written in ink!.

Prerequisites

This tutorial is suitable for developers with intermediate knowledge of ink! and basic understanding of Rust. Previous experience compiling and deploying an ink! smart contract will be beneficial, such as from following the previous Flipper contract tutorial:

TutorialDifficulty
Your First Flipper ContractBasic ink! - Basic Rust
Implement Uniswap V2 core DEXAdvanced ink! - Basic Rust

How to Start

To follow this tutorial you will need:

What will be used?

What will you learn?

  • Full implementation of NFT project in ink!.
  • Use Openbrush wizard to create PSP34 smart contract.
  • File structure for a smart contract with an additional trait.
  • Trait and generic implementation in separate files.
  • Unit test for smart contract.
  • Event handling.

Summary

I. OpenBrush wizard
II. Override mint() method
III Custom Trait for mint()
IV. PayableMint Trait definition
V. PayableMint Trait implementation
VI. Events