presets.go raw

   1  package verify
   2  
   3  // A Preset is one public indexer a user can choose, baked in because typing URLs is not a security
   4  // feature. The list is data, not a default: a verdict only exists once the caller picks a quorum,
   5  // and nothing here points at the venue's own gateway.
   6  //
   7  // The Bitcoin entries are Esplora-shaped and were all reachable and mutually agreeing on their tip
   8  // when this list was last checked. The forked chain's entry is a different shape and its node is
   9  // pruned, which is recorded rather than hidden: it answers the tip and recent blocks, and it
  10  // cannot confirm a transaction older than its retention window.
  11  type Preset struct {
  12  	// Name is the operator, which is what agreement is reported against.
  13  	Name string `json:"name"`
  14  	// Chain is "btc" or "xbt".
  15  	Chain string `json:"chain"`
  16  	// BaseURL is the API root.
  17  	BaseURL string `json:"base_url"`
  18  	// Shape is how the endpoints are laid out: "esplora" or "rabid".
  19  	Shape string `json:"shape"`
  20  	// Note says what the operator is and what it cannot do.
  21  	Note string `json:"note,omitempty"`
  22  	// RetentionFromHeight, when set, is the lowest block the indexer still has: a transaction
  23  	// below it cannot be confirmed by this source, and a lookup that comes back empty there is
  24  	// unverifiable rather than absent.
  25  	RetentionFromHeight int64 `json:"retention_from_height,omitempty"`
  26  	// Recommended marks the one a fresh configuration starts with, chosen for reach and size
  27  	// rather than for any relationship with this venue: the most widely used indexer is the
  28  	// least likely to be the party on the other side of a swap.
  29  	Recommended bool `json:"recommended,omitempty"`
  30  }
  31  
  32  // Presets is the baked list, most popular first within each chain.
  33  func Presets() []Preset {
  34  	return []Preset{
  35  		{
  36  			Name: "mempool.space", Chain: "btc", Shape: "esplora",
  37  			BaseURL: "https://mempool.space/api", Recommended: true,
  38  			Note: "the most widely used open-source explorer; pays for itself with Lightning, which is a reason to exist rather than a reason to lie",
  39  		},
  40  		{
  41  			Name: "blockstream.info", Chain: "btc", Shape: "esplora",
  42  			BaseURL: "https://blockstream.info/api",
  43  			Note:    "the reference Esplora deployment; runs on Blockstream's infrastructure",
  44  		},
  45  		{
  46  			Name: "btcscan.org", Chain: "btc", Shape: "esplora",
  47  			BaseURL: "https://btcscan.org/api",
  48  			Note:    "community-run Esplora with its own indexing",
  49  		},
  50  		{
  51  			Name: "mempool.ninja", Chain: "btc", Shape: "esplora",
  52  			BaseURL: "https://mempool.ninja/api",
  53  			Note:    "an independent mempool.space deployment, useful as a second opinion",
  54  		},
  55  		{
  56  			Name: "rabid.pool", Chain: "xbt", Shape: "rabid",
  57  			BaseURL:             "https://pool.rabidmining.com/api/explorer/xbt",
  58  			Note:                "the forked chain's only public explorer: a mining pool's own pruned node, so it answers the tip and recent blocks only. One source is not a quorum, and a pruned one cannot confirm an old funding transaction.",
  59  			RetentionFromHeight: 951771,
  60  		},
  61  	}
  62  }
  63  
  64  // PresetsFor returns the presets for one chain, recommended first.
  65  func PresetsFor(chain string) []Preset {
  66  	var out []Preset
  67  
  68  	for _, preset := range Presets() {
  69  		if preset.Chain == chain {
  70  			out = append(out, preset)
  71  		}
  72  	}
  73  
  74  	return out
  75  }
  76