Skip to content

[IMD] Initial Market Discovery #657

@mojoX911

Description

@mojoX911

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 n parts. 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 for connection_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 to bad makers. Or better add a new category in the offerbook unresponsive makers. Not all bad makers are unresponsive.
  • After each IMD update, the address book in the disc. Maintain a record of all categories.
  • Check from the already known unresponsive makers list 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
No labels

Type

No type

Projects

Status

WIP

Relationships

None yet

Development

No branches or pull requests

Issue actions