There are three things that we are going to move from local to remote. Those are IPFS hosting, Ethereum hosting, and Minting invocation.
In the “local everything” setup, we’re going to have all three running locally. That means we’ll run a local IPFS node, a local Ethereum network, and we’ll call the minting function from local.
To run this configuration, you can check out the NFT Minting Quickstart w/ Minty 🌿 post. There’s a quick and easy script
start-local-environment.sh which will run the “local everything” environment.
This setup is perfectly fine for ethereum development. You can deploy smart contracts to your local Ethereum net, you can switch MetaMask to the
Localhost 8545 Network and use MetaMask with your Ethereum net, and you can push assets to your local IPFS node.
But whatever you push to the local Ethereum net and IPFS node will be lost when you turn them off. So let’s start working our way to the more production-ready setups.
First thing we’ll do is offshore the IPFS hosting. To make the data highly available without needing to run your local IPFS node 24/7, you can request that a remote pinning service store a copy of your IPFS data on their IPFS nodes. For this, we can use Pinata.
Pinata gives each user 1GB of free storage space, which is plenty for storing a few NFTs. We also go over this setup in the NFT Minting Quickstart w/ Minty 🌿 post, head over there to get the following setup.
The difference here is that we’ll give Minty access to our Pinata account via JWT and then call
minty pin <id> to pin our .jpeg to Pinata. Remember that Minty is still a locally-running program, eventually we’ll want to have Minty (or a similar program) running on our website such that users can invoke the Minting contracts themselves through their web wallet.
Remote Ethereum Network
The next step towards a production-ready environment is to use an Ethereum testnet instead of running the Ethereum network on our local machine.
We can once again use Minty to deploy our minting contract to an Ethereum test network (instead of a local one), all we have to do is modify some configuration in our Minty project. I won’t go into details here but you should just know that we all we’ll do is tell Minty to deploy to the testnet instead of our local network.
An important difference with this setup is that we will need to visit a faucet to get some test ETH in order to deploy and invoke our minting contract.
Once you have test ETH, you use it to deploy and invoke your minting contract. At this point, your setup will look like this.
At this point, everyone will be able to see your minting contract, and everyone will be able to see any .jpegs that are a result from invokign that minting contract. But you are still the only one able to easily invoke that minting contract.
To make it easy for everyone else, you’ll want to move the minting capability onto your project website. So that users can connect their MetaMask and invoke the minting contract for themselves.
This is where you’ll probably say goodbye to Minty. Minty was good for getting our hands dirty but it was not made to be run on a website. At this point, you’ll want to make your own Minty i.e. you’ll use the web3.js library to build functions that will invoke the minting contract.
This is how most Dapps run these days. A set of contracts are deployed to the blockchain network, and the dapps make those contracts easily invokable from a website.
And the very last step to running a production-ready NFT project is to deploy it to the Ethereum network (the real-deal). But this step actually costs developers A LOT of money, since deploying smart contracts are a significant procedure to perform on the blockchain, and therefore costs a lot of gas.
In this tutorial we went over a number of development stacks that most NFT projects (and most Dapps for that matter) will go through on their way to a production-ready state. As our stacks got more production-ready, we offshored more and more of the stack to remote servers. We used the pinning service Pinata to hold onto our NFT .jpegs, and we showed how one would use an Ethereum testnet to deploy and invoke smart contracts from.