# Dependencies

Name Kind APIs
Chain optional default
Exchange multiple ExchangeProviderAPI

# Roadmap

V0: Existing or 3 months

Not having a reputational index has made retrieval in the current Filecoin network largely unusable. During the next three months, Protocol Labs will likely build a prototype reputation index in the form of a retrieval deal bot. The bot will make deals with storage miners and begin to asses the reliability of different miners.

V0.5: 6 months

Once we have a prototype index, we can make it available as an API as well as a web portal, and begin to integrate it into retrieval clients.

V2: Future

A single point of failure index is insufficent to provide reputation for the network for the long term. Over time, third parties can create competetive indexes.

# Preliminary API

This API is purely speculative

TODO

Sync up with current designs for retrieval deal bot

package reputationalindex

import (
	"time"

	"github.com/filecoin-project/go-address"
	"github.com/filecoin-project/go-state-types/big"
	"github.com/filecoin-project/retrieval-market-spec/docs/components/contentrouting"
	"github.com/filecoin-project/retrieval-market-spec/docs/components/exchange"
	"github.com/ipld/go-ipld-prime"
	"github.com/libp2p/go-libp2p-core/peer"
)

// MinerRecord is a record of a single retrieval miner on the network
// It contains basic information about the miner as well as
type MinerRecord struct {
	// Address is the address for sending payments
	Address address.Address
	// Peer is the peer for this miner
	Peer peer.ID
	// ExchangeOptions are the available protocols for this miner
	ExchangeOptions []contentrouting.ExchangeOption
	// Regions are the regions this miner advertises serving
	Regions []contentrouting.GeographicRegion
	// SuccessRate is the decimal success rate for making retrieval deals with
	// this miner
	SuccessRate big.Int
	// BandwidthAvgBytes is a measurement of the miners average bandwidth
	BandwidthAvgBytes uint64
	// TimeToFirstByte is a measurement of the miner's latency -- how long they
	// take to serve the first byte
	TimeToFirstByte time.Duration
}

// ExchangeSearchOption specifies desired parameters for a given protocol
type ExchangeSearchOption struct {
	ProtocolName exchange.ExchangeProtocolName
	SearchParams ipld.Node
}

// SearchParams configures a search for an appropriate miner
type SearchParams struct {
	AcceptedExchanges    []ExchangeSearchOption
	AcceptedRegions      []contentrouting.GeographicRegion
	MinSuccessRate       big.Int
	MinBandwidthAvgBytes uint64
}

// ReputationalIndexAPI provides information to prospective retrieval clients and
// content distributors about miners on the network
type ReputationalIndexAPI interface {
	SearchMiners() (<-chan MinerRecord, error)
	ListMiners() (<-chan MinerRecord, error)
}