Book Image

Ethereum Cookbook

By : Manoj P R
Book Image

Ethereum Cookbook

By: Manoj P R

Overview of this book

Ethereum and Blockchain will change the way software is built for business transactions. Most industries have been looking to leverage these new technologies to gain efficiencies and create new business models and opportunities. The Ethereum Cookbook covers various solutions such as setting up Ethereum, writing smart contracts, and creating tokens, among others. You’ll learn about the security vulnerabilities, along with other protocols of Ethereum. Once you have understood the basics, you’ll move on to exploring various design decisions and tips to make your application scalable and secure. In addition to this, you’ll work with various Ethereum packages such as Truffle, Web3, and Ganache. By the end of this book, you’ll have comprehensively grasped the Ethereum principles and ecosystem.
Table of Contents (13 chapters)

Using MetaMask and other wallets

You will need a wallet to send and receive the cryptocurrency used in Ethereum. In this recipe, you will learn to install and use MetaMask or another wallet, which can be used for managing accounts and transactions.

Getting ready

MetaMask is a browser-based wallet and it currently works with both Chrome and Firefox. Other wallets are either browser-based or need additional downloads.

How to do it...

MetaMask, Mist, and MyCrypto are some of the popular wallets in the Ethereum ecosystem. Let's look into these options in detail.

MetaMask

  1. Install MetaMask for Chrome or Firefox from the respective app store.
  2. Select MetaMask from the extensions tab and Accept both Privacy and Terms and Conditions after carefully reading them. Then, you will be asked to create a password to encrypt your wallet storage:
  1. MetaMask will generate a random 12-word mnemonic that you can use to restore your account at a later point in time. Save it somewhere safe and secret as this is the only way to regain access to your account:
  1. Your account has now been successfully created. You can now use MetaMask with all supported websites for signing transactions:
  1. You can connect to various Ethereum networks using MetaMask. This includes connecting to the main-net, test nets, or any other RPC ports you have access to. This can be configured from the network selector drop-down in the top-left corner.
  2. You also have the option to add additional accounts or to export the private key of the current account. These options let you configure MetaMask as per your requirements.

MyCrypto

  1. Using MyCrypto is as simple as navigating to https://mycrypto.com/. It offers an intuitive UI to interact with Ethereum:

  1. Either use an existing wallet or create a new one. The web interface of MyCrypto has limited support for creating/using wallets through PrivateKey, Mnemonic, or keyfile. This restriction is enabled to use a strong password while creating your wallet. Once your wallet is created, you can export your private key and KeyFile. Save it in a secure place and do not lose it. It cannot be recovered!
  2. To use MyCrypto, you can import the private Key/KeyFile you created in step 2 or use external wallets such as MetaMask/Mist/Hardware.
  3. MyCrypto also has options to deploy and interact with contracts, use Ethereum name service, or even swap your Ether for other cryptos.

Ethereum wallet–Mist

  1. Download and install the Mist or Ethereum wallet from https://github.com/ethereum/mist/releases. Mist is a browser for decentralized web apps. The Ethereum wallet is a Mist implementation that can only access a single Decentralized Application (DApp), which is the wallet DApp.
  2. You can select the network from Network under the Develop menu of Mist. You can choose between the main network, test networks, or your own private network.

Using the Ethereum wallet DApp, you can send/receive transactions and deploy/interact with smart contracts.

Never send your account credentials to anyone or use them with unknown websites. Make sure that you are using a trusted wallet or exchange while using cryptocurrencies. Typos in addresses can make you lose your funds. Double-check the address before making any transactions.