Skip to content
nokto/docsGitHub (opens in a new tab)

Composition

A composition is a directed, weighted edge: income earned by a source counts toward a principal, the account accumulating.

An agent earning for its owner is one composition. A company's agents composing into the company, and the company into its partners by equity, is the same edge type applied twice. Corporate capital structure is not a subsystem in Nokto; it is a weight on an edge.

Composing requires understanding Accounts first — a composition is a relationship between two accounts, and its weights only mean something once you know what an account's committed aggregate is.

Two weights, two different things

Every edge carries two weights, and they are not the same number:

  • Attribution weight — how much of the source's income counts toward the principal's aggregate.
  • Entitlement weight — how much of that counted income the principal may actually claim.

Attribution is not entitlement. A parent may see all of a subsidiary's revenue attributed to it while only being entitled to claim 60% of it, because it owns 60%. Only entitlement is conserved: entitlement weights leaving a source never exceed 100% in total, because a source cannot promise away more than it earns. Attribution carries no such conservation requirement — it is a statement about what should count, not a promise about what can be withdrawn.

The composition graph has no cycles

If a composed into b and b composed into a, each edge would inflate the other's attested income without bound, and every downstream credit decision built on either aggregate would be poisoned. Nokto rejects cycles by construction: every edge must satisfy depth(source) < depth(principal), where depth is the longest chain of accounts feeding into an account. A cycle would require some account to be strictly deeper than itself, which is impossible — so maintaining that one inequality per edge is enough to guarantee acyclicity without ever walking the graph.

Depth is bounded at a fixed, compile-time MAX_DEPTH, which is 4.

Fan-in — how many sources may compose into one principal — is not currently bounded in-circuit. foldAggregate folds one source per call, and nothing counts how many times it has been called for a given principal; depth is the only structural limit enforced today. A caller can compose an unbounded number of sources into one principal, one createComposition edge and one foldAggregate call at a time.

A constant, MAX_FANIN = 16, already exists for a fan-in-bounded batched fold circuit — folding many sources in one proof instead of one source per proof — but that circuit is not yet built; the entitlement module's own comments describe it as the obvious next step, not a shipped one. The number is measured, not chosen: the proving key for such a batched fold stops growing between fan-in 8 and 16, because PLONK pads to a power-of-two domain, so 8 and 16 cost the same to prove and picking 8 would pay for 16 while using half of it. Today, one proof per source is roughly sixteen times more expensive than a batched fold at that fan-in would be — which is the whole reason batching is worth building.

Aggregation is hierarchical, not a walk

A composition folds a source's already-committed aggregate into the principal's, one bounded step at a time, rather than the principal walking its entire subtree of sources. That is what keeps a disclosure proof's cost independent of graph size: an account with forty income sources proves as cheaply as one with two.

A given (source, principal, period) fold cannot be replayed — enforced by a nullifier over exactly that triple, so the same edge cannot be folded twice in a period. That guarantee is per edge, not per source: if a source reaches the same principal along more than one path (a diamond — A composing into both B and C, and B and C both composing into D), each path folds under a distinct nullifier, and nothing deduplicates A's income across them once it is inside D's aggregate.

An aggregate's assurance tier follows Assurance tiers: folding never makes an aggregate stronger than its weakest contributor.