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.
| Goal | Entry point | When funds move |
|---|---|---|
| Create Notes from public funds | shield | ERC-20 is pulled from the public payer at execution |
| Transfer Notes, make change, combine funding or withdraw | transact | Inputs and outputs settle atomically under the proof |
| Establish deferred debit authority | createCredit | Pure creation moves no principal; an authorized service fee may apply |
| Debit a grant | creditDraw | Owner funds are collected and an ordinary Note is issued |
| Change grant terms | updateCredit | No principal transfer; a service fee may apply |
| Stop future draws | revokeCredit | Sets 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
- Select a network and trusted instance; match its address, runtime code identity, ABI and proof artifacts.
- Use an SDK to construct outputs and operations, or encode a direct call with the complete ABI.
- Identify who provides ERC-20 balance, allowance, private authorization and gas.
- Authorize, prove and submit, then check the successful receipt, actual events and required finality.
- 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.