Minting NFTs on EVM Chains
NFT Creation with Lighthouse: A Step-by-Step Guide
Last updated
Was this helpful?
NFT Creation with Lighthouse: A Step-by-Step Guide
Last updated
Was this helpful?
NFTs, or Non-Fungible Tokens, are unique digital tokens representing ownership or proof of authenticity for specific items or content on the blockchain. They are unique, meaning no two NFTs are identical, each possessing distinct attributes or information.
Lighthouse offers a perpetual file storage solution built atop IPFS and Filecoin. In this enhanced guide, we delve deeper into utilizing Lighthouse for NFT metadata storage, ensuring durability and accessibility.
To kickstart the process, ensure the installation and accessibility of these essential tools:
installed for executing JavaScript code.
A cryptocurrency wallet like for handling Ethereum transactions. Learn how to
To interact with the Ethereum blockchain, you’ll need an API key from Infura. Here’s how to obtain it:
Visit .
Click on the “Sign Up” button if you are a new user or “Log In” if you already have an account.
Once logged in, go to the Dashboard and click on “Create New Project”.
Enter a name for your project and click "Create".
Upon creation, you'll be provided with the keys and endpoints. The keys include the PROJECT ID
, PROJECT SECRET
, and the endpoints for different Ethereum networks.
Ensure to note down the PROJECT ID
and PROJECT SECRET
, and the endpoint URL you intend to use (for example, the Ropsten Testnet URL if you are deploying on the Ropsten network).
Craft a Solidity smart contract to define and manage your NFT. Here is a basic example using OpenZeppelin's libraries for an ERC721 token:
Use Solidity compiler (solc) to compile the contract. Install Solc and other dependencies via npm:
Compile the contract using the following command:
This will generate the binary and ABI needed to deploy the contract.
Before proceeding to upload your file to IPFS via Lighthouse, you need an API key. Follow these steps to generate one:
Click on the “Get Started” or “Login” button.
Once logged in, navigate to the "API" section in your account dashboard.
Click on “Generate API Key”. You might need to verify your email address if you haven’t already.
Label your API key for easy identification and click “Create”. Your new API key will be displayed.
Make sure to copy and store your API key in a safe place, as it won’t be shown again.
Utilize the Lighthouse SDK to upload files to IPFS seamlessly. Remember to replace 'YOUR_API_KEY_HERE'
with your actual Lighthouse API key.
Using the image URL from Step 5, you'll create a nft-metadata.json
file containing your NFT's metadata.
Create nft-metadata.json
with the following content:
Replace <YourImageIPFSHashHere>
with the actual IPFS hash you received after uploading the image.
Now you will upload the nft-metadata.json
file you created to IPFS using the Lighthouse SDK.
Here’s a detailed step using ethers.js to deploy your contract on the Mumbai testnet. Replace 'YOUR_INFURA_PROJECT_ENDPOINT'
and 'YOUR_INFURA_PROJECT_ENDPOINT'
appropriately.
This step provides an example code snippet to mint your NFT using ethers.js. Adapt the placeholders with actual values.
This comprehensive guide aims to simplify the process of creating, minting, and verifying NFTs, spotlighting the Lighthouse and IPFS integration for metadata storage. Enjoy your NFT creation journey, exploring the endless possibilities within the digital collectible universe!
Visit .
Note: You can also generate the API key from
To verify your NFT, use a blockchain explorer like . Input your contract address, and explore the transactions and minted NFTs. Each NFT's distinct token ID and ownership records enhance transparency and authenticity.