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 (lts/fermium) and npm installed. If you want to do a Heroku deployment, download and install the Heroku CLI and run heroku login
locally.
- Click the Deploy to Heroku button above to instantly get it up and running somewhere. You can pick the URL! For this example, let's say that it's
your-metadata-api.herokuapp.com
. - Run
heroku git:clone -a your-metadata-api
, andcd
into your new directory. - Run
npm install
. - Run
npm link
to add theminty
command to your$PATH
. This makes it easier to run Minty from anywhere on your computer. - Add a
.env
file using.sample.env
as a reference. - Save the Heroku URL you picked into
config/default.js
as thehost
variable (e.g.https://your-metadata-api.herokuapp.com
). This is the root URL for the tokens on your contract. - Deploy to Heroku by committing your changes and using
git push heroku master
. - Visit your token's metadata at https://your-metadata-api.herokuapp.com/{network}/token/{token_id}.
1A. Run the start-local-environment.sh
script to start the local Ethereum testnet and IPFS daemon:
./start-local-environment.sh
> Initializing daemon...
> Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/
> ...
This command continues to run. All further commands must be entered in another terminal window.
1B. Alternatively you can run ipfs yourself
if there's no local ipfs repo at
$HOME/.ipfs
, initialize one:
npx go-ipfs init
run local ipfs daemon
npx go-ipfs daemon
-
Run
npm run start
to start up your local API on post 5000 -
Run
npm run nft-task-runner
to start up the task runner
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 Goerli 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!