How to Create a Digital Non-Fungible Token from a Photo
The first step in creating your very own token or non-fungible token (NFT) is to create an ERC-721 smart contract on the Ethereum blockchain. You can see the documentation on how to do this on the Github page of OpenZeppelin here. Once you have your smart contract set up, you will need to decide what properties or attributes your NFT will have and how those will be represented on the blockchain as an ERC-721 token.
Step 1. Take a Photo
To create an NFT from a photo, it’s important that you have an image that makes sense. For example, if you’re creating a digital collectible of an album cover or a painting, take a photo of both sides of your item. This helps preserve the authenticity and can make sure you retain rights over your image. Of course, if you’re creating an NFT based on something like jewelry or clothing where only one side is visible in photos, feel free to focus on just taking photos of one side. Just be sure to clearly document how many sides there are in case someone tries flipping their item around before they buy it and notices they bought something different than what was advertised!
Step 2. Download & Install OpenZeppelin
Although you could create an NFT from a photo using Solidity and Ethereum, we decided to use OpenZeppelin’s library instead. This is because OpenZeppelin’s implementation has been tested and bug fixed. We trust that they have done their due diligence with creating an NFT from a photo! The key code snippet we will be using is: require(owner == address(this)) allowFreeze; This line of code is needed because if someone other than us tries to create an NFT from our photo, it needs to be able to access our MetaMask wallet for gas payment which requires authorization via MetaMask.
Step 3. Generate Smart Contract on Etherscan
For example, I decided that when I place a photo of my cat on their site, they’ll create an NFT from it and I’ll get 70% of all revenue generated from that token. As you can see in the image below, we start by creating a contract for our NFT. We have three values. We call it to cat and set its initial supply as 1 since there is only one cat (well…one photo of one cat.) We then set its initial owners to address as 0x0000000000000000000000000000000000000000, which is our MetaMask account address where we will initially create tokens for our photo once we register it with CryptoKitties.
Step 4. Mint your token using ERC721Pro
The final step of creating an NFT from a photo is minting your token. For most users, MEW (MyEtherWallet) will be the easiest to use, as it is one of few wallets that allows you to create a new wallet using only a private key. In order for you to create an NFT from a photo using MEW, you will need some WITH (Wrapped Ether). To get you’re WITH into your wallet, send ETH or tokens over and let them get wrapped by MEW.
Step 5. Deploy to Testnet with MyEtherWallet
Creating an NFT from a photo is fairly straightforward. First, you’ll need a wallet that can support NFTs, but not all wallets do at present. We recommend using MyEtherWallet (MEW) because it supports ERC721 and also comes with a variety of other features. MEW offers some degree of security against non-consensual token transfers—and unlike many wallets, it isn’t actually an exchange. You could technically store your tokens there for safekeeping, but in terms of functionality, MEW is aimed squarely at app developers and users who know what they’re doing.
Step 6. Store tokens in SafeWallet or MyCrypto wallet
Create an NFT from a Photo You can create an NFT from a photo using either MyCrypto or SafeWallet. After creating your token, there are two ways you can store it: in MyCrypto Wallet or SafeWallet. In both wallets, you can use Access Your Tokens under Contracts to view and interact with your token.
It’s an exciting time for NFTs, as more and more use cases pop up all over the blockchain. Not only does a successful NFT create value for its ecosystem, but it also makes collecting a fun game that everyone can play. Creating an NFT from a photo is just one of many examples of how these digital assets can be used to generate more value from everyday objects. For example, one token could represent your house or apartment; if someone steals that token, they own your house! Or take a picture of a loved one (or yourself) and mint tokens based on their image; even if you lose your tokens in an unfortunate accident, they live on as long as others possess copies of that image.