Skip to main content
A Newton policy is a Rego program that evaluates whether an Intent should be approved. Policies reference data from two sources: configuration parameters (data.params) and runtime data from WASM oracles (data.wasm).

What Makes Up a Policy

Every policy deployment requires these files:

Data References

Your Rego policy can access three data namespaces:

Your First Policy

Create policy.rego:
This policy:
  1. Defaults to deny (allow := false)
  2. Allows transactions where the oracle reports no sanctions match
  3. Always allows transactions from the configured admin address

Using Intent Fields

The input object contains the Intent fields:

Using Oracle Data

The data.wasm path contains whatever your WASM oracle returned:
A single oracle’s fields appear directly under data.wasm (e.g. data.wasm.price). When a policy reads multiple oracles, each oracle namespaces its output under a pack id (data.wasm.<pack-id>.price) — see Consuming Multiple Oracles.

Consuming Multiple Oracles

A policy can read from more than one PolicyData oracle. When it does, each oracle namespaces its output under a unique pack id, and the network merges them into a single data.wasm object. Your Rego then reads data.wasm.<pack-id>.* and data.params.<pack-id>.*:
See Chaining Multiple Data Oracles for the full merge model and the deny-set pattern, and Policy Packs for prebuilt oracles you can compose.

Parameter Schema

Create params_schema.json to define which parameters contract owners can configure:
Leave properties empty if your policy has no configurable parameters:

Metadata Files

Create policy_metadata.json:
Create policy_data_metadata.json:

Directory Structure

Organize all files into a policy-files/ directory:

Testing Locally

Test your policy with the CLI before deploying:
The --entrypoint value must match your Rego package name + rule name. For package sanctions_check with rule allow, use sanctions_check.allow.
For a full reference on supported Rego syntax, see the Rego Syntax Guide.

Using Identity Data in Policies

Newton provides built-in functions for checking user identity data (KYC status, age, location) within your policies. Identity data is injected by operators from the on-chain IdentityRegistry — you only see boolean check results, never raw personal data.
Identity built-ins are domain-namespaced (e.g., newton.identity.kyc.*). A generic newton.identity.get("field_name") accessor is also available for ad-hoc field access across any domain. See the Rego Syntax Guide for the full reference.

Next Steps

Deploying with CLI

Deploy your policy to IPFS and register it on-chain

Smart Contract Integration

Integrate the policy into your smart contract