Note

If you are new to the blockchain technology, taking our Introduction to Blockchain Technology self-paced course is highly recommended. Also, for a comprehensive coverage of blockchain development in Ethereum or mastering Solidity programming, taking our below self paced courses is highly recommended:

Recap

In our previous article (How to Create an Account on a Local Private Ethereum Blockchain), we discussed how to create an account on a local private Ethereum network.

In this article, we learn what Ethereum Optional Flags are and how to use them.

Using optional flags with new chains

While we were building a local private blockchain, we used a few command-line options such as –datadir, –identity, –verbosity, and so on. These options are also known as optional flags. They are Ethereum options and are useful for setting up a local blockchain and accessing testnets. Developer chain options support switching to developer mode.

Other options are available for Ethash, transaction pools, performance tuning, account, API and consoles, networking, miner, gas price oracles, virtual machines, logging and debugging, metrics, stats, and options, and so on. Let’s have a look at the following command:

$ geth help or $ geth h

The preceding command will give you a full host of Ethash options. Let’s have a look at the format of the following command:

$ geth [options] command  [command options] [arguments]

 

One-to-One Live Blockchain Classes

Coding Bootcamps school offers One-to-One Live Blockchain Classes for Beginners.

 

You can implement all the options in the commands using the preceding format.

 

Commands

Geth comes with a list of commands and command-line options. Earlier, you saw a few in action, including console, account, attach, and so on. The following is a list of commands that are supported by Geth:

  • account
  • attach
  • bug
  •  console
  • copydb
  • dump
  • dumpconfig
  • export
  • export-preimages
  • import
  • import-preimages
  • init
  • js license
  • makecache
  • makedag
  • monitor
  • removedb
  • version wallet
  • help,h

 

We used geth account new to create new accounts in the previous section. Furthermore, geth account helps you manage accounts:

  $ geth account  list - gives you a summary of existing accounts
  $ geth account update  - updates the existing accounts
  $ geth account import  - imports private  keys for new accounts

Some additional geth commands are as follows:

 

  • geth import: This imports the files of a blockchain
  • geth export: This exports a blockchain to the appropriate files
  • geth copydb: This creates a local blockchain from a source chain data directory path
  • geth removdb: This discards a local blockchain and its databases
  • geth init: This initializes a genesis block from the target genesis JSON file
  • geth js: This executes the target JavaScript files
  • geth attach: This connects to nodes in the network
  • geth console: This opens an interactive JavaScript environment session
  • geth wallet: This manages presale Ethereum wallets
  • geth bug: This automatically brings up the page on GitHub, where you can report the bug

For example, a presale Ethereum wallet can be imported with the following import command:

$ geth wallet  import <path to wallet>presale.wallet

There are other commands that are useful for monitoring your local chain and testing, including dump, dumpconfig, export-preimages, import-preimages, license, makecache, makedag, monitor, and version.

 

Next Article

In our next article (Review of Ethereum Options for Development and Testing), we discuss what Ethereum Options are for application development and testing.

This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.

Resources

Free Webinars on Blockchain

Here is the list of our free webinars that are highly recommended:

 

Free Courses

Here is the list of our 10 free self-paced courses that are highly recommended:

 

Self-Paced Blockchain Courses

If you like to learn more about Hyperledger Fabric, Hyperledger Sawtooth, Ethereum or Corda, taking the following self-paced classes is highly recommended:

  1. Intro to Blockchain Technology
  2. Blockchain Management in Hyperledger for System Admins
  3. Hyperledger Fabric for Developers
  4. Intro to Blockchain Cybersecurity
  5. Learn Solidity Programming by Examples
  6. Introduction to Ethereum Blockchain Development
  7. Learn Blockchain Dev with Corda R3
  8. Intro to Hyperledger Sawtooth for System Admins

 

Live Blockchain Courses

If you want to master Hyperledger Fabric, Ethereum or Corda, taking the following live classes is highly recommended:

 

Articles and Tutorials on Blockchain Technology

If you like to learn more about blockchain technology and how it works, reading the following articles is highly recommended:

 

Articles and Tutorials on Ethereum and Solidity

If you like to learn more about blockchain development in Ethereum with Solidity, reading the following articles and tutorials is highly recommended:

 

Articles and Tutorials on Hyperledger Family

If you like to learn more about blockchain development with Hyperledger, reading the following articles and tutorials is highly recommended:

 

Articles and Tutorials on R3 Corda

If you like to learn more about blockchain development on Corda , reading the following articles and tutorials is highly recommended:

 

Articles and Tutorials on Other Blockchain Platforms

If you like to learn more about blockchain development in other platforms, reading the following articles and tutorials is highly recommended: