thirdweb: Build an NFT Loot Box with thirdweb and IPFS
Learn how to build an NFT loot box with thirdweb and IPFS.
What is thirdweb?
1. Start by navigating to the thirdweb dashboard and connecting your crypto wallet.

2. Select ‘Deploy New Contract':

3. In this tutorial, we’ll create two contracts: one using an ERC-20 token that'll be a reward in the loot box and one for the NFT rewards inside of the loot box that use an ERC-1155 contract.

4. Select ‘Deploy Now’.

5. For this contract, you will need to fill out configuration fields such as the contract’s name, symbol, description, image, and confirm that the wallet address is correct.

6. By default, there will be a supply of 0 tokens.

7. Select ‘Mint’, then enter the desired number of tokens to be minted.


8. Once these tokens have been minted, they’ll be displayed under the ‘Contract Tokens’ section.

9. Now it’s time to mint our NFTs.

10. Select ‘Deploy Now’, then configure the smart contract’s information.


11. Once created, you’ll see your contract’s dashboard.

12. Now it’s time to mint our NFTs.
13. Select ‘Buckets’ from the left sidebar menu, or navigate to console.filebase.com/buckets.

14. Enter a bucket name and choose the IPFS storage network to create the bucket.

15. Now, upload your NFTs to Filebase using the web console and select ‘Folder’, then select the folder that contains your NFT files.
16. You will see your folder uploaded as a single object:

17. Copy the CID of your folder:

18. Navigate to your IPFS Folder using the Filebase IPFS gateway to see your folder’s files:
19. Head back to thirdweb.

20. Open a command line window and install the thirdweb SDK:
21. Open an IDE such as VSCode and insert the following code, replacing the following values:

22. Save this script as mint.js, then run this script with the command:
mint.js, then run this script with the command:23. Refresh your thirdweb dashboard. Your NFTs will be listed.

24. Now it’s time to create the loot box. First, let’s dive into how a loot box works.
25. To create our loot box, start by creating a new Next.js and TypeScript project using the following command:

26. Then, create a new folder called scripts, with a new file called deployPack.mjs. Open this file in your IDE of choice, then insert the following code:
scripts, with a new file called deployPack.mjs. Open this file in your IDE of choice, then insert the following code:27. Save this file, then run it with the command:
28. Next, create another new file in the scripts directory called bundleTokens.mjs.
scripts directory called bundleTokens.mjs.
29. Then, run this script with the command:
Further Reading
Last updated
