{"id":16417291,"url":"https://github.com/cipherzzz/erc721","last_synced_at":"2025-10-26T20:30:25.390Z","repository":{"id":207585782,"uuid":"137798297","full_name":"cipherzzz/erc721","owner":"cipherzzz","description":"Simple ERC721 Token Example","archived":false,"fork":false,"pushed_at":"2018-08-07T20:20:51.000Z","size":13,"stargazers_count":34,"open_issues_count":1,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T07:11:34.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cipherzzz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-18T19:41:22.000Z","updated_at":"2024-01-29T17:47:35.000Z","dependencies_parsed_at":"2023-11-16T16:07:39.734Z","dependency_job_id":null,"html_url":"https://github.com/cipherzzz/erc721","commit_stats":null,"previous_names":["cipherzzz/erc721"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherzzz%2Ferc721","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherzzz%2Ferc721/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherzzz%2Ferc721/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherzzz%2Ferc721/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cipherzzz","download_url":"https://codeload.github.com/cipherzzz/erc721/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238394323,"owners_count":19464583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T07:11:25.037Z","updated_at":"2025-10-26T20:30:20.081Z","avatar_url":"https://github.com/cipherzzz.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\n# A Simple ERC-721 Example\n\nWhat is it?\n\n![](https://cdn-images-1.medium.com/max/2000/0*jr7S0JF8XiousKKz.png)\n\nERC-721 tokens are a hot topic today with the advent of [crypto kitties](https://www.cryptokitties.co/) and a host of other digital collectibles spawned by its success. The [ERC-721 standard](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md) has gone through a couple iterations and is more or less in place now, so expect more and more players to enter this space. The basic premise of these [non-fungible tokens](https://en.wikipedia.org/wiki/Non-Fungible_Tokens) is that each token is unique and therefore cannot be exchanged on a 1:1 basis like an ERC20 token may be. There are many use cases where a unique tangible or digital asset may represented by these ERC-721 tokens, such as real estate, art, precious stones, etc. Actually, the digital collectible use case is probably the lowest market value use case of them all.\n\n### **Purpose of this article**\n\nThis article will attempt to create an ERC-721 in its simplest useful form using the [OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/contracts/token/ERC721) implementation of the [ERC-21 standard](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md). I would recommend looking at the standard linked above in order to familiarize yourself with the requirements as they can be sometimes be hidden in the excellent OpenZeppelin implementations. There is also a fantastic article written [here](https://medium.com/blockchannel/walking-through-the-erc721-full-implementation-72ad72735f3c) that describes in-depth the ERC-721 spec.\n\n### Setup the project\n\nMake sure that you have node, npm and truffle installed\n\n    mkdir erc721 \u0026\u0026 cd erc721 \u0026\u0026 truffle init\n\nReplace the *truffle.js* content with the following:\n\n\u003ciframe src=\"https://medium.com/media/f3ef2f3c60d4dac9bad5fe59ae3f8564\" frameborder=0\u003e\u003c/iframe\u003e\n\nInstall [Ganache](http://truffleframework.com/ganache/) and make sure it is running on 8545\n\nCompile and Migrate\n\n    truffle compile\n    truffle migrate\n\nInit the folder as an npm project\n\n    npm init\n\nInstall zeppelin dependency\n\n    npm install zeppelin-solidity\n\n### The Token\n\nAdd the following to /contracts as *MyERC721.sol*\n\n\u003ciframe src=\"https://medium.com/media/9d1b82940c835e700f785efd4dbb786d\" frameborder=0\u003e\u003c/iframe\u003e\n\nAdd the following migration to /migrations as *2_erc721_migration.js*\n\n\u003ciframe src=\"https://medium.com/media/7d0a5b5eaaab6c02c2f9f1243b70679c\" frameborder=0\u003e\u003c/iframe\u003e\n\nRun the migrate script and verify that it deploys without errors\n\n    Marks-MacBook-Pro:erc721 markmathis$ truffle migrate\n    Using network 'development'.\n\n    Running migration: 2_erc721_migration.js\n    Deploying MyERC721...\n    ...\n    0x25c26fd5b79b6328bee75bd34d78b37ff9389aad2d487600d46595adf0ee398d\n    MyERC721: 0x6d9b92dfaf3cc3ae2e45b37b584f52f23bc03085\n    Saving successful migration to network...\n    ...\n    0x5c147afb3f4c2d225ef3b4cabcd7b9d3b5e4cbab88617fa150b061b85eb4cc0a\n    Saving artifacts...\n\n### Test it out\n\nInstall test libraries\n\n    npm install chai --save-dev\n    npm install chai-as-promised --save-dev\n    npm install babel-preset-es2015 --save-dev\n    npm install babel-register --save-dev\n    npm install babel-polyfill --save-dev\n\nAdd *.babelrc *to project root\n\n    {\n      \"presets\": [\"babel-preset-es2015\"]\n    }\n\nAdd *erc721.spec.js* to /test\n\n\u003ciframe src=\"https://medium.com/media/b9076ee98f1179a46ac48c5f523e3a0b\" frameborder=0\u003e\u003c/iframe\u003e\n\nRun the test from the project root\n\n    truffle test\n\n![](https://cdn-images-1.medium.com/max/3236/1*tZ9h1i5oaWrD8ISiGH5L8w.png)\n\n### Addendum\n\nPretty much all of the regular ERC20 functions are available in the ERC721 contracts. You can approve a third party to spend your token, burn tokens, etc. The functionality is the same, but the inputs and what happens under the covers is a bit more complex. There are a couple ERC721 methods that are not discussed in this article that are worth independent study as well\n\n* safeTransferFrom\n\n* isApprovedForAll\n\n* setApprovedForAll\n\n### Summary\n\nLet’s recap what we learned in this article. First, we setup the project with truffle and imported our dependencies including the world class smart contract library, **OpenZeppelin. **Next, we coded our ERC721 token using the OpenZeppelin — *ERC721Token *template. We ran through a few checks to make sure our contract was valid and then we setup a mocha test to test our assertions. Our solidity code is deceptively simple and I would recommend a deeper dive into the ERC721 standard and the OpenZeppelin implementation. We accomplished our purpose in this article by creating a simple ERC721 token and you should be in a good place to continue your journey in learning this new token type. Even though this token was not ‘fungeable’ — I hope you still had ‘fun’ :)\n\n*Full project source is available* — [here](https://github.com/cipherzzz/erc721)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcipherzzz%2Ferc721","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcipherzzz%2Ferc721","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcipherzzz%2Ferc721/lists"}