Pratham Prasoon Profile picture
Dev Rel Engineer @MovementLabsxyz 🥑🔬 Python, JavaScript, & Rust junkie. Building things I love with blockchains by the day, working on AI at night 🛠️

Nov 27, 2021, 14 tweets

A couple of days ago I showed you how to mint NFTs on the blockchain with JavaScript in ~10 lines of code.

You can do the same thing with Python 🐍

Here's how it works🧵

Typically minting an NFT would require you to write code in this language called 'solidity' to create a smart contract which would then mint the nft.

It require lots of testing, security checks and remember, once code goes on the blockchain it cannot be changed.

This sucks.

What we'll do instead is use the thirdweb's Python library, and with ~10 lines of code we'll mint NFTs without any hassle.

I'll guide you through the entire process, let's go 👇🏻

Make you sure have a metamask account set up and some fake ETH, here's step by step guide on how to get that done.

Next head over to thirdweb.com/start, you will be guided through a setup process.

These steps are to get your metamask setup.

These steps are for choosing the chain network, we'll go with the rinkeby testnet.

Our NFT will be minted on this "fake" test network called rinkeby for free.

Now we can create the project to which we'll be adding the NFT module to create NFTs 😋

Adding the NFT module... and volia!

We actually can now mint NFTs straight from the dashboard.

But we don't do that, we're Pythonistas.

Make sure you copy the "module address" from the previous step which we'll use in the code.

Just click on the pill and it'll copy it for you.

Now onto the code.

Using these commands we'll install the thirdweb sdk inside of a virtual environment.

We'll import the thirdweb library and also the private key that you should remember from the metamask guide.

Remember to store your private key safely and do NOT share them with anyone.

We will now instantiate the sdk, add our private key and connect to the blockchain.

We'll also add the NFT module to mint the NFTs.

Finally we're adding details like the name of the NFT,description and the URL of the image that is going to be an NFT.

Run the code and you have just minted your very first NFT with Python, congratulations! 🎉

All it took was 15 minutes of setup and ~10 lines of JavaScript.

If you liked this thread make sure to follow @PrasoonPratham and retweet it.

We'll learn web3 together!

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling