API wishlist: get "distance" from address

I thought of this new API method that could be implemented with a fairly simple SQL query: it would return information related to the token’s history.

Example: app wants to make sure the token was sent once, the holder’s “distance” is 1. This is useful because it tells us it wasn’t obtained from a non-issuer. Or maybe you want to make sure it was not obtained directly from the issuer.

Discussion:

  • If the issuer distributed ASSET from several sites, maybe the distance less or equal to 2 would have to be queried. Then all tokens - even those distributed directly - should better be routed via another address so that no token has distance equal to 1 and 2 would give the desired outcome.
  • Addresses received ASSET multiple times: if one has 1 ASSET obtained through an ICO and 2 purchased on the secondary market (or 0.01 and 183), what then? This isn’t inherently bad for this method, but it can be confusing so expectations would have to be clear. For example, the address’es transactions could be looked up and if you have at least x% of the balance received “directly from the source”, the method would return a percentage number, or some other useful information.
  • There may be other useful information this method can return. Random idea:
  • Distance from given address (not just asset Owner) - if source address is empty, use Owner’s, if not, use provided address
  • Maybe some other more complex information that would normally require a lot more API churn and can be done cheaper server-side

Inputs:

  • Source (issuer or set address)
  • Asset or subasset name
  • Destination (default: 1)

Output:

  • Distance between Destination and Source or Owner
  • 0 if no balance of asset is held at the address
  • Minimum distance (such as 1, 2, 3). Maybe a more complex data structure could be returned (e.g. % with distance 1, % with distance 2, % over distance 3)

What do you guys think?