Next head over to thirdweb.com/start, you will be guided through a setup process.
These steps are to get your metamask setup with the thirdweb interface.
These steps are for choosing the chain network, we'll go with the rinkeby testnet.
Our currency 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 our own currency 🤑
Adding the Token module, some details... and ther you go!
We actually can now mint our currency straight from the dashboard.
But we don't do that, we're JavaScript programmers.
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 and the types library.
Additionally you can install TypeScript if you want to.
We'll import the thirdweb library and ethers js for connecting our wallet and also import 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.
Now can add the module address from the dashboard and the finally use it to mint our currency.
This piece of code mints 1000 Pratham coin, notice how we `ethers.utils.parseUnits("1000",18)` instead of just passing '1000'.
Here's why...
Transactions on the blockchains are incredibly precise, upto 18 decimals.
Passing 1 as the amount would not mint 1 Pratham coin but instead mint 0.000...18 zeros...1, to compensate for this we use ethers here.
The number being passed it 1000 x 10^18 = 1000 for the blockchain
Also, we cannot simple use the regular `1000 * (10**18)` math expression in JavaScript because Js is capped to 2^64 - 1 numbers.
Solidity which is on the backend of thirdweb is capped to 2^256 -1 numbers.
tldr; Js cannot handle big numbers, which is why we use ethers.
Now looking at the dashboard you'll see that our cryptocurrency has been minted.
Congrats, now its time to use it 😉
If you liked this thread make sure you retweet it and follow @PrasoonPratham ✅
Want to read this thread later?
Save it as a link and you'll find lots of other awesome web3 content on our portal.
I’m really excited to share what we’ve been working on at Eclipse for the past few months.
Here’s an Eclipse Mainnet 101 🧵
@EclipseFND In 2010 Bitcoin became the first public blockchain that allowed for the transfer of digital currency.
In 2014 came Ethereum which built on Bitcoin’s foundation and added programmability of this digital currency with smart contracts. This allowed for the creation of dApps.
These smart contracts are programs that live on the blockchain and can used for things like
- Defi: Lending, borrowing and exchange protocols
- Real World Assets: Physical or tangible assets like real estate, commodities that can be tokenized
- Identity systems like ENS