forked from bitcoin-teleport/teleport-transactions
-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Milestone
Description
Problem statement
Currently, the market is only available via blockchain. Scanning the blockchain, even with a network birthdate, with multiple threads, will still take some time. For mainnet, it can potentially be in hours. It's similar to a node IBD process. Named here as IMD.
This process has to be optimized maximally at the core lib routines for the fastest market scanning. Alternatively a parallel marketplace can be seeded in Nostr for faster background IMD. Later on, ideas similar to utreexos can be adopted for even faster IMD at mobile.
But for now, the core lib has to be optimized maximally at the core lib level.
Basic optimizations.
- start with a static const start date,
NetworkBirthDate, and always sync from this instead of genesis. - Make this configurable in the taker and maker configs. We will release with a sane default. Not needed at app layers yet.
- Run parallel threads and do parallel processing. Break the chain into
nparts. Each part is scanned by an individual thread and a list of candidate transactions (that match the fidelity pattern) is sent to another thread pool forconnection_checkers. - Two thread pools can be effectively used to parallelize two major categories of discovery work. Scanning for candidate transactions in blocks and checking for liveliness for each candidate.
- Only after passing through connection checkings, the Tor addresses get added to
good makers. For failed connections, they get added tobad makers. Or better add a new category in the offerbookunresponsive makers. Not allbad makersare unresponsive. - After each IMD update, the address book in the disc. Maintain a record of all categories.
- Check from the already known
unresponsive makerslist to skip avoidable failures. At connection check, quickly match if it was known as unresponsive; if yes, skip trying the connection check early. Tor connections are expensive and take a lot of time to fail, too.
Advanced
- Other small corners of efficiency that we can harness not listed above.
- More advanced ideas can be added later, such as merkleizing the market data (utreexo), alternate seeding via Nostr, etc. Those can be tackled v0.2.1 onwards.
Metadata
Metadata
Labels
No labels
Type
Projects
Status
WIP