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 (Review of Ethereum Developer Chain Options), we discussed what Ethereum Chain Options are and how to use them.

In this article, we learn about Ethereum API and its console options.

 

API and console options

If you have gone through the Setting up a local private Ethereum blockchain, you’ve already encountered a few API and console options:

  • –ipcdisable and –rpcport: The –ipcdisable flag disables the IPC-RPC server.
  • –rpcport decides which listening port to use for the HTTP-RPC server.
  • –rpc starts the HTTP JSON-RPC server. Alternatively, you can use admin.startRPC (addr, port) to start the HTTP JSON-RPC server.
  • In order to access RPC via a browser without request failures (due to same-origin policy), –rpccorsdomain needs to be supplied with the comma-separated set of domains. Like the following command, we start with geth and append the– rpc, and –rpccorsdomain options with a local host, as follows:

$ geth –rpc –rpccorsdomain http://localhost:3000

  • To enable management APIs, use the flags in the format of –{interface}api. For example, –rpcapi is for the HTTP endpoint, while –wsapi is for the WebSocket. The default –ipcapi setting will enable all the APIs for the ipc interface, and db, eth, net, and web3 for the HTTP and WS interfaces. Please enable APIs for different interfaces with caution. All the management APIs are listed in the following  table:

 

Management API namespaces Support Methods
admin Nodes management datadir, nodeInfo, peers, setSolc, startRPC, startWS, stopRPC, stopWS
 

 

debug

 

 

Nodes debugging

backtraceAt, blockProfile, cpuProfile, dumpBlock, gcStats, getBlockRlp, goTrace, memStats, seedHashsign, setBlockProfileRate, setHead, stacks, startCPUProfile, startGoTrace, stopCPUProfile, stopGoTrace, traceBlock, traceBlockByNumber, traceBlockByHash, traceBlockFromFile, traceTransaction,
verbosity, vmodule, writeBlockProfile, writeMemProfile
miner Miner and Ethash DAG management setExtra, setGasPrice, start, stop, getHashrate, setEtherbase
 

personal

Accounts management ecRecover, importRawKey, listAccounts, lockAccount, newAccount, unlockAccount, sendTransaction, sign
 

txpool

Pool and transactions management  

content, inspect, status

Apart from the DApp namespaces such as eth, shh, and web3, geth allows the extra management API namespaces we mentioned previously:

  • Admin allows access to a few RPC methods, giving better control over the Geth instance
  • Debug helps developers debug during runtime
  • Miner provides extra mining settings, and helps developers gain remote control over a mining operation
  • Through a personal API, private keys in the key store can be managed
  • The txpoolAPI allows developers to access the transaction pool, as well as pending and queued transactions.

 

Next Article

In our next article (Review of Ethereum Networking Options), we discuss Ethereum Networking Options.

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: