-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dima Brook
committed
Nov 5, 2023
1 parent
e0115e3
commit 111068f
Showing
1 changed file
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
sidebar_label: '15. Metaplex Solana NFT Standard' | ||
sidebar_position: 15 | ||
image: /cover-image.png | ||
description: The Most Powerful Multi-Chain NFT bridge | ||
--- | ||
|
||
# Metaplex Solana NFT Standard | ||
|
||
- [Metaplex Solana NFT Standard](#metaplex-solana-nft-standard) | ||
- [Introduction](#introduction) | ||
- [Metaplex Overview](#metaplex-overview) | ||
- [Creating NFTs with Metaplex](#creating-nfts-with-metaplex) | ||
- [Metaplex NFT Standard Explained](#metaplex-nft-standard-explained) | ||
- [Code Snippets](#code-snippets) | ||
- [Comparison with ERC-721](#comparison-with-erc-721) | ||
- [Conclusion](#conclusion) | ||
|
||
|
||
## Introduction | ||
The world of non-fungible tokens (NFTs) has witnessed exponential growth, and Solana has emerged as a popular blockchain platform for NFT creation and trading. Metaplex, a decentralized protocol and community for building NFT marketplaces, offers a comprehensive set of tools and standards for creating NFTs on the Solana blockchain. In this document, we will explore the Metaplex NFT standard, providing an in-depth guide, code snippets, and a high-level comparison with the ERC721 standard. | ||
|
||
## Metaplex Overview | ||
Metaplex is a protocol built on the Solana blockchain designed to enable creators to mint, manage, and trade NFTs without relying on centralized marketplaces. It provides a suite of tools, including the Metaplex Candy Machine, Metaplex Storefront, and Metaplex Wallet, to simplify NFT creation and management. | ||
|
||
## Creating NFTs with Metaplex | ||
To create NFTs with Metaplex, you'll need to follow these steps: | ||
a. Set up a Solana wallet: You'll need a Solana wallet to store and manage your NFTs. | ||
b. Install the Metaplex CLI: The Metaplex Command Line Interface allows you to interact with the Metaplex ecosystem, including creating and managing NFTs. | ||
c. Mint your NFT: You can use the Metaplex CLI to mint your NFTs, specifying attributes such as name, symbol, and metadata. | ||
d. List your NFT for sale: Once minted, you can list your NFTs for sale in a Metaplex marketplace. | ||
|
||
## Metaplex NFT Standard Explained | ||
The Metaplex NFT standard on Solana is designed to define the structure and properties of NFTs created on the Solana blockchain. It includes the following key components: | ||
a. **Mint**: A Metaplex Mint represents a series of NFTs with similar properties, such as artwork from the same artist or a specific collection. Each Mint is associated with a Token, which can be used to represent individual NFTs within that Mint. | ||
b. **Token**: A Metaplex Token represents a unique NFT with its own set of attributes and properties. Each Token is minted from a specific Mint and has a distinct owner. | ||
c. **Metadata**: Metadata in the Metaplex standard refers to information about the NFT, such as its name, description, image URI, and additional attributes. Metadata is stored off-chain to reduce the cost of minting NFTs on Solana. | ||
d. **Master Edition**: The Master Edition represents the authoritative version of an NFT and is associated with a Mint. It includes additional information, such as the total supply of NFTs in that Mint. | ||
|
||
## Code Snippets | ||
|
||
a. Creating a Metaplex NFT: | ||
|
||
```ts | ||
// Import necessary Solana and Metaplex libraries | ||
const anchor = require('@project-serum/anchor'); | ||
const { Wallet, SystemProgram, Keypair, Connection, Transaction } = require('@solana/web3.js'); | ||
const { web3, Token, utils } = require('@project-serum/serum'); | ||
|
||
// Create a Solana wallet and connect to the network | ||
const provider = anchor.Provider.local(); | ||
const connection = new Connection('https://api.devnet.solana.com'); | ||
|
||
// Generate a Mint and Token account | ||
const mint = new anchor.web3.PublicKey('your-mint-public-key'); | ||
const token = new anchor.web3.PublicKey('your-token-public-key'); | ||
|
||
// Create a new Metaplex Token | ||
const tokenAccount = await anchor.web3.Keypair.generate(); | ||
const transferAuthority = anchor.web3.Keypair.generate(); | ||
|
||
// Initialize and mint the NFT | ||
const tx = anchor.web3.SystemProgram.transfer({ | ||
fromPubkey: provider.wallet.publicKey, | ||
toPubkey: tokenAccount.publicKey, | ||
lamports: 10000000, // Solana fees | ||
}); | ||
|
||
const { txid, slot } = await connection.sendTransaction(tx, [provider.wallet, tokenAccount, transferAuthority]); | ||
|
||
// Your Metaplex NFT is now created and minted | ||
|
||
``` | ||
|
||
b. Transferring a Metaplex NFT: | ||
|
||
```ts | ||
// Import necessary Solana and Metaplex libraries | ||
const { Token, TOKEN_PROGRAM_ID, Account } = require('@solana/spl-token'); | ||
const anchor = require('@project-serum/anchor'); | ||
const { web3, Token, utils } = require('@project-serum/serum'); | ||
|
||
// Initialize the sender's wallet and the recipient's wallet | ||
const senderWallet = new anchor.web3.PublicKey('sender-wallet-public-key'); | ||
const recipientWallet = new anchor.web3.PublicKey('recipient-wallet-public-key'); | ||
|
||
// Initialize the Metaplex Token | ||
const tokenAccount = new anchor.web3.PublicKey('your-token-public-key'); | ||
|
||
// Transfer the Metaplex NFT | ||
const token = new Token(connection, tokenAccount, TOKEN_PROGRAM_ID, provider.wallet.payer); | ||
const recipientTokenAccount = new anchor.web3.PublicKey('recipient-token-account-public-key'); | ||
|
||
await token.transfer(tokenAccount, recipientTokenAccount, [provider.wallet.payer], 1); | ||
|
||
// Your Metaplex NFT is now transferred to the recipient | ||
``` | ||
|
||
## Comparison with ERC-721 | ||
|
||
The Metaplex NFT standard on Solana is conceptually similar to the ERC721 standard on Ethereum but is designed to take advantage of Solana's high-performance blockchain capabilities. Here's a high-level comparison: | ||
|
||
a. Speed and Cost: Solana's consensus mechanism allows for faster transaction confirmation and lower fees compared to Ethereum's ERC721, making it more cost-effective for minting, transferring, and trading NFTs. | ||
|
||
b. Data Storage: Metaplex leverages off-chain metadata storage to reduce on-chain data bloat, while ERC721 stores most metadata on-chain. This reduces storage costs on Solana. | ||
|
||
c. Interoperability: Both standards support NFT interoperability, enabling NFTs to be moved between different marketplaces and applications. | ||
|
||
d. Community and Ecosystem: Metaplex is an emerging ecosystem on Solana, while ERC721 has a more extensive and mature ecosystem on Ethereum. | ||
|
||
## Conclusion | ||
The Metaplex NFT standard on Solana provides a robust and efficient framework for creating and managing NFTs, leveraging the performance benefits of the Solana blockchain. With its developer-friendly tools and active community, Metaplex is an attractive choice for artists, creators, and developers looking to explore the world of NFTs. Understanding the Metaplex standard and how it compares to ERC721 is crucial for those seeking to make informed decisions about NFT creation and management on Solana. | ||
|
||
|
||
|
||
|