<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ERC-721 on Coderrob</title><link>https://coderrob.com/tags/erc-721/</link><description>Recent content in ERC-721 on Coderrob</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Wed, 03 Nov 2021 16:46:16 -0500</lastBuildDate><atom:link href="https://coderrob.com/tags/erc-721/index.xml" rel="self" type="application/rss+xml"/><item><title>Building a Revealable PFP NFT Contract with ERC-721 and IPFS</title><link>https://coderrob.com/posts/creating-pfp-nft-smart-contracts/</link><pubDate>Wed, 03 Nov 2021 16:46:16 -0500</pubDate><guid>https://coderrob.com/posts/creating-pfp-nft-smart-contracts/</guid><description>&lt;p&gt;A profile-picture NFT contract has one deceptively simple job: connect each token ID to the correct metadata.&lt;/p&gt;
&lt;p&gt;The contract in this post does that with a reveal workflow. Before reveal, every minted token returns the same placeholder metadata. After reveal, token &lt;code&gt;42&lt;/code&gt; returns the metadata assigned to token &lt;code&gt;42&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#000;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;before reveal
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;token 42 -&amp;gt; ipfs://&amp;lt;placeholder-cid&amp;gt;/placeholder.json
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;after reveal
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;token 42 -&amp;gt; ipfs://&amp;lt;metadata-cid&amp;gt;/42.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The useful part is not merely concatenating a number onto a string. We also need to enforce the supply cap, reject nonexistent token IDs, stop minting before disclosure, prove that the final metadata was chosen before deployment, and freeze that metadata after reveal.&lt;/p&gt;</description></item><item><title>Pinning NFT Images and Metadata to IPFS with Pinata</title><link>https://coderrob.com/posts/storing-nft-metadata-in-ipfs-with-pinata/</link><pubDate>Wed, 03 Nov 2021 16:46:16 -0500</pubDate><guid>https://coderrob.com/posts/storing-nft-metadata-in-ipfs-with-pinata/</guid><description>&lt;p&gt;An NFT is not the image.&lt;/p&gt;
&lt;p&gt;For a typical ERC-721 token, the smart contract returns a metadata URI. The metadata document at that URI describes the token and points to its image. If either pointer can be changed without limits, the thing a collector sees can change even though the token itself never moved.&lt;/p&gt;
&lt;p&gt;That is a trust problem.&lt;/p&gt;
&lt;p&gt;In this post, I will use &lt;a href="https://ipfs.tech/"&gt;IPFS&lt;/a&gt; and &lt;a href="https://www.pinata.cloud/"&gt;Pinata&lt;/a&gt; to give the image and metadata layers content-addressed identities. I will also use my &lt;a href="https://github.com/Coderrob/pinata-ipfs-scripts-for-nft-projects"&gt;Pinata IPFS scripts for NFT projects&lt;/a&gt; to pin images independently and pin the finished metadata as a directory.&lt;/p&gt;</description></item></channel></rss>