Use this repo to make an API for serving metadata about your tokens (ERC-721 or ERC-1155) to marketplaces like OpenSea and other third parties.
Metadata for each token can include an image, animation, attributes, scalar properties, boost properties, and more!
You need node.js (8.11.* or later) and npm installed. If you want to do a Heroku deployment, download and install the Heroku CLI and run heroku login
locally.
- Clone the repo
git clone https://github.com/ProjectOpenSea/metadata-api-nodejs
- Change directories
cd metadata-api-nodejs
- Run
npm install
. - Run
heroku create your-metadata-api
. If the nameyour-metadata-api
was already taken you'd get the error▸ Name your-metadata-api is already taken
. Try different names until one works. This also adds heroku to yourgit remote
so you can push to it. - Use your favorite code editor to save the Heroku URL you picked into
src/constants.js
as theHOST
variable (e.g.https://your-metadata-api.herokuapp.com
). This is the root URL for the tokens on your contract. - Run
git add src/constants.js
andgit commit
- Run
git push heroku master
- Check your api endpoint by going to
your-metadata-api.herokuapp.com/api/token/1
Here's a tutorial on setting up a mintable NFT contract. Alternatively, you can have your buyers mint the tokens for you (and pay the gas to do that) at purchase-time, using the OpenSea Crowdsale Tutorial.
Now that you a contract and a token URI for each of your tokens, there's a nice mint.js script that you can run locally to mint them on a testnet like Rinkeby and on mainnet Ethereum.
If you want more control over the minting process, call _setTokenURI on your NFT's contract using the URL pattern above, either directly if you exposed that method for the contract owner
, or by minting new tokens using mintWithTokenURI.
If you're signed into MetaMask as the owner of your contract, you can click the "SELL" button on any asset to sell it immediately on OpenSea, using Dutch (declining price), English (to the highest bidder), and fixed-price auctions.
You can also use the OpenSea.js SDK to create sell orders. You can create sell orders in bulk if you followed the Crowdsale Tutorial above.
If you have questions, contact the OpenSea team on Discord. We're very responsive!