Available · local simulationSchema 1.0 · pre-release
Quickstart
Part one runs today: evaluate a policy locally with the reference evaluator. Part two shows the hosted protected-operation flow, which is specified but not yet deployed.
1 · Evaluate locally
Requires Node 22 and pnpm 10. The test suite covers each rule, precedence, replay, cooldowns and fail-closed behaviour.
terminal
# from a checkout of the Ravelin Wall repository (access is currently private)
pnpm install
pnpm --filter @ravelin-wall/policy-schema testEvaluate an intent from TypeScript:
evaluate.ts
import {
EMPTY_STATE, EXAMPLE_ENV, EXAMPLE_POLICY, SCENARIOS, evaluate,
} from "@ravelin-wall/policy-schema";
const swap = SCENARIOS.find((s) => s.id === "swap")!;
const result = evaluate(
EXAMPLE_POLICY,
{ ...swap.intent, request_id: "req_001", deadline: EXAMPLE_ENV.now + 120 },
EMPTY_STATE,
EXAMPLE_ENV,
);
console.log(result.decision, result.reason_code); // "ALLOW" null
// Keep result.next_state to evaluate the next request against the new ledger.evaluate() is pure. It takes the time, fee estimate and price as inputs, never mutates state, and returns the next ledger snapshot. The same inputs always produce the same decision. Prefer a UI? The workbench runs the same function in your browser.
2 · First protected operation
agent.ts · proposed SDK◆ pseudocode · not yet runnable
import { ravelin } from "@ravelin-wall/sdk";
const wall = ravelin({ apiKey: process.env.RAVELIN_API_KEY!, chainId: 46630 });
// 1. Register a constrained ERC-4337 account (testnet only).
const account = await wall.accounts.register({ address: SMART_ACCOUNT, chainId: 46630 });
// 2. Create and activate a policy.
const draft = await wall.policies.create(policyDocument);
await wall.policies.activate(draft.id); // requires explicit confirmation
// 3. Submit an operation and inspect the decision.
const op = await wall.operations.create({ account: account.address, to, value, data,
idempotencyKey: crypto.randomUUID() });
// 4. Verify the receipt. Authorization is not inclusion; inclusion is not success.
if (op.decision === "ALLOW") {
const receipt = await wall.operations.waitForReceipt(op.operationId);
}- Constrained account. The agent never holds an unrestricted key. The account only accepts operations carrying a valid Ravelin authorization.
- Explicit activation. Editing a policy never activates it. Activation creates a new version and an audit event.
- Inspect the decision. DENY responses carry a reason code and no transaction hash.
- Verify the receipt. The reservation is finalized with the actual fee only after the receipt is reconciled.
Next
- Policy schema: every rule, unit and precedence rule.
- Errors and operations: reason codes and retry semantics.
- Security model: what the system does and does not protect.