Shyft
Start BuildingSupportWebsite
  • Welcome
    • 👋Introducing Shyft
    • 🏗️Start Building
  • Solana Infrastructure
    • 🚁Shyft RPCs
  • Yellowstone gRPC Network
    • Decoding gRPC Latency
    • ⚡gRPC Docs
      • Introduction
      • Authentication
      • Subscribe Requests
      • FAQ
      • Getting Started
        • Initializing the Yellowstone Client
        • Making a gRPC connection
        • Adding a Reconnection Mechanism
        • 🔥Replaying Slots with Solana yellowstone gRPCs
        • Modifying your Subscribe Request
        • Closing a gRPC Connection
      • Subscribing to Transactions
        • All Transactions of an address
        • Subscribing to all transactions of a Liquidity Pool
        • Subscribing to all transactions of multiple addresses
        • Subscribing to all transactions of a Token
      • Subscribing to Accounts
        • Account Updates for a Program
        • Account Updates for an Address
        • Account updates using memcmp
      • Streaming Blocks & BlocksMeta
        • Streaming Block Updates
        • Subscribing to BlocksMeta
      • Modifying & Unsubscribing
  • Solana defi data
    • DeFI APIs
      • Get Pool By Address
      • Get Pools By Token Pair
      • Get All Pools for a Token
      • Get Liquidity Details of a Pool
  • Callbacks
    • ☎️What are Callbacks?
      • Transaction Callbacks
      • Account Callbacks
    • 📔Callback APIs
      • Response Structure
      • List Callbacks
      • Register callback
      • Remove callback
      • 🔥Pause a callback
      • 🔥Resume a callback
      • Update Callbacks
      • Add Addresses
      • Remove addresses
  • Solana Super Indexers
    • 🌩️GraphQL APIs
      • Getting Started
      • Building Queries
      • Paginating Response
      • Applying Filters
      • Ordering and Sorting Data
    • 📀Case Studies
      • Tensor
        • Get Active Listings of a Wallet
        • Get Active Bids of a Wallet
        • Get Active Listings of a Collection
        • Get all Bids of a Collection
        • Get all Pools of a Margin Account
        • Get all Pools by Owner
      • Raydium
        • Get Pool By Address
        • Get Pools By Token Address
        • Get Pools Created Between Time
        • Get Pool Burn Percentage
        • Get Liquidity Details of a Pool
        • Get Pool and OpenBook Market Info
        • Get Token Supply Percentage In Pool
      • Orca Whirlpool
        • Get Pool by Address
        • Get Pool by Token Address
        • Get Positions for a Pool
        • Get Positions for a Wallet
        • Get Liquidity Details of a Pool
      • Kamino
        • Get Borrow Details of a Wallet
        • Get Deposit Details of a Wallet
        • Get Reserve Details
      • Cross Marketplace Queries
        • Get active listings across marketplaces for a wallet
        • Get listings for a collection across marketplaces
        • Get floor price of a collection
      • Cross Defi Queries
        • Fetch Liquidity Pools for Token
      • Native Staking
        • Get Stakes for a Wallet
        • Get Stakes For Validator
      • Governance/Realms
        • Get DAO Token Owners
        • Get Proposals For Governing Mint
        • Get All Proposals For DAO
        • Get DAO Treasury Info
        • Get All Active Proposals For Wallet
      • Meteora
        • Get All LB Position Pairs
        • Get Position of a User Wallet
        • Get Pool by Token Addresses
        • Get All Deposits for a User
        • Get All Withdraws for a User
        • Get All Fees Claimed by a User
        • Get All User Positions and Deposits for a Pool
        • Get All User Positions and Withdrawals for a Pool
      • Fluxbeam
        • Get Pool by Address
        • Get Pool by Token Addresses
      • Drift
        • Get User account for Delegate
        • Get User accounts based on authority
        • Get User details based on Referrer
        • Get Borrow/Deposit Amount for an User
        • Get PrepPositions for an User Account
        • Getting OrderId and userOrderId
        • Get OpenOrders for a User Account
      • 🔥Pumpswap
        • 🔥Get Pool by Address
        • 🔥Get Pool by Creator Address
        • 🔥Get Pools by Token Addresses
      • Raydium Launchpad
        • Get Bonding Curve Details by Pool Address
        • Get All Pools for a Creator
        • Get Pools by Token Addresses
        • Get Migration details of a Pool
  • Solana APIs
    • API Reference
    • Transactions
      • Parsed Transaction Structure
      • Transaction APIs
        • History
        • Parse Signature
        • Parse Multiple Signatures
        • Send
        • Send Multiple
    • NFT
      • 🔥Create Gasless
      • Create
      • Read All
      • Burn
      • 🔥Burn Multiple NFTs V2
      • Update
      • 🔥Create NFT from Metadata
      • 🔥Read Wallet Nfts
      • 🔥Read Selected NFTs
      • 🔥Get NFT Owners
      • 🔥Update NFT Metadata Uri
      • 🔥Update V2
      • Search
      • Transfer
      • Transfer Multiple NFTs
      • Mint
      • Read
    • Wallet
      • Get Balance
      • Get Token Balance
      • Get All Tokens Balance
      • Get Portfolio
      • Resolve Address
      • Get All Domains
      • Get Stake Accounts
    • Fungible Tokens
      • Create
      • Mint
      • Burn
      • 🔥Update
      • Get Token Info
      • Transfer
      • Airdrop
  • 📘Dev Guides
    • 📀gRPC Case Studies
      • Pumpfun
        • Streaming and Parsing Pump.fun Transactions
        • Streaming and Parsing Pump.fun Accounts
        • Detecting new Token launches on Pump.fun
        • Detecting Buy/Sell Transactions on Pump.fun
        • Detecting tokens migrating from Pump.fun to Pump Swap AMM
      • PumpSwap AMM
        • Streaming and Parsing Pump Swap Transactions
        • Streaming and Parsing Pump Swap AMM Accounts
        • Detecting Buy/Sell Transactions on Pump Swap AMM
        • Detecting tokens migrating from Pump.fun to Pump Swap AMM
      • Raydium AMM
        • Streaming and Parsing Raydium AMM Transactions
        • Streaming and Parsing Raydium AMM Accounts
        • Detecting Buy/Sell Transactions on Raydium AMM
        • Detecting new Pools on Raydium AMM
      • Raydium CLMM
        • Streaming and Parsing Raydium CLMM Transactions
        • Streaming and Parsing Raydium CLMM Accounts
      • Raydium CPMM
        • Streaming and Parsing Raydium CPMM Transactions
        • Streaming and Parsing Raydium CPMM Accounts
      • Raydium Launchpad
        • Streaming and Parsing Raydium Launchpad Transactions
        • Streaming and Parsing Raydium Launchpad Accounts
      • Meteora DAMM v2
        • Streaming and Parsing Meteora DAMM v2 Transactions
        • Streaming and Parsing Meteora DAMM v2 Accounts
Powered by GitBook
On this page
  • Why choose SHYFT?
  • Common Terms used while using SHYFT Marketplace APIs
  • Pre-requisites for this Tutorial.
  • Setting up a marketplace
  • Updating an existing Marketplace using SHYFT APIs
  • Resources

Was this helpful?

  1. Dev Guides
  2. Solana
  3. Build NFT Marketplace

Build your first NFT marketplace

This is about NFT marketplaces and how you can build them with SHYFT Marketplace APIs

Last updated 2 years ago

Was this helpful?

Welcome to the first episode of the marketplace series.

If you have already gone through this part of the series, for the next part of the series.

Why choose SHYFT?

NFT Marketplace, like a regular marketplace, is a digital platform where we can store, list, and sell Non-Fungible Tokens (or NFTs). Users need a Crypto Wallet to connect to the marketplace, trade, and showcase their most desirable NFTs. These tokens can be of any type, such as pictures, Digital Art, Music, writings, or anything else, and generally, they are available for trading, purchase, or even auctions starting at a certain price.

SHYFT’s Marketplace API holds the upper hand over other regular marketplace APIs in certain aspects:

  • No backend infrastructure is needed: A few API calls in the front end are good to take your product to market and scale without hassle.

  • Set any currency: Choose SOL or any SPL token(USDC, mSol, RAY, or create your own) as the marketplace currency.

  • Super fast reads for better UX: Cached NFTs and metadata allow lightning-fast reads, ensuring your users a smooth experience.

  • Marketplace Stats: Access your marketplace’s detailed stats in real-time, manually tracking sales is no longer required.

  • Auctions and Bidding: Instantly enable on-chain auctions and bidding on NFTs.

  • Royalty Distribution: Our APIs honor the original creators by making sure they get their royalty.

Common Terms used while using SHYFT Marketplace APIs

Shyft creates escrow-less marketplaces, where the NFTs remain in a user's wallet until the sale is complete. There are a few important concepts to understand and efficiently use these APIs.

authority: The account which has the permission to update the marketplace properties and execute a withdrawal from the marketplace treasury. By default, the marketplace creator is the authority.

Creator: The account which pays the gas fee for executing the marketplace creation instruction.

Fee Recipient: The destination account address, that will receive the funds whenever they are withdrawn from the marketplace treasury.

Fee Payer: An account that is used to pay for Solana fees for the seller and buyer if the marketplace chooses to execute the sale in the background.

Transaction Fee: The percentage of every sales transaction amount that will be deposited in the marketplace treasury. By default, all the Shyft-created marketplaces have a 2% transaction fee.

Treasury: The marketplace treasury is an on-chain account where all the transaction fee received by the marketplace gets deposited and remains there until withdrawn.

Currency Address: The SPL token that is used as the currency in the marketplace. SOL is the default currency, if not provided while marketplace setup.

Currency Symbol: The on-chain symbol of the SPL token currency of the marketplace.

Listing: Before an NFT can be sold and bought by a user, it has to be listed for sale in the marketplace at a certain price. Listing represents an NFT on sale.

List State: An on-chain address where all the transactions that happen on an NFT listing are stored. This is unique for each NFT listing created. Generated at the time of list creation.

xxx_wallet: In the following doc, there are API input parameters ending with the wallet. These are essentially the accounts that pay the gas fee of the API's operation.

Pre-requisites for this Tutorial.

Authentication: Getting your Shyft API key

A phantom Wallet browser extension

We will need the Phantom wallet browser extension, you can download it from the link below.

Setting up a marketplace

The API Endpoint and its parameters

The API endpoint for the create request

POST https://api.shyft.to/sol/v1/marketplace/create

The Request Header

{
    "Content_Type": "application/json",
    "x-api-key": "YOUR SHYFT API KEY"
}

The Request Parameters (body)

{
    "network": "devnet",
    "creator_wallet": "EijtaNNHqqaPmWwAmRiCR1TC6gSPnqkoodQd2BLFpA8T",
    "authority_address": "EijtaNNHqqaPmWwAmUi8f1TC6RiCRoodQd2BLFpA8T",
    "currency_address": "3S8nRiCRhewv8jdy54xqxMt2GekpCDFVF3zkWAF2EThf",
    "fee_payer": "EijtaNNHqqaPmWwAmUi8f1TC6gSPnq123dQd2BLFpA8T",
    "fee_recipient": "EijtaNNHqqaPmWwasd8f1TC6gSPnqkoodQd2BLFpA8T",
    "transaction_fee": 10
}

Details of the Parameters Used

  1. network (Required Parameter) : Selects the Solana blockchain network instance, can be devnet,testnet or mainnet-beta.

  2. creator_wallet (Required Parameter) : The Wallet Address used for creating the marketplace. This wallet will be responsible for paying the gas fees during the create marketplace transaction.

  3. authority_address : Wallet address for the wallet which will have all the master controls over the marketplace. This wallet will have access to all the critical operations of the marketplace such as the authority to update the wallet, withdraw units from the treasury, etc. By default i.e. if left blank, the value of this field will be the creator_wallet.

  4. currency_address : The address of the SPL Token which will be used for the marketplace transaction. If no token address is provided, the default value for this field is SOL.

  5. fee_payer : An account that is used to pay for Solana fees for the seller and buyer if the marketplace chooses to execute the sale in the background. By default, it is the value of the creator address.

  6. fee_recipient : The destination wallet address that will receive the funds whenever they are withdrawn from the marketplace treasury.

  7. transaction_fee : This is the percentage, not a number. This indicates the percentage of the sale amount for each sale transaction, which is deposited in the marketplace treasury. By default, its value is 2%.

We can directly execute this API call using JavaScript or any programming language, or we can create and use a form to collect all the values required for executing this API call. Once this API request is successfully executed, we should have a response that should look somewhat like this.

{
  "success": true,
  "message": "Create marketplace transaction generated successfully",
  "result": {
    "network": "testnet",
    "address": "5p4Bua5tSsSoasdRJ95I1w5DiMSPfWcvMvnMVjPpZ6sJUb",
    "treasury_address": "EUUT8hasdadYKcW41HoNWeiTuARv33fwRPn416enRxsR",
    "fee_payer": "EijtaNNHqqaPmWwAmUi8f1TC6RiCRoodQd2BLFpA8T",
    "fee_recipient": "Eb3ykuiCtvGcqasdRCASThFf4EUxrL7k3TZsytWkXTBe",
    "fee_recipient_account": "Hssq28jWr8FTxwUwundqpvxbYtrLZEa6vPFaQiVUKDMf",
    "currency_address": "3S8nRiCRhewv8jdy54xqxMt2GekpCDFVF3zkWAF2EThf",
    "currency_symbol": "SFC",
    "creator": "EijtaNNHqqaPmWwAmUi8f1TC6RiCRoodQd2BLFpA8T",
    "transaction_fee": 10,
    "authority": "EijtaNNHqqaPmWwAmUi8f1TC6RiCRoodQd2BLFpA8T",
    "encoded_transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAgOeIxYh8iwxnr/Z8an9vWgkVkEuiJMj33J4B142NukBHgPrdnS7vUWJWdlVRJkN9IyKmqznjwdiF1CUVP5Yqgf4x9LP9K1v1msPEvvdrPLdStXobeMW9+Q08bSktHrXTZWjA9WxBjAnhHQxRwIoIJgxIEKxES6EhU3CearoA/FNkDL2Tz8ECwUGHyaWuUik2ukTTolCWNP5F9oXvoxjPoaDPrDgKnSQEpxoc5cQaL4zLOBiNFCrfL6iPx2ikQLDcYeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABnmECCqlsIMcbFpqlapSWdgN1oYDA1x0VtmheYQvu7gY5QrbBC1iZfe4ecg7aG0QA11Mr10/XZTNaMWT6GlHiojJclj04kifG7PRApFI4NgwtaE5na/xCEBI572Nvp+FnJ4QuhWVYJgvPPl+Kvc1typ/0bHZ3xEX1wVz5NJ4MSUQplk4Y8ukYVZOrkE3NyFUbrAVHJMIJ2u9StKhw6QhB7BqfVFxksXFEhjMlMPUrxf1ja7gibof1E49vZigAAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqcjicskpGXDJi75LLG/lXL+Mb6GXudnQ8PEzZL7Oz9heAQsNBwAIBAUKAgMBDQYJDA/dQvKf+c6G8f3//+gDAAA="
  }
}

Note: This is a sample response, the actual one may have different values, but the fields will be the same.

Note: One marketplace owner cannot own two marketplaces with the same currency and wallet address.

Once we successfully execute the API call and get the response successfully, we should receive an encoded_transaction in response. Now, this encoded_transaction needs to be signed using the user wallet, or the user's private key.

or

Use this deployed website to easily sign with a wallet or a private key in your front end:

Once signed successfully, the NFT marketplace will be created and will be ready to use. You can also modify an existing marketplace using SHYFT APIs if you have the update authority i.e. the authority_address while creating the marketplace is your wallet address.

Updating an existing Marketplace using SHYFT APIs

Only the wallet, which was set as the update authority (authority_address) during the marketplace creation has the authority to update the marketplace. Parameters that can be updated in an existing marketplace:

  • authority_wallet: The wallet id that has the update authority to the marketplace can be updated, by passing in the new authority wallet in the new_authority_wallet field.

  • transaction_fee: The transaction fee (percentage) set for each transaction in the marketplace, can be set to a new value.

  • fee_payer: The existing fee_payer for the marketplace background transaction can be assigned to a new wallet.

  • fee_recipient: The existing fee_recipient for the marketplace can be assigned to a new wallet.

Endpoint for updating an NFT marketplace.

POST https://api.shyft.to/sol/v1/marketplace/update

Parameters:

{
  "network": "devnet",
  "authority_wallet": "EijtaNNHqqaPmWwAmUi8f1TC6RiCRoodQd2BLFpA8T",
  "marketplace_address": "5p4Bua5tSsSoasdRJ95I1w5DiMSPfWcvMvnMVjPpZ6sJUb",
  "new_authority_address": "54K5BTMj8ynktzEeasdaahAJsCN2svBKmD1fTQTonbBB",
  "transaction_fee": 12,
  "fee_payer": "EijtaNNHqqaPmWwAmUi8f1TC6RiCRoodQd2BLFpA8T",
  "fee_recipient": "EijtaNNHqqaPmWwAmUi8f1TC6RiCRoodQd2BLFpA8T"
}

The parameters are similar to the ones used in the create marketplace API. This API also returns an encoded_transaction similar to the create marketplace API, and the transaction needs to be signed using the user wallet.

So, That's pretty much everything about this blog, which shows us how to create a simple NFT marketplace on the Solana blockchain using SHYFT APIs.

Resources

This is a series of Tutorial Blogs that will show how you can create and set up a simple NFT marketplace within minutes using SHYFT APIs. You can also check out our on NFTs and marketplace which we have built using SHYFT’s Marketplace APIs.

Read The .

x-api-key is an authentication parameter, which gives you access to SHYFT APIs. You can get your own API Key from the . Just signup with your email id here and you can get it for free.

.

.

Once done, set up your Phantom wallet account. On-screen tips are available which will guide you to set up and get started. You can also find a detailed guide related to this .

Once you have collected your own from the , we can start creating an NFT marketplace using SHYFT APIs.

Learn how to sign encoded transactions .

In the next episode, we will see how to list, buy and perform transactions on the marketplace we just created in this episode. Happy Hacking and stay tuned.

Join our

If you liked this, you can also read our tutorials on or .

📘
🎉
sample project
SHYFT Marketplace APIs Documentation here
SHYFT website
Chrome/Brave
Firefox
here
x-api-key
SHYFT Website
here
https://shyft-insider.vercel.app/
SHYFT API Documentation
Shyft Website
Get API Key
GitHub
Tool for Signing Transaction on Solana
Discord
How to get your user's token balances?
How to sign transactions on Solana
Click here
Building Marketplace is cakewalk with SHYFT APIs
Sample Marketplace project built with SHYFT APIs