8

This is the info of one of the blocks in my private blockchain:

{
  difficulty: 759585,
  extraData: "0xd783010409844765746887676f312e362e32856c696e7578",
  gasLimit: 4712388,
  gasUsed: 0,
  hash: "0xcf3366fbf4b6c9adf63386b1cc1ed03957df28c57f576a5a4ceef4041011d0c0",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x37e5a459dbd48d4d9874e13cc334dab30373cece",
  nonce: "0x40f805725d02472c",
  number: 17000,
  parentHash: "0xaeb4da768e9e9cb4838e37128ffe895a2f8a684bf2a66339659bbb25a6e44a69",
  receiptRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 537,
  stateRoot: "0x8e61e87fbe4df30634472018ffb7c3f7a8315901ace91f9244958e067bf84a6b",
  timestamp: 1467943085,
  totalDifficulty: 10000790891,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
}

In this, what does the difficulty and the totalDifficulty parameters mean?

8

These are explained on the wiki in the JSON RPC README, under the entry for eth_getBlockByHash().

difficulty: QUANTITY - integer of the difficulty for this block.

totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.

[ Where the difficulty itself is a measure of how difficult it is for a miner to mine a new block by finding a hash below a given target. An explanation of the calculations used to set Ethereum's difficulty can be found in this previous thread. ]

6

As Richard already pointed out, the difficulty is the current quantitative measure how hard it is to brute force ('mine') a block.

The total difficulty is the accumulated sum of all blocks difficulty till the block you queried. I recently learned, this is the best indicator for the longest chain, i.e., for a client to determine in case of a fork which chain to stick to. It will stick to the chain with the highest total difficulty.

  • 2
    Hmm. Interesting. In case there was a fork of one block, is it not possible for both the valid blocks to have the same totalDifficulty? – galahad Jul 15 '16 at 18:40
  • 2
    Exactly, that's where the uncles kick in. – Waqar Lim Jul 15 '16 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.