Expand description
Incentive layer for deCDN.
Manages off-chain USDC payment pools, bonding interactions via
CapacityBond, and voucher lifecycle (creation, validation, on-chain
settlement).
Exposes the off-chain payment-voucher primitives — EIP-712
signing/verification (voucher) — required for cdn/client/v1, the
keystore→signer bridge (eth_identity, #406) used by both
decdn key-gen and the runtime to load a PrivateKeySigner, and the
alloy::sol! contract bindings for the on-chain surface the node consumes
(capacity_bond reads, payment_pool reads + writes, erc20
approve). A PaymentPool fans one owner’s deposit out across many capped
signers and many nodes: the owner opens a pool with openPool, authorizes
each signer off-chain with a capability::Capability, and a signer’s
per-(pool, provider) voucher lane accrues cumulative amount/bytes as
redeem/redeemMany pays it down. The seller-side on-chain settlement
path (PoolOpened/Redeemed → persist per-lane watermark in
lane::LaneState, PoolCloseInitiated → grace-window monitor,
PoolReclaimed → forget) is fully driven by the decdn-node runtime. So
is the buyer-side cache-miss path (one-time USDC approve,
openPool/topUp, closePool + reclaim on abandonment; bookkeeping in
buyer_pool): the runtime bootstraps the approval and the reclaim
sweep, and its node-to-node pull-through origin drives pool open/reuse
and voucher signing on a miss.
Re-exports§
pub use bind_sig::BindError;pub use bind_sig::CAPACITY_BOND_DOMAIN_NAME;pub use bind_sig::CAPACITY_BOND_DOMAIN_VERSION;pub use bind_sig::EPHEMERAL_BINDING_NONCE;pub use bind_sig::bind_node_id_domain;pub use bind_sig::binding_signing_hash;pub use bind_sig::register_node_signing_hash;pub use bind_sig::verify_binding;pub use buyer_pool::AdvanceOutcome;pub use buyer_pool::BuyerLaneProgress;pub use buyer_pool::BuyerLoad;pub use buyer_pool::BuyerPoolState;pub use buyer_pool::BuyerPoolStore;pub use buyer_pool::BuyerProgressError;pub use buyer_pool::DepositOutcome;pub use buyer_pool::MemoryBuyerPoolStore;pub use capability::Capability;pub use capability::CapabilityError;pub use capability::SignedCapability;pub use capability_grant::CapabilityGrant;pub use capability_grant::GrantError;pub use capability_grant::GrantOwnerError;pub use chain::ChainMeterError;pub use chain::pack_chain_meter;pub use chain::preimage_at;pub use chain::random_seed;pub use chain::root_from_seed;pub use chain::verify_forward;pub use client_bridge::RetrySignal;pub use client_bridge::WireVoucherError;pub use client_bridge::signed_to_wire_voucher;pub use client_bridge::voucher_reject_reason;pub use client_bridge::wire_voucher_to_signed;pub use credit::ramped_credit_window;pub use deployment::Deployment;pub use erc20::Erc20;pub use lane::FoldAxis;pub use lane::LaneChain;pub use lane::LaneKey;pub use lane::LaneState;pub use lane::PoolError;pub use lane::PoolId;pub use lane::PreimageApplied;pub use lane::RedeemClaim;pub use lane::VoucherApplied;pub use pool_open_error::PoolOpenFailureReason;pub use pool_open_error::is_erc20_allowance_shortfall;pub use pool_open_error::is_pool_not_open;pub use probe_sig::PROBE_RESPONSE_TYPEHASH;pub use probe_sig::ProbeSlashData;pub use probe_sig::ProbeSlashError;pub use probe_sig::SLASH_JUDGE_DOMAIN_NAME;pub use probe_sig::SLASH_JUDGE_DOMAIN_VERSION;pub use probe_sig::slash_judge_domain;pub use rate::BYTES_PER_MB;pub use rate::DEFAULT_TOLERANCE_BPS;pub use rate::RateError;pub use rate::min_payment;pub use rate::pool_budget_covers;pub use rate::verify_rate;pub use store::CheckpointKey;pub use store::KeyedCheckpointStore;pub use store::MemoryPoolStateStore;pub use store::PendingSettle;pub use store::PendingSettleStore;pub use store::PoolStateStore;pub use store::StoreError;pub use stream_sig::STREAM_RESPONSE_TYPEHASH;pub use stream_sig::StreamSlashData;pub use stream_sig::StreamSlashError;pub use voucher::DOMAIN_NAME;pub use voucher::DOMAIN_VERSION;pub use voucher::SignedVoucher;pub use voucher::Voucher;pub use voucher::VoucherError;pub use voucher::voucher_domain;
Modules§
- bind_
sig - EIP-712
BindNodeIdverification for ephemeral client bindings. - buyer_
pool - Buyer-side payment-pool bookkeeping (#744).
- capability
- EIP-712 spending capabilities for the
PaymentPoolcontract. - capability_
grant dcap1:— the transferable encoding of a pool owner’s spendingcrate::capability::SignedCapability.- capacity_
bond CapacityBondcontract ABI bindings (ADR 003 § Node Registry, ADR 019).- chain
PayWordhash chains: the per-lane meter that advances a voucher’s settlement anchor without a signature (ADR 003 §Hash-chain metering (PayWord)).- client_
bridge - Bridge between
cdn/client/v1wire vouchers and the incentive voucher state machine. - content_
blacklist ContentBlacklistcontract ABI bindings (ADR 011 § Content Takedown).- credit
- Ramped delivery credit window (ADR 003 §Credit window).
- deployment
- The
PaymentPooldeployment a piece of pool state belongs to. - erc20
- Minimal ERC-20 ABI binding for the buyer-side USDC approval flow (#744).
- eth_
identity - Ethereum keystore: generate, persist, and load a Web3 Secret Storage v3
file into a live
alloy::signers::local::PrivateKeySigner. - lane
- Per-lane voucher state tracking.
- node_
register - Off-chain construction of the
CapacityBond.registerNodesigning inputs (ADR 019 § Step 2.3). - origin_
assignment OriginAssignmentcontract ABI bindings (ADR 011 § Origin Assignment Authority, ADR 022 § FIND_VALUE Flow “Origin discovery”).- payment_
pool PaymentPoolcontract ABI bindings (ADR 003 §PaymentPool).- pool_
open_ error - Failure-class taxonomy for the buyer-side
openPoolpath (#966). - probe_
sig - EIP-712
slash_sigsignatures forcdn/probe/v1ProbeResponsemessages. - publisher_
registry PublisherRegistrycontract ABI bindings (ADR 002 § Contract:PublisherRegistry).- rate
- Rate enforcement for incremental voucher payments.
- sig_
canon - Canonical-
senforcement for off-chain ECDSA signature verification (#836). - slash_
appeal SlashAppealcontract ABI bindings (ADR 028 § Slashing Appeals).- slash_
judge SlashJudgecontract ABI bindings (ADR 014 § Slashing & Disputes).- store
- Persistent storage for per-lane voucher state.
- stream_
sig - EIP-712
slash_sigsignatures forcdn/client/v1StreamResponsemessages. - tx
- One place to submit a transaction and resolve its outcome (#1355).
- voucher
- EIP-712 payment vouchers for the
PaymentPoolcontract.
Constants§
- CHUNK_
BYTES - The payment quantum: one chunk of delivery, 1 MiB (ADR 003 §Chunk Cadence).
- MAX_
CHAIN_ LENGTH - The highest chain index: the hash chain’s incremental range over its anchor (ADR 003 §Chain length and rollover).