Developer documentation API v1
SCC balances and service metering
Exact monetary representation, atomic commitments and attributable charges.
Reserve, charge and release
Balance representation
The SCC API represents value as integer atoms with an explicit scale. At scale 2, 100 atoms equal 1 SCC. This balance contains 150 SCC outstanding: 130 available and 20 committed. API serialization scale and the decimals of an external token contract are separate properties.
{
"asset": "SCC",
"scale": 2,
"available_atoms": "13000",
"committed_atoms": "2000",
"outstanding_atoms": "15000",
"revision": 7
}Balance invariants
O denotes outstanding SCC, A available SCC and C committed SCC. Outstanding is the current unconsumed credit balance, not cumulative lifetime issuance. A reservation changes availability without changing outstanding value. Consumption reduces the outstanding balance. Each reservation carries an identity, state and revision, with atomic duplicate protection.
Runnable exact-money reservation
This function isolates the balance transformation. The ledger applies it within an atomic transaction that checks the balance revision and reservation identity.
def reserve(available_atoms, committed_atoms, amount_atoms):
values = (available_atoms, committed_atoms, amount_atoms)
if any(type(v) is not int or v < 0 for v in values):
raise ValueError("Expected nonnegative integer atoms")
if amount_atoms > available_atoms:
raise ValueError("Insufficient available balance")
return available_atoms - amount_atoms, committed_atoms + amount_atoms
assert reserve(15000, 0, 2000) == (13000, 2000)Metering and entitlement
Each metered operation pins a service-rate revision and billable quantity definition. Admission can reserve a bounded amount; completion posts the charge and releases the unused commitment according to that rate policy. Partial results, cancellation and dependency failure retain their classified billing outcomes.
Entitlements determine service access, budgets limit consumption, and the SCC ledger records value. Financial mandates independently authorize purchases and withdrawals. The same balance can fund several services without collapsing these controls into one permission.
Exactly one economic posting per charge
A stable usage identity associates the service, agent, task, rate revision and billable quantity with one journal charge. Duplicate deliveries resolve to the existing posting. Unknown usage remains unresolved under its reservation policy rather than being interpreted as zero cost.
The uniqueness guarantee concerns the economic posting, not the number of messages or computation attempts. Multiple delivery attempts can therefore converge on one attributable charge.
Partial-charge ledger trace
All amounts are SCC. The usage charge and reservation have stable identities, so repeated completion events resolve to the same postings.
| Transition | Available | Committed | Outstanding |
|---|---|---|---|
| Initial balance | 150 | 0 | 150 |
| Reserve 20 | 130 | 20 | 150 |
| Consume 12 | 130 | 8 | 138 |
| Release unused 8 | 138 | 0 | 138 |
Atomicity under competing reservations
Two requests can observe the same available amount before either commits. The ledger evaluates the reservation against the current balance revision inside the atomic write, so only a request whose predicate still holds can advance it. A stale request is reevaluated rather than subtracting against an outdated value.
The invariant concerns the authoritative balance. Cached UI values and activity projections can lag without creating additional spending capacity. Reservation identity also distinguishes releasing unused commitment from crediting a second refund.