This guide walks through deploying your policy files to IPFS and registering them on-chain usingDocumentation Index
Fetch the complete documentation index at: https://docs.newton.xyz/llms.txt
Use this file to discover all available pages before exploring further.
newton-cli. By the end, you will have a deployed PolicyData contract, a deployed Policy contract, and a registered PolicyClient.
Prerequisites
- newton-cli installed:
curl -L cli.newton.xyz | sh && newtup(see CLI Reference) - Pinata account for IPFS pinning (pinata.cloud)
- Sepolia ETH in your deployer wallet
- Completed Writing Data Oracles and Writing Policies
Environment Variables
Create a.env file with deployment credentials:
Step 1: Generate CIDs and Upload to IPFS
policy_cids.json containing the content identifiers.
The
--entrypoint value must match your Rego package name + rule name. For package your_policy with rule allow, use your_policy.allow.Step 2: Deploy PolicyData
Deploy the WASM oracle on-chain:Step 3: Deploy Policy
Deploy the Rego policy on-chain, referencing the PolicyData:Step 4: Deploy Your Smart Contract
Before registering a PolicyClient, you need a deployed contract that inheritsNewtonPolicyClient. Follow the Smart Contract Integration guide, then return here with your deployed contract address.
Step 5: Register PolicyClient
Register your deployed contract with the PolicyClientRegistry:Step 6: Set Policy on Client
Configure the policy and parameters on your PolicyClient:Policy Params Format
On-chain policy params must be flat JSON matching yourparams_schema.json. The gateway reads these bytes directly and passes them to Rego as data.params. Do not use the nested CLI format.
| File | Purpose | Use With |
|---|---|---|
policy_params.json | Template with VAULT_ADDRESS_PLACEHOLDER | Never use directly |
policy_params_live.json | Nested CLI format with real vault address | Reference only |
policy_params_onchain.json | Flat JSON matching the params schema | set-policy-params |
Missing required property during schema validation.
Step 7: Verify
Check that your PolicyClient is registered and active:Next Steps
Frontend SDK Integration
Build a frontend that submits tasks via the SDK