Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory pool synchronization protocol #107

Open
awfm9 opened this issue Feb 23, 2018 · 1 comment
Open

Memory pool synchronization protocol #107

awfm9 opened this issue Feb 23, 2018 · 1 comment

Comments

@awfm9
Copy link
Owner

awfm9 commented Feb 23, 2018

I have defined a transaction exchange protocol that I believe is quite efficient. As the project matures, we should properly document these protocol decisions.

  1. Upon successful connection on the base network layer, the node layer marks a peer as active & sends his memory pool content as bloom filter.

  2. Upon reception of a memory pool bloom filter, a peer creates a list of transaction IDs he has that are not part of the bloom filter and replies with that inventory.

  3. Upon reception of an inventory of transaction IDs, a peer checks which of transaction IDs he still doesn't have and requests them from other peers.

  4. Upon reception of a request of transaction IDs, a peer sends those transactions in his reply.

Currently, the bloom filter uses a false positive ratio of 1%. This leaves us with a 0.01% chance of missing a transaction if we are connected to even just two peers. That should be fine, but we have to verify whether the hash functions of the bloom filter are randomly initialized so that we don't deterministically reproduce the same bloom filter for the same memory pool.

We should also add a queue of pending transaction downloads between step 3) and 4), so that a node requests transactions evenly from all peers, taking into account their reply speed as well.

@awfm9
Copy link
Owner Author

awfm9 commented Mar 1, 2018

The transaction exchange protocol needs to be improved to handle the case of bootstrapping nodes. As we don't have the notion of exchanging blocks, but only block candidates plus requesting the missing transactions, we need a way to request transactions that are part of the consensus state already (outside of the memory pool).

A decent approach would be to include our current parent hash in the bloom filter exchange and include all transactions in blocks after that hash in the bloom filter. From the perspective of the requester, these transactions are equivalent of not being part of the state yet anyway.

@awfm9 awfm9 changed the title Transaction exchange protocol Mempool synchronization Mar 15, 2018
@awfm9 awfm9 changed the title Mempool synchronization Memory pool synchronization protocol Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant