| Crates.io | newton-cli |
| lib.rs | newton-cli |
| version | 0.1.29 |
| created_at | 2025-11-14 08:15:40.515022+00 |
| updated_at | 2026-01-06 17:19:49.231739+00 |
| description | newton protocol cli |
| homepage | |
| repository | https://github.com/newt-foundation/newton-prover-avs |
| max_upload_size | |
| id | 1932458 |
| size | 478,708 |
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.
The Newton CLI enables developers and operators to:
Build the CLI from source:
cargo build --bin newton-cli --release
The binary will be available at target/release/newton-cli.
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 via CHAIN_ID env var)--log-format: Log format (full, compact, pretty, json, or minimal)The commands are organized by workflow, from policy creation to task submission.
Commands for managing policy files and generating content identifiers (CIDs) for IPFS storage.
Generates CIDs for policy files and uploads them to IPFS via Pinata.
newton-cli --chain-id 11155111 policy-files generate-cids \
--directory policy-files \
--output policy-files/policy_cids.json \
--pinata-jwt "your pinata jwt" \
--pinata-gateway "your pinata gatway" \
--entrypoint "max_gas_price.allow"
Using environment variables:
Create a .env file:
CHAIN_ID=11155111
PINATA_JWT="your pinata jwt"
PINATA_GATEWAY="your pinata gatway"
Then run:
newton-cli policy-files generate-cids \
--directory policy-files \
--output policy-files/policy_cids.json \
--entrypoint "max_gas_price.allow"
Commands for deploying and testing policy data contracts that store policy information on-chain.
Deploys a policy data contract with the specified policy CIDs.
newton-cli --chain-id 11155111 policy-data deploy \
--private-key "development_pk" \
--rpc-url "https://eth-sepolia.g.alchemy.com/v2/apiKey" \
--policy-cids policy-files/policy_cids.json
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:
newton-cli policy-data deploy --policy-cids policy-files/policy_cids.json
Simulates policy data execution locally without deploying to the blockchain.
newton-cli --chain-id 11155111 policy-data simulate \
--wasm-file policy-files/policy.wasm \
--input-json "{}"
Commands for deploying and testing policy contracts that define authorization rules.
Deploys a policy contract with the specified policy CIDs and policy data address.
newton-cli --chain-id 11155111 policy deploy \
--private-key "development_pk" \
--rpc-url "https://eth-sepolia.g.alchemy.com/v2/apiKey" \
--policy-cids policy-files/policy_cids.json \
--policy-data-address "0xdB9578b6c719122ECd30667D84D1fb483c789BC8"
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:
newton-cli policy deploy \
--policy-cids policy-files/policy_cids.json \
--policy-data-address "0xab23A45365F0BF660887B54b42787fA5519eb574"
Simulates policy evaluation locally without deploying to the blockchain. Useful for testing policies before deployment.
newton-cli --chain-id 11155111 policy simulate \
--wasm-file policy-files/policy.wasm \
--rego-file policy-files/policy.rego \
--intent-json policy-files/intent.json \
--entrypoint "max_gas_price.allow" \
--wasm-args policy-files/wasm_args.json \
--policy-params-data policy-files/policy_params_data.json
Notes:
--wasm-args argument is optional. If not provided, an empty JSON object {} will be used as input to the WASM execution.--policy-params-data argument is optional. If not provided, an empty JSON object {} will be used for the params field in the policy evaluation.Commands for uploading Policy address, policy data address, and policy data secrets
Authenticate the CLI with Newton dashboard
newton-cli --chain-id 11155111 newton-dashboard login
Deploys a policy contract with the specified policy CIDs and policy data address.
newton-cli --chain-id 11155111 newton-dashboard upload-policy-and-secret \
--private-key "development_pk" \
--policy-name my-policy \
--policy-address 0x1234567890abcdef1234567890abcdef12345678 \
--policy-data-address 0xabcdef1234567890abcdef1234567890abcdef12 \
--secret-file .env.secret
Commands for configuring policy clients with runtime parameters.
Sets policy parameters for a policy client contract, including expiration settings.
newton-cli --chain-id 11155111 policy-client set-policy-params \
--policy-client "0x..." \
--policy-params policy-files/policy_params_data.json \
--expire-after 1000 \
--private-key "development_pk" \
--rpc-url "https://eth-sepolia.g.alchemy.com/v2/apiKey"
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:
newton-cli policy-client set-policy-params \
--policy-client "0x058b50701c3Bb70B0F7cb4D583f005212679c903" \
--policy-params policy-files/policy_params_data.json \
--expire-after 1000
Commands for submitting and managing policy evaluation requests.
Submits a task for policy evaluation to the prover AVS. The command normalizes the intent, signs the task, and submits it.
newton-cli --chain-id 11155111 task submit-evaluation-request \
--task-json path/to/task.json \
--private-key "development_pk"
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:
newton-cli task submit-evaluation-request --task-json task.json
Notes:
DEPLOYMENT_ENV environment variable defaults to "prod" if not set. Valid values are "stagef" or "prod".policyClient, intent, quorumNumber (optional), quorumThresholdPercentage (optional), wasmArgs (optional), and timeout.