0xB10C / bademeister-go

Implementation of Bademeister, a mempool watcher and recorder, in Golang.
0 stars 3 forks source link

Add library api #7

Open OttoAllmendinger opened 4 years ago

OttoAllmendinger commented 4 years ago

Users of the bademeister library should be able to get a simple snapshot view of the mempool at a time and the development of the mempool over time.

type Mempool interface {
  // timestamp of the last event that changed the mempool
  GetTime(): Time
  GetTransactions(): []Transaction
}

type Bademeister interface {
  // return first Mempool snapshot before this date
  GetMempool(date: Date): Mempool
  // this way we can iterate through mempool 
  GetNextMempool(Mempool): Mempool

  GetConfirmationTime(Transaction): Duration
}

Maybe some sort of streaming interface that returns the list of events that change the mempool would be interesting too (addition and removal of transactions).

We also want to allow easy comparison of data collected by different nodes, so we want to be able to instantiate multiple Bademeister instances that provide the mempools of different nodes.