Upload multiple images in Opensea | NFT

Shyam BV
Code Sprout
Published in
5 min readSep 13, 2021

Introduction

NFT’s are great(at least pretend it is), and you have created a ton of arts/images with your creativity or created using AI(artificial intelligence). But how to upload multiple images in Opensea? I have often been asked this question. In this article, I will show a method to upload images.

Modern art creation by author

NFT in Opensea

Unless you are living under a rock, you should have heard about NFT and its popularity. You create something unique and list its platforms such as Opensea, raritable, etc. For more information, check out the below articles.

Opensea is one of the famous NFT platforms. However, they don't have an option for multiple uploads. There are various reasons behind it. However, let us not go there.

Upload multiple images in Opensea

There are two methods to upload multiple images in the open sea.

  1. Copy images using https://ipfs.io/ and put them on ETH main-net.
  2. Upload images using Opensea using python

Copy images using blockchain

You need to do a lot of programming and need to know how blockchain works. Also need to understand how ERC-721 works. This requires a more profound understanding. Check out my course in the footer section for more details.

Upload images using Opensea using python

Unfortunately, opensea does not have an API to upload the images. We can use python with selenium to upload images. There are different steps to perform it.

Step 1: Installation

We need to install python and selenium.

pip install selenium
pip install bs4

Regarding how to set up drivers, please google it or check out my previous article.

Compressing the extension

When selenium is used, it will open a new chrome window without extensions. So extension needs to be installed. Check out the below steps.

  • Install Metamask on your regular chrome
  • Navigate to chrome://extensions/
  • Click ‘Pack extension’ and enter the local path to the Metamask extension. This will generate a .crx file. Also, make a note of Extension ID.

Step 2 — Navigating metamask

Chrome driver and extension loading

Once you load it, you can use a function like the below one to navigate metamask. Make sure you have a Secrete recovery phrase and password for the meta mask.

Navigate metamask

Once you navigate the browser, we need to return the driver to goto opensea. Make sure you give sufficient time between each element depending on your system performance and bandwidth.

Step 3 — Navigating Opensea

As a next step, we need to open opensea and upload some prerequisites before opening it.

  1. We should have already created an opensea account.
  2. You have connected your metamask wallet to opensea.
  3. Create a collection name.

Once we have the above items, we can execute the below script to connect selenium with the opensea window. Make sure the window has the proper focus.

When you navigate to the above URL, opensea will request to authorize with the metamask. So we need to go over the authentication. The below code will again allow you to authenticate with metamask.

Step 4 — Upload your art.

Once you authenticate yourself, upload the images by selecting the image and name. These two are mandatory fields to sell any art in opensea. You can also provide more descriptions.

We can also loop it through and upload as many images as required. Make sure you have enough time to upload the following image.

Output of code

Why this way?

The method mentioned above is little work, but why to create it in this method is a good question. You do not need to understand a lot about tokens, and you can save on gas fees. If you put it directly into the blockchain, you might encounter some gas fees. Opensea bypasses it, and you only provide 2.5% of what you sell in opensea. No other gas fees in opensea.

Conclusion

  1. We have gone through how to authorize metamask and connect your wallet.
  2. We have seen how to upload your creation into opensea.
  3. Use python and for the upload to save gas costs.

References

  1. https://betterprogramming.pub/scrape-any-websites-and-get-content-with-keywords-using-python-b060b9fa41ce
  2. https://dev.to/ltmenezes/automated-dapps-scrapping-with-selenium-and-metamask-2ae9

Get Code

Please subscribe to my newsletter to get the complete working code for my articles and other updates.

--

--