An ERC-721 smart contract template for creating non-fungible tokens (NFTs) with limited supply and storage off-chain.
- Go to the project directory.
cd /projectdirectory- Install the project.
npm install- Install babel-register.
npm install babel-register- Start Ganache in a terminal window.
ganache-cli- Open a new terminal window and compile the contract to run on your local blockchain.
truffle migrate --reset --network development- Start Truffle console.
truffle console- Run tests. Example:
test ./test/test.jsOther test files are located in the 'test' folder.
- To test a single function, create an instance of the contract and run the function.
let instance = await MyNFTProject.deployed()
instance.name()Note: JS test files are designed to run individually, rather than all at once. Each file is focused on a specific area:
- test.js - minting
- test2.js - ownership
- test3.js - supply
- test4.js - state variables
- test5.js - balances
- test_oz.js - functions and events from OpenZeppelin standard contracts
-
To connect to the Ethereum network using a testnet like Rinkeby, you'll need an API from a provider like Infura.io. Enter the API key in the ENV file where noted.
-
When using this smart contract for artwork, you'll need a storage solution like that offered on IPFS (example: Pinata.cloud), to store your image files and your image metadata files. Enter your metadata CID in the ENV file where noted.
-
The owner of the contract will also need a wallet with test ETH. Use a faucet like that offered by Chainlink to receive test ETH: https://faucets.chain.link/
-
Enter the private key of the contract owner's wallet in the ENV file where noted.
-
Change the ENV filename to: .env
-
Update the project name and symbol in the file: contracts/MyNFTProject.sol
-
If you have changed the contract name, update the contract name in the file: migrations/2_mynftproject.js
-
Deploy to Rinkeby.
truffle migrate --reset --network rinkeby- To deploy to another testnet, you'll have to update the truffle-config.js file with the appropriate testnet information.
To report a bug or security-related issue, please contact security@redbuildinggroup.com.
Special thanks to the following organizations and companies for providing the knowledge to create this project, and for empowering industry advancements:
- OpenZeppelin - https://openzeppelin.com/
- Moralis Academy - https://academy.moralis.io/
- DAPP University - https://www.dappuniversity.com/
- Hashlips - https://hashlips.online/HashLips
👤 TRBG
- Github: @redbuilding
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator