Overview
This comprehensive tutorial series takes you from deploying a pre-built NFT contract to implementing every standard extension. By the end, you’ll have a production-ready NFT contract.NFT Tutorial Series
Complete step-by-step NFT tutorial
What you’ll learn
NEP-171 Core
The foundational NFT standard for minting and transferring tokens
NEP-177 Metadata
Add metadata like names, descriptions, and images to NFTs
NEP-178 Approval
Allow marketplaces to transfer NFTs on behalf of owners
NEP-181 Enumeration
Query NFTs by owner, paginate results, and more
NEP-199 Royalties
Implement creator royalties for secondary sales
NFT Events
Emit events for indexers and frontends to track
Prerequisites
- Rust
- JavaScript
New to Rust? Start with the smart contract quickstart to learn the basics.
Tutorial steps
The tutorial is divided into progressive chapters:Pre-deployed contract
Start by minting NFTs using an already-deployed contract. No coding required!Begin tutorial →
Contract architecture
Learn the structure of an NFT contract and compile your first version.View chapter →
Minting NFTs
Implement the minting function to create new NFTs.View chapter →
Contract upgrades
Learn how to upgrade deployed contracts while preserving state.View chapter →
Enumeration
Add functions to query NFTs by owner and paginate results.View chapter →
Core standard
Implement transfers and the NEP-171 core standard.View chapter →
Events
Emit events for minting and transfers.View chapter →
Approvals
Allow marketplaces to transfer NFTs on your behalf.View chapter →
Royalties
Add royalty payments for secondary sales.View chapter →
Marketplace
Build a marketplace to buy and sell NFTs.View chapter →
Quick start example
Here’s a minimal NFT contract structure:NFT standards (NEPs)
NEP-171: Core NFT Standard
NEP-171: Core NFT Standard
The foundation for all NFTs on NEAR. Defines:
- Token ownership
- Transfer methods
- Balance queries
NEP-177: Metadata
NEP-177: Metadata
Adds metadata to NFTs:
- Token title and description
- Media URLs (images, videos)
- Contract-level metadata
NEP-178: Approval Management
NEP-178: Approval Management
Enables marketplace functionality:
- Approve accounts to transfer on your behalf
- Revoke approvals
- Query approved accounts
NEP-181: Enumeration
NEP-181: Enumeration
Query functions for NFTs:
- Get all tokens for an owner
- Paginate results
- Get total supply
NEP-199: Royalties
NEP-199: Royalties
Automatic royalty payments:
- Set royalty percentage
- Define multiple beneficiaries
- Paid on marketplace sales
Testing your NFT contract
Use NEAR Workspaces to test:Common use cases
Digital art
Create and sell unique digital artwork with royalties
Gaming items
In-game assets that players truly own
Collectibles
Trading cards, sports memorabilia, and more
Memberships
Token-gated communities and access passes
Tickets
Event tickets with verifiable authenticity
Certificates
Credentials, diplomas, and proof of achievement
JavaScript NFT example
Prefer JavaScript? Check out the JavaScript NFT implementation:Next steps
Start the tutorial
Begin building your NFT contract
NFT primitives
Learn about using existing NFT contracts
Auction tutorial
Build an NFT auction platform
FT tutorial
Learn about fungible tokens