{"id":1196,"date":"2024-07-16T10:47:02","date_gmt":"2024-07-16T01:47:02","guid":{"rendered":"https:\/\/absol.kr\/?p=1196"},"modified":"2024-07-16T10:47:02","modified_gmt":"2024-07-16T01:47:02","slug":"nft-%eb%af%bc%ed%8c%85-%eb%b0%9c%ed%96%89%ec%8b%9c-metadata-ipfs%ec%97%90-%ec%a0%80%ec%9e%a5-%eb%b0%a9%eb%b2%95","status":"publish","type":"post","link":"https:\/\/absol.kr\/?p=1196","title":{"rendered":"NFT \ubbfc\ud305 \ubc1c\ud589\uc2dc metadata IPFS\uc5d0 \uc800\uc7a5 \ubc29\ubc95"},"content":{"rendered":"\n<p>\uc804\uc790\ucc45 NFT\uc758 <code>tokenURI<\/code>\ub294 \uc804\uc790\ucc45\uc758 \uba54\ud0c0\ub370\uc774\ud130\uac00 \uc800\uc7a5\ub41c \uc704\uce58\ub97c \uac00\ub9ac\ud0b5\ub2c8\ub2e4. \uc77c\ubc18\uc801\uc73c\ub85c \uc774\ub7ec\ud55c \uba54\ud0c0\ub370\uc774\ud130\ub294 IPFS(InterPlanetary File System)\uc640 \uac19\uc740 \ubd84\uc0b0 \ud30c\uc77c \uc2dc\uc2a4\ud15c\uc5d0 \uc5c5\ub85c\ub4dc\ud558\uc5ec \ubcf4\uad00\ud569\ub2c8\ub2e4. <\/p>\n\n\n\n<p>\uc5ec\uae30\uc11c\ub294 IPFS\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc804\uc790\ucc45 \uba54\ud0c0\ub370\uc774\ud130\ub97c \uc5c5\ub85c\ub4dc\ud558\uace0, \uadf8 URI\ub97c \uc124\uc815\ud558\ub294 \ubc29\ubc95\uc744 \uc124\uba85\ud558\uaca0\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. IPFS \uc124\uce58 \ubc0f \uc124\uc815<\/h3>\n\n\n\n<p><strong>IPFS \uc124\uce58<\/strong>IPFS\ub97c \uc124\uce58\ud569\ub2c8\ub2e4. <a href=\"https:\/\/ipfs.io\/\">IPFS \uacf5\uc2dd \uc0ac\uc774\ud2b8<\/a>\uc5d0\uc11c \uc124\uce58 \ubc29\ubc95\uc744 \ucc38\uace0\ud558\uc138\uc694.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code># MacOS\nbrew install ipfs\n\n# Ubuntu\nsudo apt install ipfs\n\n# Windows\nchoco install ipfs<\/code><\/pre>\n\n\n\n<p><strong>IPFS \ub370\ubaac \uc2e4\ud589<\/strong><\/p>\n\n\n\n<p><code>ipfs init <\/code><\/p>\n\n\n\n<p>ipfs \uac00 \uc124\uce58\uac00 \uc548\ub418\ub294 \uacbd\uc6b0\uac00 \uc788\ub294\ub370 \uadf8 \ub54c\ub294 snap\uc73c\ub85c \uc124\uce58\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p><code>ipfs daemon<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. \uba54\ud0c0\ub370\uc774\ud130 \ud30c\uc77c \uc0dd\uc131 \ubc0f \uc5c5\ub85c\ub4dc<\/h3>\n\n\n\n<p><strong>\uba54\ud0c0\ub370\uc774\ud130 \ud30c\uc77c \uc0dd\uc131<\/strong><code>metadata.json<\/code> \ud30c\uc77c\uc744 \uc0dd\uc131\ud558\uace0 \uc544\ub798\uc640 \uac19\uc774 \uc804\uc790\ucc45\uc758 \uba54\ud0c0\ub370\uc774\ud130\ub97c \uc791\uc131\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p><code>{ \"name\": \"Example Ebook\", \"description\": \"An example ebook for NFT\", \"image\": \"https:\/\/example.com\/cover.jpg\", \"attributes\": [ { \"trait_type\": \"Author\", \"value\": \"John Doe\" }, { \"trait_type\": \"Genre\", \"value\": \"Fiction\" } ] }<\/code><\/p>\n\n\n\n<p><strong>\uba54\ud0c0\ub370\uc774\ud130 \ud30c\uc77c IPFS\uc5d0 \uc5c5\ub85c\ub4dc<\/strong>bash\ucf54\ub4dc \ubcf5\uc0ac<code>ipfs add metadata.json <\/code>\ucd9c\ub825 \uacb0\uacfc\uc5d0\uc11c <code>Qm...<\/code> \ud615\uc2dd\uc758 \ud574\uc2dc\ub97c \uc5bb\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \ud574\uc2dc\ub97c \uc0ac\uc6a9\ud558\uc5ec \ud30c\uc77c\uc744 \ucc38\uc870\ud569\ub2c8\ub2e4.plaintext\ucf54\ub4dc \ubcf5\uc0ac<code>added Qm... metadata.json<\/code><\/p>\n\n\n\n<p><strong>IPFS URI \uad6c\uc131<\/strong>IPFS\uc758 URI\ub294 \ub2e4\uc74c\uacfc \uac19\uc774 \uad6c\uc131\ub429\ub2c8\ub2e4.plaintext\ucf54\ub4dc \ubcf5\uc0ac<code>https:\/\/ipfs.io\/ipfs\/Qm... <\/code>\uc608\ub97c \ub4e4\uc5b4, \ud574\uc2dc\uac00 <code>Qmabcdef123456<\/code>\uc774\uba74 URI\ub294 <code>https:\/\/ipfs.io\/ipfs\/Qmabcdef123456<\/code>\uac00 \ub429\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. \ud14c\uc2a4\ud2b8 \ud30c\uc77c \uc5c5\ub370\uc774\ud2b8<\/h3>\n\n\n\n<p>\uc774\uc81c <code>test\/ebook_nft.js<\/code> \ud30c\uc77c\uc5d0\uc11c <code>tokenURI<\/code>\ub97c \uc704\uc5d0\uc11c \uc5bb\uc740 IPFS URI\ub85c \uc124\uc815\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>const EbookNFT = artifacts.require(\"EbookNFT\");<br><br>contract(\"EbookNFT\", (accounts) => {<br>    it(\"should mint a new NFT\", async () => {<br>        const ebookNFT = await EbookNFT.deployed();<br>        const tokenURI = \"https:\/\/ipfs.io\/ipfs\/Qmabcdef123456\";<br>        await ebookNFT.mint(accounts[0], tokenURI);<br><br>        const owner = await ebookNFT.ownerOf(0);<br>        assert.equal(owner, accounts[0], \"Owner of tokenId 0 should be accounts[0]\");<br><br>        const retrievedTokenURI = await ebookNFT.tokenURI(0);<br>        assert.equal(retrievedTokenURI, tokenURI, \"Token URI of tokenId 0 should match\");<br>    });<br>});<br><\/code><\/pre>\n\n\n\n<p>\uc774\uc81c <code>tokenURI<\/code>\uac00 \uc2e4\uc81c IPFS\uc5d0 \uc5c5\ub85c\ub4dc\ub41c \uba54\ud0c0\ub370\uc774\ud130 \ud30c\uc77c\uc744 \uac00\ub9ac\ud0a4\ubbc0\ub85c \ud14c\uc2a4\ud2b8\uac00 \ub354 \uc815\ud655\ud558\uac8c \ub3d9\uc791\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. \ud14c\uc2a4\ud2b8 \uc2e4\ud589<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>truffle test<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uc804\uc790\ucc45 NFT\uc758 tokenURI\ub294 \uc804\uc790\ucc45\uc758 \uba54\ud0c0\ub370\uc774\ud130\uac00 \uc800\uc7a5\ub41c \uc704\uce58\ub97c \uac00\ub9ac\ud0b5\ub2c8\ub2e4. \uc77c\ubc18\uc801\uc73c\ub85c \uc774\ub7ec\ud55c \uba54\ud0c0\ub370\uc774\ud130\ub294 IPFS(InterPlanetary File System)\uc640 \uac19\uc740 \ubd84\uc0b0 \ud30c\uc77c \uc2dc\uc2a4\ud15c\uc5d0 \uc5c5\ub85c\ub4dc\ud558\uc5ec \ubcf4\uad00\ud569\ub2c8\ub2e4. \uc5ec\uae30\uc11c\ub294 IPFS\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc804\uc790\ucc45 \uba54\ud0c0\ub370\uc774\ud130\ub97c \uc5c5\ub85c\ub4dc\ud558\uace0, \uadf8 URI\ub97c \uc124\uc815\ud558\ub294 \ubc29\ubc95\uc744 \uc124\uba85\ud558\uaca0\uc2b5\ub2c8\ub2e4. 1. IPFS \uc124\uce58 \ubc0f \uc124\uc815 IPFS \uc124\uce58IPFS\ub97c \uc124\uce58\ud569\ub2c8\ub2e4. IPFS \uacf5\uc2dd \uc0ac\uc774\ud2b8\uc5d0\uc11c \uc124\uce58 \ubc29\ubc95\uc744 \ucc38\uace0\ud558\uc138\uc694. IPFS \ub370\ubaac \uc2e4\ud589 ipfs init ipfs \uac00 \uc124\uce58\uac00 \uc548\ub418\ub294 \uacbd\uc6b0\uac00 &hellip; <a href=\"https:\/\/absol.kr\/?p=1196\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;NFT \ubbfc\ud305 \ubc1c\ud589\uc2dc metadata IPFS\uc5d0 \uc800\uc7a5 \ubc29\ubc95&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1196","post","type-post","status-publish","format-standard","hentry","category-d-service"],"_links":{"self":[{"href":"https:\/\/absol.kr\/index.php?rest_route=\/wp\/v2\/posts\/1196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/absol.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/absol.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/absol.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/absol.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1196"}],"version-history":[{"count":1,"href":"https:\/\/absol.kr\/index.php?rest_route=\/wp\/v2\/posts\/1196\/revisions"}],"predecessor-version":[{"id":1197,"href":"https:\/\/absol.kr\/index.php?rest_route=\/wp\/v2\/posts\/1196\/revisions\/1197"}],"wp:attachment":[{"href":"https:\/\/absol.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/absol.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/absol.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}