Newton CLI
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.
Overview
The Newton CLI enables developers and operators to:
- 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
Build the CLI from source:
The binary will be available at target/release/newton-cli.
Configuration
Most commands support configuration via environment variables or command-line arguments. You can create a .env file in your working directory with common settings:
CHAIN_ID=11155111
PRIVATE_KEY="your_private_key"
RPC_URL="https://eth-sepolia.g.alchemy.com/v2/apiKey"
PINATA_JWT="your_pinata_jwt"
PINATA_GATEWAY="your_pinata_gateway"
Global flags that can be used with any command:
--chain-id: The chain ID to use (can also be set viaCHAIN_IDenv var)--log-format: Log format (full, compact, pretty, json, or minimal)
Command Reference
The commands are organized by workflow, from policy creation to task submission.
Policy Files
Commands for managing policy files and generating content identifiers (CIDs) for IPFS storage.
generate-cids
Generates CIDs for policy files and uploads them to IPFS via Pinata.
Using environment variables:
Create a .env file:
CHAIN_ID=11155111
PINATA_JWT="your pinata jwt"
PINATA_GATEWAY="your pinata gatway"
Then run:
Policy Data
Commands for deploying and testing policy data contracts that store policy information on-chain.
deploy
Deploys a policy data contract with the specified policy CIDs.
Using environment variables:
Create a .env file:
CHAIN_ID=11155111
PRIVATE_KEY="development_pk"
RPC_URL="https://eth-sepolia.g.alchemy.com/v2/apiKey"
Then run:
simulate
Simulates policy data execution locally without deploying to the blockchain.
Policy
Commands for deploying and testing policy contracts that define authorization rules.
deploy
Deploys a policy contract with the specified policy CIDs and policy data address.
Using environment variables:
Create a .env file:
CHAIN_ID=11155111
PRIVATE_KEY="development_pk"
RPC_URL="https://eth-sepolia.g.alchemy.com/v2/apiKey"
Then run:
simulate
Simulates policy evaluation locally without deploying to the blockchain. Useful for testing policies before deployment.
Notes:
- The "data." prefix is automatically added to the entrypoint if not present. You can specify either "max_gas_price.allow" or "data.max_gas_price.allow".
- The
--wasm-argsargument is optional. If not provided, an empty JSON object{}will be used as input to the WASM execution. - The
--policy-params-dataargument is optional. If not provided, an empty JSON object{}will be used for the params field in the policy evaluation.
Policy Client
Commands for configuring policy clients with runtime parameters.
set-policy-params
Sets policy parameters for a policy client contract, including expiration settings.
Using environment variables:
Create a .env file:
CHAIN_ID=11155111
PRIVATE_KEY="development_pk"
RPC_URL="https://eth-sepolia.g.alchemy.com/v2/apiKey"
Then run:
Task
Commands for submitting and managing policy evaluation requests.
submit-evaluation-request
Submits a task for policy evaluation to the prover AVS. The command normalizes the intent, signs the task, and submits it.
Using environment variables:
Create a .env file:
CHAIN_ID=11155111
PRIVATE_KEY="development_pk"
DEPLOYMENT_ENV=stagef # .env only, not exposed as a cli parameter
Then run:
Notes:
- The
DEPLOYMENT_ENVenvironment variable defaults to "prod" if not set. Valid values are "stagef" or "prod". - The command normalizes the intent (converts value/chainId to hex), signs the task, and submits it to the prover AVS.
- The task JSON file should contain fields:
policyClient,intent,quorumNumber(optional),quorumThresholdPercentage(optional),wasmArgs(optional), andtimeout.