codedamn logo
codedamn

Mainnet vs Testnet vs Ganache

  • Kshitij's profile image
    Kshitij
    Author
Mainnet vs Testnet vs Ganache

Let’s first see the difference between Mainnet, Testnet and Ganache.

Mainnet

  • A mainnet is a network of Blockchain nodes where real cryptocurrency transactions take place. What do I mean by real cryptocurrency ? Cryptocurrency that you need to buy with money.
  • Example – Ethereum Mainnet.
  • You use mainnet when you want to do a cryptocurrency transaction or when you want to deploy your smart contract on the Blockchain.

Testnet

  • A testnet is  a network of Blockchain nodes where fake cryptocurrency transactions take place. What do I mean by fake cryptocurrency ? Cryptocurrency, for which you do not need to pay money.
  • Example – ropsten, rinkeby etc.
  • We can get fake cryptocurrency from a faucet. A faucet is a place which transfers fake cryptocurrency such as ether to your wallet. Visit the ropsten testnet faucet here to get some fake ethers.
  • We use a testnet for testing our smart contract before deploying to the mainnet. As testing of your smart contract on mainnet can cost you money, the best option is to test your smart contract over the testnet and then deploy it to the mainnet.

In the metamask wallet, you can see Ethereum Mainnet and the different testnets, such as rinkeby, ropsten etc.

metamask

Ganache

  • A local blockchain simulator which runs on a system where fake cryptocurrency transactions take place. This system may or may not be a part of the Blockchain network.
  • Ganache is also like a test network where you can test your smart contract for free of cost.
  • Ganache is faster than a testnet. So, if you want to quickly test your smart contract, you can use ganache to deploy your smart contract. As testnet is a simulation of mainnet, it takes time for transactions to get processed (just like mainnet). On the other hand, ganache is running on your system so it is fast.
  • Another difference between ganache and testnet is that testnet is a simulation of the mainnet. Hence, the testnet behaves more like the mainnet.  On the other hand, ganache is a local blockchain running on your system. So it is advisable to test your smart contract on testnet before deploying to the mainnet even though you have tested your smart contract on ganache. Because ganache does not behave like your mainnet.

This is how ganache UI looks like.

ganache

This is all for this blog. If you have any questions please comment below.

Thank You

User avatar