Skip to content
Tushar Bansal edited this page Aug 1, 2020 · 2 revisions

About

Ethereum Wallet to understand how does a transaction occur, how does mnemonic work, and how do accounts get created.

How to Start

Technology

  • Web3
  • React

Project

app.js

Application starts from the app.js file where it loads a navbar having "Import Private", "Import Seed" & "Create Account".

  • Import Private This is for where the user can import the account with the help of the private key. Users need to enter private keys and the account will get imported.

  • Import Seed This is for where the user can import the accounts by giving the mnemonic. As the mnemonic is given in Ganache and after entering the same mnemonic in Metamask, the user can import all the accounts.

  • Create Account Users can create a random account as we get in ganache.

helper.js

This file has the setup of web3 where it is done with ganache. Before running the application, the developer should have ganache to be running at port 7545. In this file, web3 can be configured with the ropsten infura. Developer needs to visit here and create new project and get the project id.

importPriv.js

This file is to import the account with the help of the private key. web3.eth.accounts.privateKeyToAccount is used to get the account and web3.eth.getBalance to get the balance of the account. Transaction are happening with the help of the sendEth file.

importSeed.js

Here accounts are imported from the entered seed and the function generateAddressesFromSeed shows how it is done. In this function the entered mnemonic is from Ganache and its wallet HDpath is m/44'/60'/0'/0/. For more understanding about the path visit this. Transaction are happening with the help of the sendEth file.

image

create.js

In this file, createAccounts creates the accounts. It generated the mnemonic with the help of bip39.generateMnemonic() and then follow the same process as generateAddressesFromSeed inside importSeed.js

sendEth.js

This file has sendTransaction which helps to create transactions. It takes the sender's address, sender's private key, receiver's address, and the amount that needs to be sent. Transactions happen in few steps.

  • Build the transaction
  • Sign the transaction
  • Broadcast the transaction

How to Contribute

  • Do the setup in your local machine
  • Got any enhancement idea? Create issue :)

For more understanding about wallets visit this