This repository demonstrates how to create and manage NFTs on the Hedera network using smart contracts that leverage both the Hedera Token Service (HTS) and EVM capabilities. The project is structured as a three-part series, each focusing on different aspects of NFT management.
The repository contains three main smart contracts with corresponding test suites:
-
Part 1: Basic NFT Minting (
1-MintNft.sol
)- Demonstrates basic NFT creation and minting
- Shows how to interact with Hedera Token Service
- Basic token management operations
-
Part 2: KYC and NFT Updates (
2-KYCandUpdateNFT.sol
)- Implements KYC (Know Your Customer) functionality
- Shows how to update NFT metadata and properties
- Demonstrates token management with KYC requirements
-
Part 3: Advanced Token Controls (
3-PauseFreezeWipeDelete.sol
)- Implements token pause functionality
- Demonstrates account freeze capabilities
- Shows how to wipe tokens from accounts
- Handles token deletion
- Node.js (v16 or later)
- npm or yarn package manager
- A Hedera ECDSA testnet account with test HBAR
-
Clone the repository:
git clone https://github.com/hedera-dev/hts-evm-hybrid-mint-nfts.git cd hts-evm-hybrid-mint-nfts
-
Install dependencies:
npm install
-
Configure environment variables:
- Copy
sample.env
to.env
cp sample.env .env
- Fill in the following ECDSA private key variables in
.env
:PRIVATE_KEY
: Your Hedera account's private keyPRIVATE_KEY_2
: Secondary account private key for testing
- Copy
├── contracts/
│ ├── 1-MintNft.sol
│ ├── 2-KYCandUpdateNFT.sol
│ ├── 3-PauseFreezeWipeDelete.sol
│ └── hedera/
│ ├── HederaTokenService.sol
│ ├── IHederaTokenService.sol
│ ├── KeyHelper.sol
│ └── HederaResponseCodes.sol
├── test/
│ ├── 1-MintNFT.ts
│ ├── 2-KYCandUpdateNFT.ts
│ └── 3-PauseFreezeWipeDelete.ts
Each part of the series has its own test suite. You can run them individually or all at once.
Run all tests:
npx hardhat test
Run specific test suites:
# Part 1: Basic NFT Minting
npx hardhat test test/1-MintNFT.ts
# Part 2: KYC and NFT Updates
npx hardhat test test/2-KYCandUpdateNFT.ts
# Part 3: Advanced Token Controls
npx hardhat test test/3-PauseFreezeWipeDelete.ts
To see gas usage reports, prefix any test command with REPORT_GAS=true
:
REPORT_GAS=true npx hardhat test
This project uses Hardhat as the development environment. Common Hardhat tasks are available:
npx hardhat help
npx hardhat compile
npx hardhat clean
npx hardhat node
@hashgraph/sdk
: Hedera JavaScript SDK@openzeppelin/contracts
: Smart contract library@nomicfoundation/hardhat-toolbox
: Hardhat development toolshardhat
: Ethereum development environmentdotenv
: Environment variable management