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, uploading encrypted secrets, managing privacy data, 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 and policy contracts
- Configure policy clients with parameters, expiration, and lifecycle management
- Upload encrypted secrets for WASM data providers via HPKE
- Encrypt and upload privacy data (identity, confidential, ephemeral)
- Submit evaluation requests to the prover AVS
- Evaluate Rego policies locally with Newton crypto extensions
Installation
Installnewton-cli using the newtup version manager:
newtup (the version manager) and the latest newton-cli binary to ~/.newton/bin/.
Pin a specific version:
Windows does not have prebuilt binaries. Use WSL and follow the Linux install above.
Configuration
newton-cli loads configuration in the following priority order (highest wins):
- Command-line flags (
--chain-id,--rpc-url, etc.) - Environment variables with
NEWTON_CLI__prefix - Config file at
~/.newton/newton-cli.toml(if it exists)
Config File
Create~/.newton/newton-cli.toml for persistent defaults:
Environment Variables
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:Commands
Policy Files
generate-cids
Generates CIDs for policy files and uploads them to IPFS via Pinata.
Parameters
Usage
Policy Data
deploy
Deploys a policy data contract with the specified policy CIDs.
Parameters
Usage
simulate
Simulates WASM execution without deploying. Supports both local and gateway-based simulation.
Local simulation:
Policy
deploy
Deploys a policy contract with the specified policy CIDs and policy data address.
Mainnet policy usage requires allowlisting by the Newton team. Before deploying or using policies on mainnet, reach out through the intake form.
Usage
simulate
Simulates a full policy evaluation (Rego + WASM + secrets) locally.
Parameters
policy simulate and policy-data simulate (gateway mode) delegate to operators for the full data pipeline. Use them to debug Rego logic before going live.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.
register
Registers a PolicyClient contract with the PolicyClientRegistry. Required for identity linking.
Parameters
Usage
set-policy
Sets or updates the policy on a PolicyClient contract (owner-only). Returns a policyId.
Parameters
Usage
set-policy-params
Sets policy parameters for a policy client contract, including expiration settings.
Parameters
Usage
status
Checks the registration status of a PolicyClient.
list
Lists all PolicyClients owned by an address.
deactivate
Deactivates a registered PolicyClient. Prevents new identity links.
activate
Reactivates a previously deactivated PolicyClient.
transfer-ownership
Transfers registry ownership of a PolicyClient contract.
Secrets
Upload HPKE-encrypted secrets for WASM data providers that callsecrets::get() at runtime. Secrets are scoped per policy_data_address — redeploying PolicyData creates a new contract, so you must re-upload secrets for the new address.
upload
Encrypts secrets client-side via HPKE and uploads the sealed envelope to the gateway.
Parameters
Usage
The CLI handles the full workflow: fetches the HPKE public key via
newt_getSecretsPublicKey, seals the envelope with X25519/ChaCha20-Poly1305, and uploads via newt_storeEncryptedSecrets. See Encrypting Secrets for details on the wire protocol.Privacy
Manage HPKE-encrypted privacy data across all three privacy paths: identity, confidential, and ephemeral. All privacy operations encrypt client-side using the key fromnewt_getPrivacyPublicKey.
get-public-key
Fetch the gateway’s HPKE public key for client-side encryption.
identity upload
Upload persistent identity data (KYC, credentials). The data is linked to a policy client on-chain after upload.
confidential upload
Upload provider-managed confidential data (blacklists, allowlists).
ephemeral encrypt
Encrypt ephemeral data for inline use in task requests. Ephemeral data exists only during evaluation and is never stored.
Task
submit-evaluation-request
Submits a policy evaluation task to the Newton network via the gateway.
Parameters
Usage
signature_data for on-chain attestation validation.
The command normalizes the intent (converts
value/chainId to hex), signs the task, and submits it to the Newton Gateway.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) and identity built-ins (newton.identity.*, newton.confidential.*).
eval
Evaluates a Rego query locally.
Parameters
Usage
The
--non-strict flag is required for OPA-compatible evaluation with Newton’s regorus engine.lex
Tokenizes a Rego policy file. Useful for debugging policy syntax.
parse
Parses a Rego policy file and validates its syntax.
ast
Parses a Rego policy file and dumps the abstract syntax tree (AST).
Completions
Generate shell completions for tab-completion of commands, flags, and arguments.bash, zsh, fish, elvish, powershell.
Pre-generated completions are also included in release tarballs under a completions/ directory.
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
Usage
migrate
Runs automated migration for PolicyClient contracts that are incompatible with the current protocol version.
Parameters
Usage
Integration Workflow
A typical workflow for integrating a new smart contract with Newton:
For the full contract-side integration, see the Smart Contract Integration guide.
Supported Chains
Supported Platforms
Troubleshooting
newton-cli: command not found
newton-cli: command not found
Restart your shell or run
source ~/.zshrc. Verify ~/.newton/bin is on your PATH.chain id is required
chain id is required
Pass
--chain-id to the command or set the CHAIN_ID environment variable.Failed to load configuration
Failed to load configuration
For commands that interact with contracts, ensure deployment files exist for your chain. Run with
--quiet to suppress verbose config loading logs.HPKE private key not configured
HPKE private key not configured
The
secrets upload command encrypts client-side. The gateway’s HPKE public key is fetched automatically via newt_getSecretsPublicKey — no local key configuration is needed.IncompatiblePolicyVersion
IncompatiblePolicyVersion
Your policy was deployed with an older factory. Deploy a new policy via the latest factory, then call
newton-cli policy-client set-policy to update. See Version Compatibility.Next Steps
Deploy with CLI
Step-by-step deployment walkthrough
SDK Reference
TypeScript SDK for programmatic integration
RPC API
Interact with the Gateway directly via JSON-RPC