DEV Community

Cover image for Publishing a large NFT collection on OpenSea:Part 3
Smile
Smile

Posted on

Publishing a large NFT collection on OpenSea:Part 3

Welcome to Part 3 of “How to publish a large NFT collection on OpenSea” — the story of how we published the Krypto Pandaz collection. In case you missed the previous parts, Part 1 covers selecting the blockchain for our NFT and creating a smart contract. Part 2 describes how to generate a large collection of different images and how to create a metadata server that describes the features of images using a format understood by OpenSea.
By now, you should have a smart contract drafted. You also have a collection of images and a metadata server. It’s time to start the publishing process.

Setup Infura.

What the heck is Infura and why do you need it? Blockchains such as Ethereum or Polygon are run by peer-to-peer networks. They promise decentralization. Anyone can join their networks. The problem is that operating an Ethereum or a Polygon node means a lot of overhead if all we want to do is to create or contract or programmatically invoke a contract method. This is where providers like Infura step in. Infura provides a convenient API interface to blockchains. Best of all, Infura has a generous free tier. It’s more than enough for occasional contract deployments.
Go to https://infura.io/ and create an account. If you decided to use Polygon, you will need to activate an add-on called “Polygon PoS” at https://infura.io/upgrade. Once you are logged in, create a project and copy its ID. You will need it to deploy your contract.

Add crypto to the wallet you will use to deploy the contract.

Each time you run a transaction on Ethereum or Polygon you have to pay a fee called a gas fee. In our case, we will have to pay for the following operations:

  1. Deploy the contract — this is a one-time fee. Polygon is
    significantly cheaper than Ethereum. In our case, we paid $0.34 / 0.203 MATIC for contract creation. You can inspect the transaction on Polygonscan. Deploying the same contract on Ethereum could easily cost close to $1000. For example, see this ERC721 contract deployed on 2/14/2022 at 0.235 ETH ~= $860. It’s 2500 more than on Polygon!

  2. Mint NFT’s — in our case, we have a contract method that mints
    NFT’s in batches of 100. Each batch cost us about $1.50 / 0.85 MATIC in gas fees. See this initial mint. I was eager to see it work so I cranked up the fee to reduce the wait time. That’s why the transaction price for the first mint is higher than the subsequent mints. If we stick with our 2500 multiplier for Ethereum, that would be thousands of dollars per batch.
    The total amount of money for Polygon to list a collection of 10000 NFT’s is:

  • Polygon — $150
  • Ethereum — tens of thousands, depending on the time of day (network congestion) and the price of ETH. Getting money to your Ethereum wallet is trivial. Buy it from a trustworthy source that supports transferring to wallets, e.g. Coinbase or the providers integrated with MetaMask. Funding your Polygon wallet is a lot more work. First, you need Ethereum. Then you need to bridge Ethereum to Polygon (where it becomes WETH or Wrapped Ethereum). Finally, you convert your Polygon ETH to MATIC. Bridging from Ethereum to Polygon is very expensive. Initially, I made a mistake and bridged only $100. I paid $40 in fees so I had to repeat the process and paid the fees again. Don’t be like Adam and bridge $300 to give you some breathing room. You may also experiment with other bridging solutions that take a lot longer (days) but are also a lot cheaper as they batch many requests into larger transactions.

Deploy the contract.

We will deploy the contract using Truffle in a Javascript project:

  • Install Truffle:
    npm install -g truffle

  • Create a sample project. Here we are using polygon:
    truffle unbox polygon

  • Add your smart contract .sol file to ./contracts/polygon directory.

  • Adjust the migrations script in .contracts/migrations directory to point to your contract.

  • Go to the terminal and configure Infura:
    export INFURA_PROJECT_ID=......
    Export the mnemonic for the account that will be used to deploy the contract:

export MNEMONIC=.....
export TESTNET_MNEMONIC=.....
Enter fullscreen mode Exit fullscreen mode
  • Deploy the contract to the testnet:
    npm run migrate:polygon --network=polygon_infura_testnet

  • If everything looks good, deploy to the mainnet:
    npm run migrate:polygon — network=polygon_infura_mainnet
    Make sure you record the address of the contract. You will need it in subsequent steps.

Mint tokens.

You may think that publishing a contract to mainnet should be enough for OpenSea to notice it. That is not the case. OpenSea will not pick it up unless there is at least one NFT minted in the contract.
In order to mint NFT’s, you have to send transactions to your blockchain of choice. There are several ways to do it. You could automate the process with e.g. Truffle. We didn’t feel comfortable automating so many transactions that cost us real $$$. Instead, I invoked methods on our contract using Remix. For some reason, Remix was very slow and unstable for me in Chrome. I switched to Brave browser and it resolved my issues.
Here is what you need to do to invoke a contract method in Remix:

  1. Create a new contract file in the workspace. Simply copy/paste the contents of your .sol file.
  2. Compile the contract.
  3. Make sure you are logged into Metamask as the contract owner.
  4. Configure your Metamask wallet to use Polygon mainnet.
  5. Configure Remix to use Injected web3 provider. This will wire up Remix to the Polygon config in Metamask.
  6. Use load contract from address option to load your contract.
  7. Remix will display methods exposed by the contract. Find the mint method and invoke it. You will need to approve it in Metamask. Repeat till you have achieved the desired number of NFT’s.

Setup your collection on OpenSea.

Now that your contract is live on Polygon it’s time to publish it as a collection on OpenSea.
Make sure you are signed in to Metamask as the contract owner.

  1. Creator Earnings — this is % from all subsequent transactions that will keep flowing to your wallet as royalty fees.
  2. Your payout wallet address — the contract that will receive royalties.

Summary

In this series, we have gone through publishing a large NFT collection on OpenSea. The process involves multiple steps and requires a diverse skillset. We talked about how to generate image combinations from layers, how to expose a metadata server, how much it costs to mint, how to deploy a contract and register a collection on OpenSea.
Good luck with your creations!

Back to Part2

Top comments (0)