Network
Launch Date
Consensus
Note
Sepolia
Oct 2021
PoW
Like-for-like representation of Ethereum
Görli
Jan 2019
PoA
Proof-of-Authority
Kiln
Mar 2022
PoS
Post-Merge (for ETH2), shadow fork of the mainnet
Kintsugi
Dec 2021
PoS
DEPRECATED, use Kiln; post-Merge (for ETH2)
Ropsten
Nov 2016
PoW
DEPRECATED, use Sepolia; the Merge to happen on Jun 8, 2022
Rinkeby
Apr 2017
PoA
DEPRECATED, use Görli and Görli Faucet
Kovan
Mar 2017
PoA
DEPRECATED, use Sepolia or Görli
List of active and deprecated Ethereum testnets, including Kintsugi.
Features
Optimistic rollup 
ZK-rollup 
Proof
Uses fraud proofs to prove transaction validity. 
Uses validity (zero-knowledge) proofs to prove transaction validity. 
Capital efficiency
Requires waiting through a 1-week delay (dispute period) before withdrawing funds. 
Users can withdraw funds immediately because validity proofs provide incontrovertible evidence of the authenticity of off-chain transactions. 
Data compression
Publishes full transaction data as calldata to Ethereum Mainnet, which increases rollup costs. 
Doesn't need to publish transaction data on Ethereum because ZK-SNARKs and ZK-STARKs already guarantee the accuracy of the rollup state. 
EVM compatibility
Uses a simulation of the Ethereum Virtual Machine (EVM), which allows it to run arbitrary logic and support smart contracts. 
Doesn't widely support EVM computation, although a few EVM-compatible ZK-rollups have appeared. 
Rollup costs
Reduces costs since it publishes minimal data on Ethereum and doesn't have to post proofs for transactions, except in special circumstances. 
Faces higher overhead from costs involved in generating and verifying proofs for every transaction block. ZK proofs require specialized, expensive hardware to create and have high on-chain verification costs. 
Trust assumptions
Doesn't require a trusted setup. 
Requires a trusted setup to work. 
Liveness requirements
Verifiers are needed to keep tabs on the actual rollup state and the one referenced in the state root to detect fraud. 
Users don't need someone to watch the L2 chain to detect fraud. 
Security properties 
Relies on cryptoeconomic incentives to assure users of rollup security. 
Relies on cryptographic guarantees for security. 
Start building
on Alchemy.
Sign up for free
Start building on Optimism.
Sign up for free
Start building on Arbitrum.
Sign up for free
Start building on Ethereum.
Sign up for free
Start building on Polygon.
Sign up for free
Start building on Starknet.
Sign up for free
Start building on Flow.
Sign up for free
kiln faucet
Get free Kiln ETH.
Start building today
Goerli faucet
Get free Goerli ETH.
Start building today
mumbai faucet
Get free Mumbai Matic.
Start building today
rinkeby faucet
Get free Rinkeby
ETH.
Start building today
Start building on Ethereum.
Get started for free
Start building on Ethereum.
Get started for free
Start building on Flow.
Get started for free
Start building on Polygon.
Get started for free
Start building on Starknet.
Get started for free
Start building on Optimism.
Get started for free
Start building on Solana.
Get started for free
Start building on Solana.
Sign up for beta access
Start building on Solana.
Join the waitlist
Arbitrum logo
Start building on Arbitrum.
Get started for free
Learn
Solidity at
Alchemy
University
Get started today
curl 
https://release.solana.com/v1.10.32/solana-install-init-x86_64-pc-windows-msvc.exe 
--output 
C:\solana-install-tmp\solana-install-init.exe 
--create-dirs
NFTs
OPTIMISM NFT API OVERVIEW

Everything You Need to Know About Alchemy's Optimism NFT API

Start Building Powerful Optimism NFT Tools in Minutes
Last Updated:
October 20, 2022
Table of Contents
Table of Contents
Table of Contents

{{building-on-optimism}}

NFT collections are surging on Optimism with more developers building new NFT dapps on the network. These developers need NFT APIs to query the network and obtain NFT metadata to fulfill user data requests. Without proper NFT APIs, indexing and querying NFT metadata becomes a time and resource-intensive procedure for individual developers. 

Learn how to start building NFT tools, marketplaces, dapps, and more with Alchemy's Optimism NFT API.

Optimism’s NFT Ecosystem

Optimism is an L2 (layer 2) Ethereum scaling solution, running on optimistic rollup infrastructure. Optimistic rollups reduces the burden on Ethereum by conducting off-chain transactions, thereby offering higher transaction throughput and reduced gas fees. Optimistic rollups bundle multiple transactions into a single transaction, and sends them back to Ethereum for validation, thus enhancing network scalability. 

Optimism’s in-built scalability makes it an ideal solution for developing NFT projects. Users get an enhanced experience for playing NFT games or trading collectibles with Optimism’s high-speed transactions and cheap fees. 

With over 1 million NFT assets on Optimism spread over 238K NFT wallets according to the Optimism NFTScan website, developers require the right toolset to build NFT protocols and interact with a high volume of NFTs. Alchemy’s Optimism NFT API is a primary tool that developers need to build NFT projects for the Optimism ecosystem.

What is an Optimism NFT API?

The Optimism NFT API helps developers instantly fetch information from the L2 network. Developers can read block/transaction data, execute smart contracts, query on-chain information, and store data on-chain with Optimism NFT API. 

Alchemy offers a multichain NFT API for developers that use the JSON-RPC standard APIs to interact with Optimism’s decentralized node infrastructure. Alchemy’s Optimism NFT API empowers developers to access higher request throughput, increase concurrent requests, and use free data archives, logs, and individual usage metrics. Further, the solution supports all NFTs following the ERC-721 and ERC-1155 standards, and selected NFTs that predated Ethereum’s standardized NFT contracts.

Developers also get access to a broad range of NFTs and their metadata through multiple code paths. Alchemy’s Optimism NFT API can handle on-chain or off-chain NFTs in JSON, SVG, UTF-8 format, IPFS gateways like Pinata, and encoded Base64 images. 

Developers can use Alchemy’s NFT API for the following purposes: 

  • Display NFTs to users
  • Develop an NFT marketplace 
  • Design an NFT analytics protocol 
  • Build NFT gaming applications
  • Verify NFT ownership

How does the Optimism NFT API work?

Alchemy’s Optimism NFT API uses the following mechanisms to achieve high performance functionality: image caching, spam filters, image resizing, and clear error descriptions.

Image Caching

Developers usually interact with decentralized storage providers like IPFS and third-party servers to access NFT media files. However, they face longer loading times and timeout errors. 

Alchemy offers a low latency solution with fast loading and quick responses because it caches NFT images with Cloudinary. Thus, Alchemy can serve NFT URLs from their own cache to developers, thereby reducing response time. 

Spam Filters

Unwanted spam NFTs can lead to scams and hinder user experiences in an NFT marketplace, gallery, or analytics platform. Developers usually have to read and parse individual smart contracts to access NFT metadata for filtering out spam NFTs. To help make things simpler, Alchemy offers the following API endpoints as NFT spam filters: 

  • isSpamForContract - checks for spam NFT smart contracts. Developers can also filter contract addresses to check for owners of spam NFTs.
  • getSpamContracts - returns the list of spam ERC-721 and ERC-1155 smart contracts of a particular network.

Developers can use Alchemy’s spam filters to send spam NFTs for burning or flag wallet addresses that send spam NFTs. By August 2022, Alchemy NFT API had marked 5,000 smart contracts as spam NFTs.

Alchemy uses the following criteria to identify spam NFTs:

  1. Breaks ERC-721 and ERC-1155 token standards
  2. Breaks token standards during token transfers
  3. Mint tokens to honeypot addresses like vitalik.eth
  4. Provides false data about the total token supply

Image Resizing

NFTs need different image sizes for thumbnails, smartphones, desktops, and tablet viewports. Developers can resize Alchemy-hosted NFTs by changing URLs to include any combination of height and width pixels to create the aspect ratio. Thus, Alchemy makes image resizing easier for NFT developers.      

NFT Errors

Although Alchemy’s NFT API returns most NFT metadata, it fails to fulfill the request in the following instances:  

  • Token does not exist - Alchemy uses a token ID to call the tokenURI/uri method, but the smart contract cannot recognize it. It either means the token isn’t minted yet or it doesn’t exist.
  • Malformed token URI - tokenURI/uri returns a ‘malformed’ or invalid website, and therefore cannot access the website to return metadata.
  • Failed to get token URI - generic error message when the token ID doesn’t return any metadata, even if the token exists.
  • Token URI returns a non-200 response code - this error shows when the URI returns a ‘502 Bad Gateway’ message if the website is down or it rate-limits Alchemy servers.
  • Throttled token URI - this error returns a ‘429 Too Many Requests’ message, indicating Alchemy has requested metadata too frequently, thereby getting rate-limited.
  • Contract does not have any code - this error shows when a token address doesn’t have a corresponding smart contract code on the blockchain network.
  • Contract returned a broken token URI, do not retry - this error message shows when the tokenURI doesn’t respond because the website URL may not exist, or lacks DNS setup. 

Optimism NFT API Supported Methods

Alchemy’s Optimism NFT API helps developers to build Optimism NFT dapps with the following categories of NFT API endpoints: 

Optimism NFT Ownership and Token Gating

  • getNFTs - get Optimism NFTs owned by a wallet 
  • getOwnersForToken - get Optimism owners for a token 
  • getOwnersForCollection - get Optimism NFT owners for collection
  • isHolderOfCollection - check if the Optimism wallet holds an NFT
  • getNFTsForCollection - get NFTs for Optimism NFT collection

Optimism NFT Metadata

  • getNFTMetadata - get Optimism NFT metadata
  • getContractMetadata - get Optimism NFT smart contract metadata

Optimism NFT API Examples

Alchemy’s getNFTs is a versatile NFT API endpoint is a versatile NFT API endpoint, enabling developers to use it in multiple NFT protocols. To understand how the getNFTs API endpoint functions, consider the following examples.

1. Optimism Token Gating

When developers build an NFT marketplace, they design a user profile page that displays user-owned NFTs. Developers can use the Optimism NFT token gating tool, isHolderOfCollection, to fetch NFTs from a particular wallet address is they hold a particular token from a specified collection.

2. Optimism NFT Analytics Tool

NFT analytics tools like rarity ranking websites or aggregators require NFT metadata to create lists and obtain trading data. Developers can use the Optimism NFT metadata API, getNFTMetadata, to retrieve the on-chain metadata used in NFT analytics tools.  

3. Optimism NFT Airdrop Lists

An NFT project hires developers to airdrop new NFTs to owners of a specific NFT. Without an API, developers have to parse the whole blockchain to trace NFT asset ownership. However, Alchemy’s Optimism NFT collection API, getOwnersForToken, enables developers to instantly identify owners and create the airdrop list. Developers can also use this API to verify asset ownership when users want to put up a particular NFT as their profile picture.

How to Start Building with the Optimism NFT API

Instead of running your own Optimism node, it’s easy to create a private Optimism node on Alchemy, and then follow three easy steps to start building with Alchemy’s Optimism NFT API: 

  1. Choose a package manager - use a package manager like npm or yarn
  2. Setup the repo - open a terminal to create a new repository from the command line for the quickstart scripts
  3. Choose a library - install the Alchemy SDK to interact with the Optimism NFT API

Although developers can use Fetch and Axios, the quickest way to start using the Optimism NFT API is with Alchemy’s SDK because it offers better facilities with WebSocket support, retries, and many other benefits.     

Use the Best Optimism NFT API with Alchemy

During the 2021 bull run, the NFT market surpassed $40 billion according to Bloomberg. Although the NFT sector is currently going through a tough bear market phase, NFT technology holds immense potential for future growth. 

Therefore, builders will need the right NFT developer tools to create their NFT dapps on the scalable Optimism network. Create a free account on Alchemy and start building NFT dapps with Alchemy’s free NFT API. 

ALCHEMY SUPERNODE - ETHEREUM NODE API

Scale to any size, without any errors

Alchemy Supernode finally makes it possible to scale blockchain applications without all the headaches. Plus, our legendary support will guide you every step of the way.

Get started for free
Supernode footer
NFTs
OPTIMISM NFT API OVERVIEW

Optimism NFT API - Everything You Need to Known

Start Building Powerful Optimism NFT Tools in Minutes
Last Updated:
October 20, 2022
Don't miss an update
Sign up for our newsletter to get alpha, key insights, and killer resources.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Table of Contents
Table of Contents

{{building-on-optimism}}

NFT collections are surging on Optimism with more developers building new NFT dapps on the network. These developers need NFT APIs to query the network and obtain NFT metadata to fulfill user data requests. Without proper NFT APIs, indexing and querying NFT metadata becomes a time and resource-intensive procedure for individual developers. 

Learn how to start building NFT tools, marketplaces, dapps, and more with Alchemy's Optimism NFT API.

Optimism’s NFT Ecosystem

Optimism is an L2 (layer 2) Ethereum scaling solution, running on optimistic rollup infrastructure. Optimistic rollups reduces the burden on Ethereum by conducting off-chain transactions, thereby offering higher transaction throughput and reduced gas fees. Optimistic rollups bundle multiple transactions into a single transaction, and sends them back to Ethereum for validation, thus enhancing network scalability. 

Optimism’s in-built scalability makes it an ideal solution for developing NFT projects. Users get an enhanced experience for playing NFT games or trading collectibles with Optimism’s high-speed transactions and cheap fees. 

With over 1 million NFT assets on Optimism spread over 238K NFT wallets according to the Optimism NFTScan website, developers require the right toolset to build NFT protocols and interact with a high volume of NFTs. Alchemy’s Optimism NFT API is a primary tool that developers need to build NFT projects for the Optimism ecosystem.

What is an Optimism NFT API?

The Optimism NFT API helps developers instantly fetch information from the L2 network. Developers can read block/transaction data, execute smart contracts, query on-chain information, and store data on-chain with Optimism NFT API. 

Alchemy offers a multichain NFT API for developers that use the JSON-RPC standard APIs to interact with Optimism’s decentralized node infrastructure. Alchemy’s Optimism NFT API empowers developers to access higher request throughput, increase concurrent requests, and use free data archives, logs, and individual usage metrics. Further, the solution supports all NFTs following the ERC-721 and ERC-1155 standards, and selected NFTs that predated Ethereum’s standardized NFT contracts.

Developers also get access to a broad range of NFTs and their metadata through multiple code paths. Alchemy’s Optimism NFT API can handle on-chain or off-chain NFTs in JSON, SVG, UTF-8 format, IPFS gateways like Pinata, and encoded Base64 images. 

Developers can use Alchemy’s NFT API for the following purposes: 

  • Display NFTs to users
  • Develop an NFT marketplace 
  • Design an NFT analytics protocol 
  • Build NFT gaming applications
  • Verify NFT ownership

How does the Optimism NFT API work?

Alchemy’s Optimism NFT API uses the following mechanisms to achieve high performance functionality: image caching, spam filters, image resizing, and clear error descriptions.

Image Caching

Developers usually interact with decentralized storage providers like IPFS and third-party servers to access NFT media files. However, they face longer loading times and timeout errors. 

Alchemy offers a low latency solution with fast loading and quick responses because it caches NFT images with Cloudinary. Thus, Alchemy can serve NFT URLs from their own cache to developers, thereby reducing response time. 

Spam Filters

Unwanted spam NFTs can lead to scams and hinder user experiences in an NFT marketplace, gallery, or analytics platform. Developers usually have to read and parse individual smart contracts to access NFT metadata for filtering out spam NFTs. To help make things simpler, Alchemy offers the following API endpoints as NFT spam filters: 

  • isSpamForContract - checks for spam NFT smart contracts. Developers can also filter contract addresses to check for owners of spam NFTs.
  • getSpamContracts - returns the list of spam ERC-721 and ERC-1155 smart contracts of a particular network.

Developers can use Alchemy’s spam filters to send spam NFTs for burning or flag wallet addresses that send spam NFTs. By August 2022, Alchemy NFT API had marked 5,000 smart contracts as spam NFTs.

Alchemy uses the following criteria to identify spam NFTs:

  1. Breaks ERC-721 and ERC-1155 token standards
  2. Breaks token standards during token transfers
  3. Mint tokens to honeypot addresses like vitalik.eth
  4. Provides false data about the total token supply

Image Resizing

NFTs need different image sizes for thumbnails, smartphones, desktops, and tablet viewports. Developers can resize Alchemy-hosted NFTs by changing URLs to include any combination of height and width pixels to create the aspect ratio. Thus, Alchemy makes image resizing easier for NFT developers.      

NFT Errors

Although Alchemy’s NFT API returns most NFT metadata, it fails to fulfill the request in the following instances:  

  • Token does not exist - Alchemy uses a token ID to call the tokenURI/uri method, but the smart contract cannot recognize it. It either means the token isn’t minted yet or it doesn’t exist.
  • Malformed token URI - tokenURI/uri returns a ‘malformed’ or invalid website, and therefore cannot access the website to return metadata.
  • Failed to get token URI - generic error message when the token ID doesn’t return any metadata, even if the token exists.
  • Token URI returns a non-200 response code - this error shows when the URI returns a ‘502 Bad Gateway’ message if the website is down or it rate-limits Alchemy servers.
  • Throttled token URI - this error returns a ‘429 Too Many Requests’ message, indicating Alchemy has requested metadata too frequently, thereby getting rate-limited.
  • Contract does not have any code - this error shows when a token address doesn’t have a corresponding smart contract code on the blockchain network.
  • Contract returned a broken token URI, do not retry - this error message shows when the tokenURI doesn’t respond because the website URL may not exist, or lacks DNS setup. 

Optimism NFT API Supported Methods

Alchemy’s Optimism NFT API helps developers to build Optimism NFT dapps with the following categories of NFT API endpoints: 

Optimism NFT Ownership and Token Gating

  • getNFTs - get Optimism NFTs owned by a wallet 
  • getOwnersForToken - get Optimism owners for a token 
  • getOwnersForCollection - get Optimism NFT owners for collection
  • isHolderOfCollection - check if the Optimism wallet holds an NFT
  • getNFTsForCollection - get NFTs for Optimism NFT collection

Optimism NFT Metadata

  • getNFTMetadata - get Optimism NFT metadata
  • getContractMetadata - get Optimism NFT smart contract metadata

Optimism NFT API Examples

Alchemy’s getNFTs is a versatile NFT API endpoint is a versatile NFT API endpoint, enabling developers to use it in multiple NFT protocols. To understand how the getNFTs API endpoint functions, consider the following examples.

1. Optimism Token Gating

When developers build an NFT marketplace, they design a user profile page that displays user-owned NFTs. Developers can use the Optimism NFT token gating tool, isHolderOfCollection, to fetch NFTs from a particular wallet address is they hold a particular token from a specified collection.

2. Optimism NFT Analytics Tool

NFT analytics tools like rarity ranking websites or aggregators require NFT metadata to create lists and obtain trading data. Developers can use the Optimism NFT metadata API, getNFTMetadata, to retrieve the on-chain metadata used in NFT analytics tools.  

3. Optimism NFT Airdrop Lists

An NFT project hires developers to airdrop new NFTs to owners of a specific NFT. Without an API, developers have to parse the whole blockchain to trace NFT asset ownership. However, Alchemy’s Optimism NFT collection API, getOwnersForToken, enables developers to instantly identify owners and create the airdrop list. Developers can also use this API to verify asset ownership when users want to put up a particular NFT as their profile picture.

How to Start Building with the Optimism NFT API

Instead of running your own Optimism node, it’s easy to create a private Optimism node on Alchemy, and then follow three easy steps to start building with Alchemy’s Optimism NFT API: 

  1. Choose a package manager - use a package manager like npm or yarn
  2. Setup the repo - open a terminal to create a new repository from the command line for the quickstart scripts
  3. Choose a library - install the Alchemy SDK to interact with the Optimism NFT API

Although developers can use Fetch and Axios, the quickest way to start using the Optimism NFT API is with Alchemy’s SDK because it offers better facilities with WebSocket support, retries, and many other benefits.     

Use the Best Optimism NFT API with Alchemy

During the 2021 bull run, the NFT market surpassed $40 billion according to Bloomberg. Although the NFT sector is currently going through a tough bear market phase, NFT technology holds immense potential for future growth. 

Therefore, builders will need the right NFT developer tools to create their NFT dapps on the scalable Optimism network. Create a free account on Alchemy and start building NFT dapps with Alchemy’s free NFT API. 

NFT collections are surging on Optimism with more developers building new NFT dapps on the network. These developers need NFT APIs to query the network and obtain NFT metadata to fulfill user data requests. Without proper NFT APIs, indexing and querying NFT metadata becomes a time and resource-intensive procedure for individual developers. 

Learn how to start building NFT tools, marketplaces, dapps, and more with Alchemy's Optimism NFT API.

Optimism’s NFT Ecosystem

Optimism is an L2 (layer 2) Ethereum scaling solution, running on optimistic rollup infrastructure. Optimistic rollups reduces the burden on Ethereum by conducting off-chain transactions, thereby offering higher transaction throughput and reduced gas fees. Optimistic rollups bundle multiple transactions into a single transaction, and sends them back to Ethereum for validation, thus enhancing network scalability. 

Optimism’s in-built scalability makes it an ideal solution for developing NFT projects. Users get an enhanced experience for playing NFT games or trading collectibles with Optimism’s high-speed transactions and cheap fees. 

With over 1 million NFT assets on Optimism spread over 238K NFT wallets according to the Optimism NFTScan website, developers require the right toolset to build NFT protocols and interact with a high volume of NFTs. Alchemy’s Optimism NFT API is a primary tool that developers need to build NFT projects for the Optimism ecosystem.

What is an Optimism NFT API?

The Optimism NFT API helps developers instantly fetch information from the L2 network. Developers can read block/transaction data, execute smart contracts, query on-chain information, and store data on-chain with Optimism NFT API. 

Alchemy offers a multichain NFT API for developers that use the JSON-RPC standard APIs to interact with Optimism’s decentralized node infrastructure. Alchemy’s Optimism NFT API empowers developers to access higher request throughput, increase concurrent requests, and use free data archives, logs, and individual usage metrics. Further, the solution supports all NFTs following the ERC-721 and ERC-1155 standards, and selected NFTs that predated Ethereum’s standardized NFT contracts.

Developers also get access to a broad range of NFTs and their metadata through multiple code paths. Alchemy’s Optimism NFT API can handle on-chain or off-chain NFTs in JSON, SVG, UTF-8 format, IPFS gateways like Pinata, and encoded Base64 images. 

Developers can use Alchemy’s NFT API for the following purposes: 

  • Display NFTs to users
  • Develop an NFT marketplace 
  • Design an NFT analytics protocol 
  • Build NFT gaming applications
  • Verify NFT ownership

How does the Optimism NFT API work?

Alchemy’s Optimism NFT API uses the following mechanisms to achieve high performance functionality: image caching, spam filters, image resizing, and clear error descriptions.

Image Caching

Developers usually interact with decentralized storage providers like IPFS and third-party servers to access NFT media files. However, they face longer loading times and timeout errors. 

Alchemy offers a low latency solution with fast loading and quick responses because it caches NFT images with Cloudinary. Thus, Alchemy can serve NFT URLs from their own cache to developers, thereby reducing response time. 

Spam Filters

Unwanted spam NFTs can lead to scams and hinder user experiences in an NFT marketplace, gallery, or analytics platform. Developers usually have to read and parse individual smart contracts to access NFT metadata for filtering out spam NFTs. To help make things simpler, Alchemy offers the following API endpoints as NFT spam filters: 

  • isSpamForContract - checks for spam NFT smart contracts. Developers can also filter contract addresses to check for owners of spam NFTs.
  • getSpamContracts - returns the list of spam ERC-721 and ERC-1155 smart contracts of a particular network.

Developers can use Alchemy’s spam filters to send spam NFTs for burning or flag wallet addresses that send spam NFTs. By August 2022, Alchemy NFT API had marked 5,000 smart contracts as spam NFTs.

Alchemy uses the following criteria to identify spam NFTs:

  1. Breaks ERC-721 and ERC-1155 token standards
  2. Breaks token standards during token transfers
  3. Mint tokens to honeypot addresses like vitalik.eth
  4. Provides false data about the total token supply

Image Resizing

NFTs need different image sizes for thumbnails, smartphones, desktops, and tablet viewports. Developers can resize Alchemy-hosted NFTs by changing URLs to include any combination of height and width pixels to create the aspect ratio. Thus, Alchemy makes image resizing easier for NFT developers.      

NFT Errors

Although Alchemy’s NFT API returns most NFT metadata, it fails to fulfill the request in the following instances:  

  • Token does not exist - Alchemy uses a token ID to call the tokenURI/uri method, but the smart contract cannot recognize it. It either means the token isn’t minted yet or it doesn’t exist.
  • Malformed token URI - tokenURI/uri returns a ‘malformed’ or invalid website, and therefore cannot access the website to return metadata.
  • Failed to get token URI - generic error message when the token ID doesn’t return any metadata, even if the token exists.
  • Token URI returns a non-200 response code - this error shows when the URI returns a ‘502 Bad Gateway’ message if the website is down or it rate-limits Alchemy servers.
  • Throttled token URI - this error returns a ‘429 Too Many Requests’ message, indicating Alchemy has requested metadata too frequently, thereby getting rate-limited.
  • Contract does not have any code - this error shows when a token address doesn’t have a corresponding smart contract code on the blockchain network.
  • Contract returned a broken token URI, do not retry - this error message shows when the tokenURI doesn’t respond because the website URL may not exist, or lacks DNS setup. 

Optimism NFT API Supported Methods

Alchemy’s Optimism NFT API helps developers to build Optimism NFT dapps with the following categories of NFT API endpoints: 

Optimism NFT Ownership and Token Gating

  • getNFTs - get Optimism NFTs owned by a wallet 
  • getOwnersForToken - get Optimism owners for a token 
  • getOwnersForCollection - get Optimism NFT owners for collection
  • isHolderOfCollection - check if the Optimism wallet holds an NFT
  • getNFTsForCollection - get NFTs for Optimism NFT collection

Optimism NFT Metadata

  • getNFTMetadata - get Optimism NFT metadata
  • getContractMetadata - get Optimism NFT smart contract metadata

Optimism NFT API Examples

Alchemy’s getNFTs is a versatile NFT API endpoint is a versatile NFT API endpoint, enabling developers to use it in multiple NFT protocols. To understand how the getNFTs API endpoint functions, consider the following examples.

1. Optimism Token Gating

When developers build an NFT marketplace, they design a user profile page that displays user-owned NFTs. Developers can use the Optimism NFT token gating tool, isHolderOfCollection, to fetch NFTs from a particular wallet address is they hold a particular token from a specified collection.

2. Optimism NFT Analytics Tool

NFT analytics tools like rarity ranking websites or aggregators require NFT metadata to create lists and obtain trading data. Developers can use the Optimism NFT metadata API, getNFTMetadata, to retrieve the on-chain metadata used in NFT analytics tools.  

3. Optimism NFT Airdrop Lists

An NFT project hires developers to airdrop new NFTs to owners of a specific NFT. Without an API, developers have to parse the whole blockchain to trace NFT asset ownership. However, Alchemy’s Optimism NFT collection API, getOwnersForToken, enables developers to instantly identify owners and create the airdrop list. Developers can also use this API to verify asset ownership when users want to put up a particular NFT as their profile picture.

How to Start Building with the Optimism NFT API

Instead of running your own Optimism node, it’s easy to create a private Optimism node on Alchemy, and then follow three easy steps to start building with Alchemy’s Optimism NFT API: 

  1. Choose a package manager - use a package manager like npm or yarn
  2. Setup the repo - open a terminal to create a new repository from the command line for the quickstart scripts
  3. Choose a library - install the Alchemy SDK to interact with the Optimism NFT API

Although developers can use Fetch and Axios, the quickest way to start using the Optimism NFT API is with Alchemy’s SDK because it offers better facilities with WebSocket support, retries, and many other benefits.     

Use the Best Optimism NFT API with Alchemy

During the 2021 bull run, the NFT market surpassed $40 billion according to Bloomberg. Although the NFT sector is currently going through a tough bear market phase, NFT technology holds immense potential for future growth. 

Therefore, builders will need the right NFT developer tools to create their NFT dapps on the scalable Optimism network. Create a free account on Alchemy and start building NFT dapps with Alchemy’s free NFT API. 

Build web3 with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get started for free