Explainers

Internal · Gate · inquiry 01

Why the Gate is necessary

If any caller can store a new total, which of those totals is the fact? A stored number does not record who wrote it, or what was given up to produce it. Two callers can each add to a counter and both be finished. The network then has two stories and no way to say which write was admitted.

That is the situation a counter leaves you in. The earlier way of recording value added an amount to a profile total. An addition has one side. It can be repeated. Nothing in the counter can refuse a second addition of the same intent, because the counter never learned the intent’s name. A balance that is only the last number written cannot be the book. The Gate is the refusal of that arrangement.

What “Gate” means here

The SKENAI Gate is one admission. Callers do not set a balance as the way they move value. They present a named event. The Gate either records that event and its lines and adjusts the accounts, or it rejects the presentation, or it recognizes the name and returns the result it already stored.

A signed change of a tenant’s position does not enter as a raw total. XP settlement stands just outside the Gate and turns that change into two lines: the tenant, and the system origin account. Those two lines are what the Gate receives. A caller that already knows the accounts, such as a paid read, may bring the lines itself. In both cases the admission test is the same.

Outside

What a caller may bring

An event name. A source span, which says where the move came from. The lines, or a delta that will be turned into lines. Optionally a correlation id, a gate-decision id, and a description.

In production, value moves by XP settlement into the Gate. The old direct add is not that path.

What stays outside the book

The figure on a profile. After a successful write, the Gate copies the tenant balance onto that figure. People may read the copy. The copy is not what the next write uses as the source of the lines.

The old name for a direct add still exists, outside. It no longer keeps a private counter. It forwards into XP settlement, and from there into the Gate.

Inside

Inside is the admission itself. The checks and the recording happen together, so a caller cannot pass the test and then write a different result.

Presented withThe function does
No event nameRaises an exception. Nothing is inserted.
A name the book already holdsReturns the result already stored, and the tenant’s current balance. No second set of lines is posted.
Fewer than two linesRaises an exception. A single line cannot name a counterparty.
Debits unequal to credits, or both zeroRaises an exception. The network total would change, or the event would be empty.
A new name and balanced linesRecords the event and each line, and adds debit minus credit to each named account.

The accounts, the events, the lines, and the balances are not a surface anyone edits by hand. The designed act is to present an event to the Gate.

What the Gate is protecting, and why

It protects the claim that a balance is the result of admitted lines. Without that claim, a later reader cannot reconstruct the accounts from the events. They can only trust whoever stored the latest total. The Gate is necessary because the network intends to treat that total as a consequence, not as an input.

It also protects a named intent from being issued twice. The same event id is not a second earn. It is the first earn, returned again. That is what makes a retry safe. A counter cannot tell a retry from a new payment.

What this boundary does not close

The core function does not ask whether the tenant’s balance was large enough to spend. Some callers, including the paid-read settlement, refuse an insufficient balance before they call the Gate. The Gate itself does not.

It does not require a model decision, a person, or a job. The correlation id and the gate-decision id may be null. Admission is not yet the same thing as attribution.

At the end of a write, the copy onto the profile will also move the other way if the profile figure is higher: it raises the account up to that figure. That lift is not a pair of lines. The Gate does not protect the book from it.

The checks above sit inside the admission. They are not a short list of who is allowed to ask. Who may present an event to the Gate is a further question. This page does not treat it as already settled.

The question this leaves

The Gate can refuse a write. It has not yet been said, on this page, what the lines must contain for the refusal to stay silent. If a balance is about to rise, which account must fall, and what happens to the sum?