Skip to main content

Core: on-chain execution

Core verifies transaction conditions and zero-knowledge proofs, updates credentials and settles funds within one on-chain call. An instance supports multiple ERC-20 assets, but each request conserves its own asset: one token cannot cover a deficit in another.

GoalEntry pointWhen funds move
Create Notes from public fundsshieldERC-20 is pulled from the public payer at execution
Transfer Notes, make change, combine funding or withdrawtransactInputs and outputs settle atomically under the proof
Establish deferred debit authoritycreateCreditPure creation moves no principal; an authorized service fee may apply
Debit a grantcreditDrawOwner funds are collected and an ordinary Note is issued
Change grant termsupdateCreditNo principal transfer; a service fee may apply
Stop future drawsrevokeCreditSets a revocation bit; previous payments are not clawed back

Private spending authorization, ERC-20 funding authorization and EVM transaction submission are separate. A relay can submit a completed proof but cannot change its signed recipient, amounts, fees or deadline.

Integration sequence​

  1. Select a network and trusted instance; match its address, runtime code identity, ABI and proof artifacts.
  2. Use an SDK to construct outputs and operations, or encode a direct call with the complete ABI.
  3. Identify who provides ERC-20 balance, allowance, private authorization and gas.
  4. Authorize, prove and submit, then check the successful receipt, actual events and required finality.
  5. Update inventory and retain operation identifiers for timeout and reorganization recovery.

Read an instance​

This complete read-only TypeScript example requires Node.js 20+, ethers, and your project’s configured TypeScript runner. Set CHAIN_RPC_URL and CORE_ADDRESS to your selected chain RPC and instance. It neither signs nor submits.

import { Contract, JsonRpcProvider, getAddress } from "ethers";

const rpcUrl = process.env.CHAIN_RPC_URL;
const address = process.env.CORE_ADDRESS;
if (!rpcUrl || !address) throw new Error("Set CHAIN_RPC_URL and CORE_ADDRESS");
const provider = new JsonRpcProvider(rpcUrl);
try {
const core = new Contract(getAddress(address), [
"function VERSION() view returns (uint256)",
"function CHAIN_ID() view returns (uint256)",
"function addressRegistry() view returns (address)",
"function activeNoteTreeId() view returns (uint256)",
"function circuitPaused() view returns (bool)",
], provider);
const [version, chainId, registry, treeId, circuitPaused] = await Promise.all([
core.VERSION(), core.CHAIN_ID(), core.addressRegistry(),
core.activeNoteTreeId(), core.circuitPaused(),
]);
console.log({ version, chainId, registry, treeId, circuitPaused });
} finally {
provider.destroy();
}

A returned version is only one check; it does not establish trust. Tree ID 0 means no active output tree and is not a valid membership tree. Check pause state against the requested operation and instance policy.

Continue with Notes and funding, Credit, and events and confirmation.