4

Exactly which addresses are included in the transaction receipts bloom filters? I know that each 'address' in the logs of the receipt are include (as are the event signature and the indexed event parameters).

I'm confident (but curious if I'm correct) that the to and from addresses from the transaction are not in the receipt's bloom filter.

I'm also confident (but again curious) that any address into which the transaction may have 'called' are included in the bloom filter (on Parity--not sure about geth).

I don't know either way if the 'contractAddress' field is include on contract creation, nor if the winning miner's address is included.

Is there definitive documentation somewhere (other than the brutally difficult one paragraph yellow paper description of the bloom filters) that explains exactly which addresses are and are not in the bloom?

6

[I had to look at the code for this, so you might have to dig a bit more if the below isn't quite complete. (I think I've followed it correctly.) This is the Geth implementation.]

The bloom filters are created in bloom9.go, by passing the receipt logs to CreateBloom().

func CreateBloom(receipts Receipts) Bloom {
    bin := new(big.Int)
    for _, receipt := range receipts {
        bin.Or(bin, LogsBloom(receipt.Logs))
    }

    return BytesToBloom(bin.Bytes())
}

From here the general call chain is LogsBloom() -> bloom9() -> Keccak256(), which can be followed in the same file.

The first of these functions shows us the contents: the log address, and a list of topics.

func LogsBloom(logs []*Log) *big.Int {
    bin := new(big.Int)
    for _, log := range logs {
        bin.Or(bin, bloom9(log.Address.Bytes()))
        for _, b := range log.Topics {
            bin.Or(bin, bloom9(b[:]))
        }
    }

    return bin
}
  • 1
    Do me a favor? Edit your answer to remove everything starting with "The receipts don't appear to be processed..." and then copy in the code for this function: github.com/ethereum/go-ethereum/blob/…. The answer is in this code (the log's address plus is list of topics are included in the bloom filters). If you do that, I will accept this answer. Your answer is good, but it over complicates itself. I was only asking what values went in to make up the bloom filter. Thanks. I hope it's okay to ask for edit to an answer. – Thomas Jay Rush Jun 9 '17 at 9:10
  • Hi Thomas - understood. Thanks for helping weed out the unnecessary parts. – Richard Horrocks Jun 9 '17 at 11:31

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.