Skip to content

Merkleize the utxo set dump (was: gettxoutsetinfo serializedhash doesn't contain the keys?) #7758

Closed

Description

@laanwj

I've stared at the code of https://github.com/bitcoin/bitcoin/blob/master/src/txdb.cpp#L114 for a while, and can't seem to discover where the key (transaction id for the following outputs) is serialized to the HashWriter. I don't think this is happening at all.

As I see it, but I could be confused, is that this is a problem as it means different transactions in the same position with the same outputs will potentially result in the same hash.

Another slight issue (but more of a naming/documentation one) is that nSerializedSize is confusing: it's not the size of the data hashed to hashSerialized, but a differently computed quantity.

Activity

  1. sipa commented on Mar 28, 2016

    @sipa
    Member

    It seems that the old commit of mine (3499ce1) broke this in the chainstate obfuscation PR.

    Shows how often people actually use that function...

  2. laanwj commented on Mar 28, 2016

    @laanwj
    MemberAuthor

    Heh, I only noticed because I actually started using the hashed data in #7759.

  3. paveljanik commented on Mar 29, 2016

    @paveljanik
    Contributor

    Maybe we can remove it completely? Or every developer keeps the old tree with unobfuscated chain data because of already existing tooling to parse files? ;-)

  4. laanwj commented on Mar 29, 2016

    @laanwj
    MemberAuthor

    You're not serious on removing utxo set stats I hope?
    IMO, we need more stats to see what is going on, and how resources are being used, not less.

  5. paveljanik commented on Mar 29, 2016

    @paveljanik
    Contributor

    I'd like to found out the reason why none noticed ;-) I actually use it myself...

  6. laanwj commented on Mar 29, 2016

    @laanwj
    MemberAuthor

    I do I use the hash sometimes to compare multiple nodes for correctness, especially after experimenting.
    Though I must admit running (almost) master everywhere, so I could easily miss this change.

    The RPC test isn't helpful for detecting this either 🐲

    assert_equal(len(res[u'hash_serialized']), 64)

  7. laanwj commented on Mar 29, 2016

    @laanwj
    MemberAuthor

    Discussed on IRC:

    <sipa> wumpus: if we need to fix the serialization for gettxoutsetinfo... maybe we can replace it with a merkleized version?
    <wumpus> sipa: you mean a 6-month masters project for someone? :) or isn't it that bad to do?
    <sipa> wumpus: i don't mean UTXO commitments
    <wumpus> ohh!
    <wumpus> sure, would be good to have a better format
    <wumpus> I'm everything but married to the current one, and apparently we already broke it once without anyone noticing, so (as long as we mention it in the release notes) I'm not against breaking it again
    <sipa> but we can iterate over the utxo entries in order like now, but use an incremental merkle tree hasher (similar to the algorithm used by ComputeMerkleRoot and friends now)
    <wumpus> cool
    <sipa> the overhead would be the same, and you could make it answer queries for specific entries... and it could later just be converted to a commitment structure
    <wumpus> yes, after  the memory improvement for the merkle tree hasher it doesn't have to store all the data in meory
    

    I think this makes sense, as we'll have to break the compatibility anyway, let's use the opportunity to move to a better format.

  8. changed the title [-]`gettxoutsetinfo` serializedhash doesn't contain the keys?[/-] [+]Merkleize the utxo set dump (was: `gettxoutsetinfo` serializedhash doesn't contain the keys?)[/+] on Mar 29, 2016
  9. locked as resolved and limited conversation to collaborators on Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions