This first part of Decentralized Programming Tutorials. Although I have been programmer for several years, those are my first steps in this exciting space. I appreciate any comments and suggestions that can make it better. I hope you will enjoy and follow along my journey as decentralized programmer!
Learning Objectives
In this post you will learn about Metamask and Ganache.
Ganache:
Ganache-CLI lets you run a personal version of Ethereum blockchain on your computer. That simplifies process of testing your applications, without risking your real funds. [1]
Installation:
Make sure you have Node.js and npm installed. Then use standard npm install command:
npm install -g ganache-cli
Usage
Type ganache-cli to start the client:
ganache-cli
That will output list of available accounts, and private keys associated with them. For example:
Available Accounts
==================
(0) 0xbefa18d9815fe185c287e76bb0e935546b08edbb
(1) 0x8dc320828fa02ee5e2575c8e963b483f4f11dd6c
(2) 0xa8eb8c835861fe21850ed9a5ff5bf02df003449d
(3) 0x3433ee48cfdcb736c7f249680a3746ccfa626428
...
Private Keys
==================
Hidden: even though it's only testnet, it's a good practice to NEVER reveal your private keys!!!
...
HD Wallet
==================
Mnemonic: noodle cross crush jewel echo device someone open buffalo caught donkey control
Copy one or all private keys, you will need it in further steps to import it into Metamask!
MetaMask
It's an interface to Ethereum blockchain. It allows to send transactions without exposing your private keys. By default is running on Ethereum mainnet, but it can be used to work with testnets as well!
Installation
Follow the installation instructions from the website:https://metamask.io/
Using test accounts with Metamask:
- Make sure your ganache is up and running. You will know it if you see the following message in the terminal after running ganache-cli command:
...
Listening on localhost:8545
...
Now open your browser (in my case it is Chrome)
Click on the Metamask's icon to open it up:
Now select the Test Network from the list:
In your case it's Localhost 8545 network. It's the one running by Ganache-CLI.Import account: click on the
Import account and paste one of the private keys that you can find when running ganache-cli command.
Voila!
That get's even better. Check it out, all the accounts are coming with 100 ETH, as for today worth $70 000! Don't get too excited though. Unfortunately those are test ETH ones only, that can be used only for testing.
- Now send a screenshot of your Metamask to a friend that advised you against investing in crypto
- I am using Mac for development. Use commands appropriate for your development environment.