Step-1 Install ganache gui interface or ganache-cli by command prompt. With each test account you will get 100 ether for performing transaction in localhost.It runs on 127.0.0.1 (localhost) and port 7545 . Make sure this setting is updated in truffle.config if you are using truffle project .
![](https://i2.wp.com/asifwaquar.com/wp-content/uploads/2020/04/Screenshot-2020-04-21-at-1.28.41-AM.png?fit=688%2C462)
![](https://i2.wp.com/asifwaquar.com/wp-content/uploads/2020/04/Screenshot-2020-04-21-at-1.30.47-AM.png?fit=688%2C318)
Step-2 Choose private key by click on key option and create private network in meta mask by providing url http://127.0.0.1:7545.
![](https://i0.wp.com/asifwaquar.com/wp-content/uploads/2020/04/Screenshot-2020-04-21-at-1.36.37-AM.png?fit=688%2C228)
Create private network in metamask ,Previously ChainID was optional field but in recent release of metamask they made mandatory . By default for localhost chain ID would be 1337
![](https://i1.wp.com/asifwaquar.com/wp-content/uploads/2020/04/Screenshot-2020-04-21-at-1.37.52-AM.png?fit=617%2C1024)
Step-3 – Import private key to connect to localhost account.
![](https://i2.wp.com/asifwaquar.com/wp-content/uploads/2020/04/Screenshot-2020-04-21-at-1.38.13-AM-1.png?fit=617%2C1024)
![](https://i1.wp.com/asifwaquar.com/wp-content/uploads/2020/04/Screenshot-2020-04-21-at-1.38.23-AM.png?fit=617%2C1024)
Step-4 – After paste private key click on import and metamask will be connected to localhost test account to perform transactions.
![](https://i0.wp.com/asifwaquar.com/wp-content/uploads/2020/04/Screenshot-2020-04-21-at-1.42.16-AM.png?fit=617%2C1024)