What you will build
A TypeScript script that:- Creates a Newton client using the SDK
- Simulates a sanctions-screening policy evaluation against a sample transaction intent
- Parses the evaluation response to see whether the transaction was approved or blocked
Prerequisites
- Node.js >= 20 and a package manager (pnpm recommended)
- A Newton API key — create one via the Dashboard API, or email product@magicnewton.com
- Sepolia ETH — for gas fees on testnet (use a Sepolia faucet)
Step 1: Install the SDK
Step 2: Create a Newton client
Create a file calledquickstart.ts:
Step 3: Simulate a policy evaluation
Add the following toquickstart.ts:
Step 4: Understand the response
The simulation returns aSimulateTaskResult:
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the evaluation completed without errors |
result.allow | boolean | Whether the policy approved the intent |
result.reason | string | Human-readable explanation |
error | string | Error message if evaluation failed |
What just happened?
You submitted an intent to the Newton Gateway, where an available operator ran the Rego policy with the PolicyData oracle output and returned an allow/deny result. In production, this same flow produces a BLS attestation that your smart contract verifies on-chain.Next steps
Core Concepts
Understand policies, intents, tasks, and attestations
Integration Guide
Build and deploy a full Newton integration end-to-end
SDK Reference
Full TypeScript SDK documentation
Alternative: AI-assisted build
Alternative: AI-assisted build
The fastest way to build a complete Newton application is to use Claude (or a similar AI coding assistant) with the Newton LLM context files. This approach scaffolds a full-stack app including data oracle, Rego policy, Solidity contract, and Next.js frontend.
Get the LLM context files
Download both Newton LLM context files and place them in your project root. See the LLM context files reference for full usage details.Provide context to your AI assistant
Start a conversation with Claude and provide the LLM context file. Then ask it to build the Newton sanctions-checked transfer app.Example prompt:Using the Newton integration context provided, help me build a complete Newton Protocol app that:
- Creates a WASM data oracle for sanctions checking
- Writes a Rego policy that checks the oracle results
- Deploys the policy via newton-cli
- Deploys a NewtonPolicyWallet on Sepolia
- Builds a Next.js frontend using the Newton SDK
Environment variables
| Variable | Description |
|---|---|
CHAIN_ID | 11155111 (Sepolia) or 84532 (Base Sepolia) |
PINATA_JWT | Your Pinata API JWT token |
PINATA_GATEWAY | Your Pinata gateway URL |
PRIVATE_KEY | Deployer wallet private key (with 0x prefix) |
RPC_URL | Sepolia RPC endpoint |
NEXT_PUBLIC_NEWTON_API_KEY | Newton Protocol API key |
NEXT_PUBLIC_SEPOLIA_ALCHEMY_URL | Alchemy HTTP RPC URL |
NEXT_PUBLIC_SEPOLIA_ALCHEMY_WS_URL | Alchemy WebSocket RPC URL |