Overview
The Newton CLI (newton-cli) is a command-line interface for interacting with the Newton Policy Protocol AVS. It provides tools for deploying policies, managing policy data, configuring policy clients, and submitting evaluation requests.
With the Newton CLI you can:
- Generate CIDs for policy files and upload them to IPFS via Pinata
- Deploy and simulate policy data contracts
- Deploy and simulate policy contracts
- Configure policy clients with parameters and expiration settings
- Submit evaluation requests to the prover AVS
Installation
Configuration
Most commands accept configuration through environment variables or command-line arguments. Create a.env file in your working directory to set common values:
Global Flags
The following flags can be used with any command:| Flag | Environment Variable | Description |
|---|---|---|
--chain-id | CHAIN_ID | The chain ID to use |
--log-format | — | Log format: full, compact, pretty, json, or minimal |
Commands
Policy Files
generate-cids
Generates CIDs for policy files and uploads them to IPFS via Pinata.
Parameters
| Flag | Required | Description |
|---|---|---|
--directory | Yes | Directory containing policy files |
--output | Yes | Output path for the generated CID JSON file |
--entrypoint | Yes | Policy entrypoint (e.g. max_gas_price.allow) |
--pinata-jwt | No | Pinata JWT (falls back to PINATA_JWT env var) |
--pinata-gateway | No | Pinata gateway (falls back to PINATA_GATEWAY env var) |
Policy Data
deploy
Deploys a policy data contract with the specified policy CIDs.
Parameters
| Flag | Required | Description |
|---|---|---|
--policy-cids | Yes | Path to the policy CIDs JSON file |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
simulate
Simulates policy data execution locally without deploying to the blockchain.
Parameters
| Flag | Required | Description |
|---|---|---|
--wasm-file | Yes | Path to the compiled policy WASM file |
--input-json | Yes | JSON input for the simulation |
Policy
deploy
Deploys a policy contract with the specified policy CIDs and policy data address.
Parameters
| Flag | Required | Description |
|---|---|---|
--policy-cids | Yes | Path to the policy CIDs JSON file |
--policy-data-address | Yes | Address of the deployed policy data contract |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
simulate
Simulates policy evaluation locally without deploying to the blockchain.
Parameters
| Flag | Required | Description |
|---|---|---|
--wasm-file | Yes | Path to the compiled policy WASM file |
--rego-file | Yes | Path to the Rego policy file |
--intent-json | Yes | Path to the intent JSON file |
--entrypoint | Yes | Policy entrypoint (e.g. max_gas_price.allow) |
--wasm-args | No | Path to WASM args JSON file (defaults to {}) |
--policy-params-data | No | Path to policy params data JSON file (defaults to {}) |
- The
data.prefix is automatically added to the entrypoint if not already present. - The
--wasm-argsflag is optional. If omitted, an empty JSON object{}is used. - The
--policy-params-dataflag is optional. If omitted, an empty JSON object{}is used.
Policy Client
Mostpolicy-client subcommands require --registry (the PolicyClientRegistry contract address) and --client (the PolicyClient contract address). The exception is set-policy-params, which uses --policy-client directly.
set-policy-params
Sets policy parameters for a policy client contract, including expiration settings.
Parameters
| Flag | Required | Description |
|---|---|---|
--policy-client | Yes | Address of the policy client contract |
--policy-params | Yes | Path to the policy params data JSON file |
--expire-after | Yes | Number of blocks after which the policy params expire |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
Task
submit-evaluation-request
Submits a task for policy evaluation to the prover AVS.
Parameters
| Flag | Required | Description |
|---|---|---|
--task-json | Yes | Path to the task JSON file |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--api-key | No | API key for gateway authentication (falls back to API_KEY env var) |
| Field | Required | Description |
|---|---|---|
policyClient | Yes | Address of the policy client contract |
intent | Yes | Intent object to evaluate |
timeout | Yes | Timeout for the evaluation |
quorumNumber | No | Quorum number |
quorumThresholdPercentage | No | Quorum threshold percentage |
wasmArgs | No | Additional WASM arguments |
- The
DEPLOYMENT_ENVenvironment variable defaults toprodif not set. Valid values arestageforprod. - The command normalizes the intent (converts
value/chainIdto hex), signs the task, and submits it to the prover AVS.
register
Registers a PolicyClient contract with the PolicyClientRegistry.
Parameters
| Flag | Required | Description |
|---|---|---|
--registry | Yes | Address of the PolicyClientRegistry contract |
--client | Yes | Address of the policy client contract |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
deactivate
Deactivates a registered PolicyClient.
Parameters
| Flag | Required | Description |
|---|---|---|
--registry | Yes | Address of the PolicyClientRegistry contract |
--client | Yes | Address of the policy client contract |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
activate
Reactivates a previously deactivated PolicyClient.
Parameters
| Flag | Required | Description |
|---|---|---|
--registry | Yes | Address of the PolicyClientRegistry contract |
--client | Yes | Address of the policy client contract |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
transfer-ownership
Transfers registry ownership of a PolicyClient contract.
Parameters
| Flag | Required | Description |
|---|---|---|
--registry | Yes | Address of the PolicyClientRegistry contract |
--client | Yes | Address of the policy client contract |
--new-owner | Yes | Address of the new owner |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
status
Checks the registration status of a PolicyClient.
Parameters
| Flag | Required | Description |
|---|---|---|
--registry | Yes | Address of the PolicyClientRegistry contract |
--client | Yes | Address of the policy client contract |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
list
Lists all PolicyClients owned by an address.
Parameters
| Flag | Required | Description |
|---|---|---|
--registry | Yes | Address of the PolicyClientRegistry contract |
--owner | Yes | Owner address to query |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
set-policy
Sets or updates the policy on a PolicyClient contract (owner-only).
Parameters
| Flag | Required | Description |
|---|---|---|
--client | Yes | Address of the policy client contract |
--policy | Yes | Address of the deployed policy contract |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
Version
info
Shows protocol version information.
check-compatibility
Checks if a PolicyClient contract is compatible with the current protocol version or if migration is needed.
Parameters
| Flag | Required | Description |
|---|---|---|
--policy-client | Yes | Address of the PolicyClient contract to check |
--chain-id | Yes | Chain ID where the contract is deployed |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
migrate
Runs automated migration for PolicyClient contracts that are incompatible with the current protocol version.
Parameters
| Flag | Required | Description |
|---|---|---|
--policy-client | Yes | Address of the PolicyClient contract to migrate |
--chain-id | Yes | Chain ID where the contract is deployed |
--private-key | No | Deployer private key (falls back to PRIVATE_KEY env var) |
--rpc-url | No | RPC endpoint URL (falls back to RPC_URL env var) |
--skip-check | No | Skip compatibility check before migrating |
--dry-run | No | Simulate the migration without executing it |
Regorus
Theregorus command wraps the Regorus Rego policy engine with Newton-specific crypto extensions (newton.crypto.ecdsa_recover_signer, newton.crypto.ecdsa_recover_signer_personal).
eval
Evaluates a Rego query locally.
Parameters
| Flag | Required | Description |
|---|---|---|
query (positional) | Yes | Rego query to evaluate (e.g., data.policy.allow) |
-d, --data | Yes | Policy or data files (Rego, JSON, or YAML). Can be specified multiple times. |
-i, --input | No | Input file (JSON or YAML) |
-b, --bundles | No | Directories containing Rego bundles |
-t, --trace | No | Enable tracing |
-n, --non-strict | No | Perform non-strict evaluation (OPA default behavior) |
-c, --coverage | No | Display coverage information |
lex
Tokenizes a Rego policy file. Useful for debugging policy syntax.
Parameters
| Flag | Required | Description |
|---|---|---|
file (positional) | Yes | Path to the Rego policy file |
-v, --verbose | No | Verbose output |