@xyo-network/event-kit-xl1

中文文档
2.3.4发布于 2026/11/03LGPL-3.0-onlyTypeScriptES Module

XL1 chain adapters for Event Kit (finalized head source)

原始使用文档
文档目录5 节
  1. Finalized Statement Graph publication
  2. Why it validates rather than forwards
  3. Evidence
  4. Handshake body preparation
  5. Manual Phase 7 canary host

@xyo-network/event-kit-xl1

XL1 chain adapters for Event Kit.

  • createXl1FinalizedHeadSource — reads the finalized XL1 head for publisher filters and for the receiver's grant-freshness check
  • publishFinalizedStatements — publishes Statement Graph claims through explicit content-write, independent-readback, inclusion, and finality boundaries
  • preparePublisherService, prepareWakeSubscription, prepareWakeSubscriptionAcceptance and the five prepare*Revocation functions — the exact handshake Claim statements and attachments, without a signer, session or I/O; the matching publish* functions publish exactly these
const gateway = await new GatewayBuilder().name('local').rpcUrl(RPC).build()
const headSource = createXl1FinalizedHeadSource({ viewer: gateway.connection.viewer })

The result satisfies both the publisher's FinalizedHeadSource and the receiver's TrustedFinalizedHeadSource — structurally identical ports, declared locally so this package depends on neither.

Finalized Statement Graph publication

publishFinalizedStatements accepts separate datalake writer and reader ports. Production callers should supply independently constructed clients pointed at the same shared public datalake.

const result = await publishFinalizedStatements({
  attachments: [challenge, response],
  bodyReader: dataLakeViewer,
  bodyWriter: dataLakeRunner,
  journal,
  operationId,
  runner,
  signer,
  statements,
  viewer,
})

The candidate operation:

  1. prepares and validates the canonical Statement Graph transaction;
  2. requires exactly the challenge/response bodies named by claimed acceptance objects, then inserts and independently reads them back;
  3. builds and signs the XL1 transaction and journals its exact evidence;
  4. verifies that signing changed only signatures/continuity metadata and did not alter the signer, Claim source, payloads, order, or transaction intent;
  5. writes the exact signed transaction content to the writer;
  6. verifies that exact signed transaction content through the independent reader before broadcasting;
  7. broadcasts the already-signed transaction;
  8. observes concrete transaction inclusion; and
  9. independently observes that inclusion becoming finalized.

The returned result contains the transaction hash, Statement Graph event hashes, attachment hashes, inclusion evidence, and finalized block. Bounded polling options control inclusion/finality observation.

FinalizedStatementPublicationJournal.load and save form the durability boundary. The first signed record atomically binds the chain ID, Claim source, operation ID, ordered event and attachment hashes, and exact signed transaction. Later records commit content-written, content-verified, broadcast, included, and finalized. A restart validates that binding and resumes the highest phase. An uncertain broadcast may rebroadcast the exact signed evidence; it never rebuilds or re-signs the transaction. A finalized retry returns the same evidence without publishing again.

Operational callers should use the filesystem journal exported by @xyo-network/event-kit-node/handshake or another atomic implementation. The package's memory journal is a structural test fixture only.

The public handshake publication helpers accept the single unversioned service, subscription, and challenge contract. Publication enforces the session's pinned XL1 authorization chain and matching service/subscription identity before any write. The same-Claim service/grant/subscription fan and finalized acceptance attachments are unchanged. Ethereum blocks and interval ticks are source positions only; their grants and acceptance lifecycle still belong to XL1.

Why it validates rather than forwards

Both sides treat this number as trusted: the publisher decides which range to emit, and the gate computes grant lag from it. So the reading is checked, not passed through.

  • A head that is not a nonnegative JSON safe integer is rejected here, rather than surfacing later as an opaque grant-view-invalid.
  • A head lower than one already observed is rejected by default. Finalized heights are immutable, so a regression means the endpoint was rolled back, swapped, or is lying — failing closed beats admitting against a rewound view. Disable with rejectRegression: false only when a caller genuinely tolerates it.

Evidence

Offline specs cover the validation and regression guard. Live specs under src/spec/api-local/ run against a real local XL1 chain booted by the api-local vitest project: the head reads conforming, advances through real block production, and never regresses.

Separate offline publisher specs verify publication phase ordering, refusal to broadcast after independent datalake verification fails, exact acceptance attachment binding, refusal of signer-mutated transaction content, bounded polling until finalized evidence appears, lossless safe block conversion, and exact agreement between inclusion and finality evidence. Those focused specs mock the XL1 transaction and datalake helpers.

The accepted Gate 2 live handshake in @xyo-network/event-kit-statement-graph calls the same publishFinalizedStatements helper with a real apiLocal XL1 runner/viewer and separately constructed XL1 SDK REST writer/reader clients. Their endpoint is a filesystem-backed datalake server running in a child process. With Statement Graph 0.5.0, xyo-chain 5.3.0, and XL1 protocol/SDK 5.4.0, that run places subject-bearing Claims in the elevated payload slot, passes consensus validation, and scans the Claim bodies from finalized block carriers.

Run them with pnpm test:live from the repository root. They are opt-in — the default suite stays offline.

The finalized-head adapter and elevated-Claim publication path are qualified against the local dev chain. The datalake is still a loopback test process rather than a hosted network service. These package-level tests do not qualify a hosted shared public datalake, Sequence, Mainnet, Proxmox, multi-VM operation, or production delivery; the public CLI has separate local and packed-consumer evidence under roadmap Gate 3.

Handshake body preparation

Each high-level handshake publisher now prepares its Claim and then publishes what it prepared. The prepare* functions expose that first half: given the authorization chain ID, the canonical source address that will sign, and the handshake objects, they return the exact statements, attachments, Claim, Claim hash, subject and object identities. They apply every binding check the publisher applies, need no signer or session, and perform no I/O.

const prepared = await prepareWakeSubscription({
  chainId, source: controller, encryptionKey, grant, service, subscription,
})
// prepared.statements and prepared.attachments are what publishWakeSubscription sends.

Preparation is not authority. It accepts a Mainnet chain ID because it writes nothing; every publish* function still runs the ordinary network write check and refuses Mainnet. A manual canary composition passes prepared bodies to the owning Mainnet host below, which applies its own packet, ledger and terminal gates. Equal preparation inputs always yield the same Claim hash.

Manual Phase 7 canary host

The Node-only @xyo-network/event-kit-xl1/mainnet-canary entry exports inspectMainnetCanaryPacket, inspectMainnetCanaryStage, prepareMainnetCanaryLedger, admitInteractiveMainnetCanaryStage and publishInteractiveMainnetCanary. It is separate from ordinary CLI/network selection,which continue to reject Mainnet. The neutral publication API also rejects Mainnet without the host's private nonserializable permit. No issuer is exported. See the owning interlock contract.

A complete strict review packet binds the canonical chain,public identities, HTTPS endpoint and SDK resource endpoints,artifact/Phase0–6/recovery/funding approval evidence,validity,expected transaction count,aggregate ceilings,cleanup reserve and each exact publication/fee/script intent. Preparation creates one private SQLite ledger and immutable initialization marker. Missing authority must be restored; opening a process cannot reset counters. No real packet is created by a synthetic test fixture.

The manual host reads packet-bound typed approval from a real terminal before opening signer resources and fresh transaction-hash-bound typed approval before every broadcast attempt. CI,unattended input,ordinary CLI flags,JSON approval objects and caller acknowledgement callbacks grant no authority. Reservations survive failures/restarts/ambiguous submissions; signed evidence and publication phases remain exact. Funding and live Mainnet broadcasts remain separately human-authorized. Package/offline fixture qualification is not a live canary.

A root packet may opt in to reviewed stage packets with stages: { max, until }. inspectMainnetCanaryStage parses a stage against its root, and admitInteractiveMainnetCanaryStage appends it to the root's ledger after its own typed terminal approval. Stages add operations, or refresh the fees and validity of an unreserved operation whose Claim is unchanged. They never change identity, endpoints, evidence or ceilings, which stay in the root. Publish a staged operation by passing its defining stage to publishInteractiveMainnetCanary. See staged canaries.

版本与发布记录

@xyo-network/event-kit-xl1 共发布 22 个版本,首次发布于 2026/08/21;过去 12 个月发布了 22 个版本。

版本发布日期距今
2.3.4latest2026/11/03今天
2.3.32026/11/03今天
2.3.22026/10/313 天前
2.3.12026/10/303 天前
2.3.02026/10/295 天前
2.2.32026/10/286 天前

关于 @xyo-network/event-kit-xl1 的常见问题

@xyo-network/event-kit-xl1 是什么?

Event Kit的XL1链适配器(最终的头源)

如何安装 @xyo-network/event-kit-xl1?

在项目目录运行 npm install @xyo-network/event-kit-xl1,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:zod(^4.6)、ethers(^6.17)、async-mutex(^0.5)、@ariestools/sdk(^9.0)、@xyo-network/sdk(^8.1)、@opentelemetry/api(^1.10)、@xyo-network/xl1-sdk(^5.8)、@xyo-network/sdk-protocol(^8.0)、@xyo-network/xl1-statement-graph-sdk(^0.7)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@xyo-network/event-kit-xl1 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@xyo-network/event-kit-xl1 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@xyo-network/event-kit-xl1 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=26。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@xyo-network/event-kit-xl1 可以商用吗?

@xyo-network/event-kit-xl1 使用 LGPL-3.0-only 许可。弱 Copyleft:作为库被调用时通常不要求开源你自己的代码,但修改库本身需以 LGPL 开源;前端打包合并后的适用边界存在不同理解。以上为概括,不构成法律意见,请以许可原文为准。

@xyo-network/event-kit-xl1 还在维护吗?

最新版本 2.3.4 发布于 2026/11/03(今天);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2026/08/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。