header-langage
简体中文
繁體中文
English
Tiếng Việt
Scan to Download the APP

Teach you to get the first week of NFT of Alchemy Road to Web3

2022-08-16 16:31
Read this article in 25 Minutes
总结 AI summary
View the summary 收起

/blockquote>
Original author: Greta


What is Alchemy?


In December 2019, Alchemy completed US$15 million Series A financing, with Pantera Capital, Stanford University, Coinbase, Samsung, etc. .


In April 2021, Alchemy completed its  US$80 million Series B round of financing at a valuation of US$505 million, led by Coatue and Addition DFJ Growth, K5 Global, Chainsmokers (smoker combination), actor Jared Leto and the Glazer family participated in the vote.


In October 2021, Alchemy completed its  US$250 million Series C financing at a valuation of US$3.5 billion, led by a16z of.


In February 2022, Alchemy completed a financing of US$200 million at a valuation of US$10.2 billion, led by Lightspeed and Silver Lake.


Alchemy is a team with a strong background, sufficient funds, practical work, and no currency issuance.


And, Alchemy plans to use the new funds to promote Web3 adoption, some of which include the launch of Web3 University, now Road to Web3 10 weeks, one NFT per week. After looking at the very small number of NFTs, it is estimated that due to the difficulty of the task, many small partners simply gave up. If such a project is airdropped, it is definitely a big deal.


The first week of the tutorial begins: How to use Alchemy to develop NFT smart contracts (ERC721)



Official original versiontutorial link, which has a 50-minute video tutorial and a long text tutorial. I will give you an easy-to-operate graphic tutorial according to my practice.


step1 Use the OpenZeppelin Contract Wizard to develop an ERC721 smart contract.


1. The first thing to do when developing an ERC721 NFT smart contract is Enter the Open Zeppelin smart contract wizard page.


After entering the page, you will see the following editor:



2. Click the ERC721 button in the upper left corner, select the ERC standard type to use, and enter the Name and Symbol:



3. Check the NFT (ERC721) token function as shown in the picture:


3. p>



After checking, the code on the right is as follows:


p style="text-align:center;">

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

< p>

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

import "@openzeppelin/contracts/token/ERC721/ extensions/ERC721Enumerable.sol";

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";

import "@openzeppelin/contracts/access/Ownable. sol";

import "@openzeppelin/contracts/utils/Counters.sol";

contract Alchemy is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {

    using Counters for Counters.Counter;

    .Counter private _tokenIdCounter;

    constructor() ERC721("Alchemy", "ALCH") {}

< p>

    function safeMint(address to, string memory uri) public onlyOwner {

        uint256 tokenId = _tokenIdCounter.current();

        _tokenIdCounter.increment();

        _safeMint(to, tokenId);

        _setTokenURI(tokenId, uri);

    }

    // The following functions are overrides required by Solidity.

    function _beforeTokenTransfer(address from , address to, uint256 tokenId)

        internal

        override(ERC721, ERC721Enumerable)

    {

        super._beforeTokenTransfer(from, to, tokenId);

    }

    function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {

        super. _burn(tokenId);

    }

    function tokenURI(uint256 tokenId)

          public

        view

        )

        returns (string memory)

    {

        return super .tokenURI(tokenId);

    }

    function supportsInterface(bytes4 interfaceId)< /p>

          public

        view

        override(ERC721, ERC721Enumerable)

        returns (bool)

    {

        return super .supportsInterface(interfaceId);

    }

}


step2 Use REMIX IDE to modify and deploy the ERC721 contract


1. First, you may have noticed that at the top of the OpenZeppelin Wizard editor , there is an "Open in Remix" button, clicking it will open the REMIX IDE in a new tab in your browser.



2. Delete line 17 onlyOwner, otherwise only the owner of the smart contract (the wallet address where the smart contract is deployed) is allowed to mint NFT.



3. On line 14 Fill in uint256 MAX_SUPPLY = 100000;



4. Add require(_tokenIdCounter.current() <= MAX_SUPPLY, "I'm sorry we reached the cap"); on line 19;



step3 create a free alchemy account


1. First, go to alchemy.com , click "Login" and create a new account:



2. Enter Dashboard and click create app.



3. As shown in the figure, the name and description can be input freely, At the bottom, select Rinkeby of the Ethereum chain, and click Create app.




4. After the creation is complete, go back to the dashboard, click the "VIEW KEY" button, and then copy the HTTPS URL:


< /p>


step4 Add Alchemy Rinkeby to Metamask wallet


< p>1. Click Add Network.



2. Fill in the Rinkeby network and RPC URL information and save.



3. To get Rinkeby Test ETH, simply navigate to rinkebyfaucet.com , copy the wallet address into the text field, and click "Send Me ETH". After 10-20 seconds, you should see Rinkeby ETH appear in your Metamask wallet.



step 5 Compile and deploy NFT smart contracts on the Rinkeby test network


1. Go back to Remix, click the compiler menu on the left side of the page, select version 0.8.4, check Auto compile, then click the "Compile" button:



2. Then click the "Deploy and Run Transactions" menu, click the Environment drop-down menu and select "Injected provider (Metamask)", click contract to select the Alchemy one, and click deploy.



3. A Metamask pop-up window will appear, click OK ”, and then continue to pay the Gas fee.



4. If everything worked as expected, after 10 seconds you should see the contract under Deployed Contracts:



step6 Create and upload metadata on IPFS


1. First , go to filebase.com  to create a new account.


After logging in, click the bucket button on the left menu, and create a new bucket (name it yourself, duplicate name is not acceptable):



2. Navigate to storage bucket, click the upload button, and upload the image you want to use for the NFT, suggest the following.



3. Click it after uploading and copy the IPFS gateway URL :



4. Create a txt document and paste the following JSON code And save the file as "metadata.json". Note that the third line of image is changed to the link just now.


  "description": "This NFT proves I've created and deployed my first ERC20 smart contract on Rinkeby with Alchemy Road to Web3",

  "external_url": "Alchemy.com",

  "image": "https:/ /ipfs.filebase.io/ipfs/bafybeihyvhgbcov2nmvbnveunoodokme5eb42uekrqowxdennt2qyeculm",

  "name": "A cool NFT", 

  "attributes": [

    {

      "trait_type": "Base", 

      "value": " Starfish"

    }, 

    {

      "trait_type": "Eyes",  

      "value": "Big"

    }, 

    {< /p>

      "trait_type": "Mouth", 

      "value": "Surprised"

    }, 

    {

      "trait_type": "Level", 

      "value": 5

    }, 

    {

      "trait_type": "Stamina", 

      "value": 1.4

    }, 

    {

      "trait_type": "Personality", 

      "value": "Sad"

    }, 

    {

      "display_type": "boost_number", 

  p>

      "trait_type": "Aqua Power", 

      "value": 40

    ; }, 

    {

        "trait_type": "Stamina Increase", 

      "value": 10

    }, 

    {

      "display_type": "number", 

      "trait_type": " "Generation", 

      "value": 2

    }

  ; }


5. Go back to Filebase and upload the metadata.json file in the same bucket where we uploaded the image.



6. Finally, click on the CID and copy it, you'll need it in the next section to build the NFT's token URI:


< img src="https://image.blockbeats.cn/upload/2022-08-16/925ddfd5629672ed210c1378382c1849ad79ceda.png?x-oss-process=image/quality,q_50/format,webp">


step7 Mint Your Rinkeby NFT


1. Go back to Remix and in the Deploy & Run Transactions menu, go to "Deployed contract" - then click on the contract we just deployed. Click on the safeMint drop down box and paste your address and the following string into the uri (copy where cid was) field.


ipfs://\<your\_metadata\_cid>



As shown above, clicking on the transaction will create a Metamask popup prompting you to pay the gas fee.


Click "Confirm" and proceed to minting your first NFT!


2. Wait a few seconds, to make sure the minting passed successfully, copy and paste your address into the balanceOf method input and hit call, it should show you have 1 NFT.



3. Insert "0" as id parameter in tokenUri, hit call, it should display your tokenURI.



step8 in Visualize your NFT on OpenSea


1. Go to testnets.opensea.ioAnd login with your Metamask wallet. Then click on your profile picture and you should see your newly minted NFT there.



2. If the image is not already visible, click it, then click the Refresh Metadata button.



3. Sometimes OpenSea has difficulty recognizing testnet metadata - and it can take up to 6 hours to see it. After some time, your NFT should look like this:



Congratulations, you have successfully created, modified and Deploy your first smart contract. Minted your first NFT and published your image on IPFS!


step9 Submit Task


Click link to enter and submit relevant information.


step10 Receive NFT


Click link to claim NFT.


Original link


https://t.me/theblockbeats

Telegram 交流群:https://t.me/BlockBeats_App

Twitter 官方账号:https://twitter.com/BlockBeatsAsia

举报 Correction/Report
This platform has fully integrated the Farcaster protocol. If you have a Farcaster account, you canLogin to comment
Choose Library
Add Library
Cancel
Finish
Add Library
Visible to myself only
Public
Save
Correction/Report
Submit