monkeylord / MiniGate

A light weight metanet gateway for bitcoin.
MIT License
16 stars 4 forks source link

Partial DTree enumeration #7

Open xloem opened 4 years ago

xloem commented 4 years ago

The dtree can be enumerated much faster if only the requested key is searched for, and the search starts from the present backwards, instead of the past forwards.

Ideally such an improvement would be paired with a feature to request a past version of a key, or the entire history of a dtree.

monkeylord commented 4 years ago

It's hard to find a way to build complete dtree without download whole history, because electrum protocol does not provide such query like bitdb.

Cache will help a little. Though dtree does not record tx history, tx cache does.

However, maybe we can make the gateway little heavier by listening new blocks on P2P network, so that B/D TXs can be cached ahead of time, if the gateway is intended to be hosted as a service.

xloem commented 4 years ago

It looks like one electrum approach would be to walk the transaction history from either the top or the bottom, using a tx cache, and stop when either the latest or first ("canonical") matching D key is found. Keeps nonrequested tree content out of the cache.

On further thought I'm considering the value of caching everything. Could offer D trees as git remotes someday, or serve folder indices.

Listening on peer network sounds more important than these ideas.