Launching your NFT project on a Blockchain Testnet

The Config

In the file /backend/src/config.js we will setup how the smart contract will work before deploying it to the Blockchain.

The file itself is very well documented and codeSTACKr covers it in his video linked here:

The Deployment

Hopefully you've saved your work and everything is all set.

In the backend directory we will run the following to deploy our NFT contract using NFTport. It uses the settings from the config.js file.

npm run deploy_contract

Side Note: Smart Contract Source Code

NFTport provides a GitHub repo for their code, here is the link to the collection contract we just deployed:

NFTport Github for Contracts
https://github.com/nftport/solidity-contracts

NFTport Direct link to the collection contract code
https://github.com/nftport/solidity-contracts/blob/master/contracts/collection/templates/NFTCollection.sol

Getting the NFT Smart Contract Address

The Rinkeby testnet is usually pretty quick, but it may take a few minutes to deploy.  Once deployed, run the following command to check:

npm run get_contract

This will get the deployed contract details using the transactions hash from the Deploy Contract command. If it fails, wait a few moments and try again.

For example the following is from the deployment of MetaMarbles on Rinkeby. You can find the file under the build/contract/_contract.json file:

{
  "response": "OK",
  "chain": "rinkeby",
  "contract_address": "0x92B1ac2f5C2857F6BCc7FEf866DFe1B76Be208b5",
  "transaction_hash": "0x3bc1f1a86a8b7fd052914ce34484a96049d5c1587f6332815a96bd9567f51f96"
}

Make a note of the contract_address as we will be using that for our frontend to 'talk' to the blockchain.

On line 84 of the config.js there is an optional setting to put your contract address in, I would do that now while you are working in this area. Certain commands to update your contract require it in order to work.

You can also go to etherscan.io to see your contract:

MetaMarbles Live on Rinkeby
https://rinkeby.etherscan.io/address/0x92B1ac2f5C2857F6BCc7FEf866DFe1B76Be208b5

Updating the Contract

In the video tutorial codeSTACKr goes over each of these commands. They are also in the readme file for the minter-dapp. I have just enabled public minting as I wanted to test on the blockchain without hassle, YMMV for what you'd like to do.

npm run update_public_mint_start_date
npm run update_presale_mint_start_date
npm run update_presale_whitelisted_addresses
npm run update_presale_whitelisted_addresses_remove
npm run update_royalty_share
npm run update_royalty_address
npm run update_base_uri
npm run update_prereveal_token_uri

Wrapping up

We now have a contract on the blockchain and can interact with it.

Next, we will build a frontend so that others can mint NFTs