Raxol.Payments.Zksar.TrustScore (Raxol Payments v0.2.0)

Copy Markdown View Source

Aggregates verified ZKSAR attestations into a 0-100 trust score using a diminishing-returns formula.

Each proof type has a base weight. Proofs are sorted by weight descending, and each rank contributes less than the previous:

score = sum(weight_i * diminishing(rank_i))

where diminishing(1) = 1.0 and diminishing(i) = 1 / ln(i + 1) for i > 1. This means the first proof gets full weight, the second gets ~91%, the third ~73%, and so on.

Summary

Functions

Compute aggregate trust score from verified proofs.

Default weight for a proof type.

All default weights.

Functions

aggregate(proofs, opts \\ [])

@spec aggregate(
  [map()],
  keyword()
) :: non_neg_integer()

Compute aggregate trust score from verified proofs.

Options

  • :weights -- override default type weights (map of type -> integer)
  • :max_score -- override maximum score (default: 100)

weight(type)

@spec weight(atom()) :: non_neg_integer()

Default weight for a proof type.

weights()

@spec weights() :: map()

All default weights.