SEE BLOG POST WHICH THIS CODE WAS WRITTEN FOR:
https://medium.com/coinmonks/guide-to-creating-your-own-nft-with-javascript-solidity-part-1-of-3-7909b80fae94
SEE THE REAL WORLD PROJECT I CRETAED USING THE LOGIC FROM MY BLOG POST HERE:
https://cryptoghoulz.com
THIS PROJECT IS NOT MEANT TO BE A PROJECT FOR YOU TO USE IN PRODUCTION
IT IS TO HELP YOU UNDERSTAND HOW ALL OF THE MOVING PARTS STICK TOGETHER
GOOD LUCK & HAPPY CODING ๐
1 - YOU NEED TO CREATE A .env FILE (SEE EXAMPLE FILE .example-env)
2 - YOU WILL NEED TO ADD A KEY CALLED PRIVATE_KEYS
PRIVATE_KEYS MUST BE THE PRIVATE KEY OF A WALLET ADDRESS THAT YOU WISH TO BE THE OWNER OF YOUR CONTRACT ONCE DEPLOYED
YOU WILL NEED TO PROVIDE YOUR ACCOUNT WITH SOME TEST CURRENCY IN ORDER TO DEPLOY TO A TESTNET
2 - YOU WILL ALSO NEED TO ADD A KEY CALLED INFURA_ID TO YOUR .ENV
INFURA_ID MUST BE A VALID INFURA PROJECT_ID , WITHOUT THIS YOUR MIGRATION WONT WORK AS IT WONT BE POINTING TO A VALID ETHEREUM NODE
3 - YOUR ABI FILE WILL NOT EXIST UNTIL YOU RUN UNTIL YOU RUN TRUFFLE MIGRATE
** IF ALL ELSE FAILS , WATCH THIS EXCELLENT BEGINNERS VIDEO
https://www.youtube.com/watch?v=CgXQC4dbGUE&t=78s&ab_channel=DappUniversity
This project requires that you use yarn instead of npm commands
If you use npm commands the dependencies will fail to install correctly
1- Install yarn globally:
npm install --global yarn
2- Install project dependencies:
yarn
3- Start the project:
yarn start
YOU WILL FIND AN IPFS FILE (./utils/ipfs.js)
THIS FILE WILL UPLOAD AN IMAGE TO IPFS , UPLOAD A METADATA FILE TO IPFS
AND THEN RETURN YOU BACK THE URLS AND CIDs.
IF YOU LOG OUT THE RETURN DATA FROM THE CALL YOU WILL SEE ALL OF THE ABOVE IN YOUR CONSOLE LOG
YOU WILL NEED TO CALL WITH WITH A VALID IMAGE BLOB OR IMAGE DATA URI FOR IT TO BE A SUCCESSFUL CALL
FOR MORE INFORMATION ON IPFS LOOK HERE:
https://ipfs.io/
1 - TEST CONTRACTS WILL COMPILE & CREATE ABI FILES -- BUT THEY WONT HAVE ANY NETWORK INFORMATION ADDED
truffle compile
2 - DEPLOY CONTRACT ON NETWORK (IN THIS EXAMPLE RINKEBY)
truffle migrate --reset --network rinkeby
3 - RUN MINT SCRIPT ON A SPECIFIC NETWORK (IN THIS EXAMPLE RINKEBY)
truffle exec src/utils/mint.js --network rinkeby