Skip to content

Conventions and units ​

The specs in this section describe the interfaces between InferNear's components as they are deployed. The source of truth is the code and docs/interfaces.md in the repository.

Components ​

ComponentRuns onBuilt withPath in the repository
Base vaults and credit top-upBase mainnet (chain 8453)Solidity, Foundry, OpenZeppelincontracts/evm/
Credit ledger (connector)NEAR mainnetRust, near-sdkcontracts/near/
Rhea USDC vaultNEAR mainnetRust, near-sdkcontracts/near/rhea-vault/
Relay: gateway and keeperOne Node process behind api.infernear.devTypeScript, viem, near-api-jsrelay/
Consoleapp.infernear.devReact, Viteweb/

Identifiers ​

ThingFormatExample
EVM usereip155:8453:<address, lower case>eip155:8453:0xdf26ee9d5428ca51a7f9fa26c88bad8367423654
NEAR usernear:mainnet:<account id>near:mainnet:alice.near
Base vaulteip155:8453:<vault address, lower case>
NEAR vaultnear:mainnet:<vault account id>near:mainnet:rhea.infernear-ai.near
API keyinf_…
Accountacc_<32 hex>

The namespace of a vault id names the chain its source_block refers to. An EVM user does not need a NEAR account.

Amounts ​

QuantityUnitNotes
Creditsmicro-USD1,000,000 micro-USD = $1
Model pricesnano-USD per tokenNEAR AI quotes amount at scale: 9
Principal and yieldthe token's own base unitsUSDC has 6 decimals, cbETH and the PT have 18
Ratemicro-USD per 1e18 yield-token base unitsUSDC uses 1000000000000000000, so 1 USDC base unit = 1 micro-USD

On NEAR, integer amounts travel as JSON strings (U128). Block numbers, nonces and pagination arguments are JSON numbers.

Pricing a call ​

cost in micro-USD = ceil(tokens × nano-USD per token / 1000)

The gateway takes a snapshot of the model's input and output prices when it admits a call, and the charge uses that snapshot.

Finality ​

Credits are derived only from finalized chain state.

  • Base vaults and the top-up contract are read at a recent finalized Base block. Finality on Base trails the head by about 20 minutes.
  • The Rhea vault is read at a finalized NEAR block.
  • The price feed for a vault is read at the same block as the vault.

Events on NEAR ​

Both NEAR contracts emit NEP-297 events with standard: "infernear" and version: "1.0.0". Each event carries a one-element data array.

Built at NEAR HACKATHON, 2026. Released under the MIT License.