9

Here is one block of my private blockchain

> eth.getBlock(63)
{
  difficulty: 134290,
  extraData: "0xd783010506846765746887676f312e372e33856c696e7578",
  gasLimit: 4038569465,
  gasUsed: 23114,
  hash: "0xa5d727b111f123e11b6dc5d271697b82a6238f83ab342088e0a1538afce7862d",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000004000000000000200000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x4c558858289c4180d0d2b994a4e009e078731191",
  mixHash: "0xba14e2b605aeacfa68f8345a9e30dd2d37dc4f3f4eba9e8ac8e744ded90ae566",
  nonce: "0x38de415ea086671a",
  number: 63,
  parentHash: "0xa7186a94afe92f0c0fedd1b8aa96e9aa92321e63a0b79d3f68ffe888bfb0239a",
  receiptsRoot: "0x303d0444bf28744722fd53a46144ead61f3515a82b9640603028ebf91f212126",
  sha3Uncles: "0x3633e886ef643c067d6fb7bfc1d2a6bf3eba939bf3cbb522f3894779ac1dd090",
  size: 1709,
  stateRoot: "0xcd4abaafec19113743df0235f06482f3a0b49e546e708055aa7a2382b232601e",
  timestamp: 1484750319,
  totalDifficulty: 8362288,
  transactions: ["0x1bd5825eac201f0f0e1e2c4a9ed5de026edc3f7fb02c4b912ca55c0f50a021fc"],
  transactionsRoot: "0xbaf6819c91ed625a97e974bbc4efd5808970b3b4991b1e2aca0dd537750aafc7",
  uncles: ["0x6f0a9ab0e468112fdcbbecd81ebebf929ca9a38e6a4c864e8164309d3bed42c6", "0xb4dd60c91ab18de3f72ba27ab5934bec66ab01798d18b599d1d298bd29e56204"]
}

How to decode the logsBloom?

2

2 Answers 2

7

There's not really anything to "decode".

A block or transaction bloom filter is a 2048 bit string. Every log that is emitted in a transaction has 0-4 topics. Each topic will set 3 bits to '1' based on the hash of the topic. Later, if you want to know whether a block or transaction has a given topic in one of its logs, you can check to see if those same 3 bits are set. If they aren't set, you know the topic won't be found in any transaction logs. If they are set, you can guess that they probably will be, but you still need to look at the transaction logs to be sure, because bloom filters have a risk of false positives.

3
  • 1
    This is right, other than to say that the bloom includes some addresses in addition to the log topics. Oct 28, 2018 at 14:48
  • That's true, but the addresses are essentially treated as another topic, so you still can't really pull out the data that was put into the bloom filter, you can just test for its presence in the bloom filter.
    – AusIV
    Nov 1, 2018 at 15:21
  • Yes. You’re exactly right. Nov 1, 2018 at 15:37
0

in order to calculate HashNoNonce() value of the pending block logsbloom required without this it is impossible for a miner to verify if the hash he is mining on is corresponding to the particular block(proof of honest during mining). currently, it is not provided by RPC call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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