@mikeargento/bitgraph 1.10.1 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -32
- package/dist/export.d.ts +98 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +366 -0
- package/dist/export.js.map +1 -0
- package/dist/fuse.d.ts +156 -11
- package/dist/fuse.d.ts.map +1 -1
- package/dist/fuse.js +380 -8
- package/dist/fuse.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/recovery-write.d.ts +58 -0
- package/dist/recovery-write.d.ts.map +1 -0
- package/dist/recovery-write.js +265 -0
- package/dist/recovery-write.js.map +1 -0
- package/dist/recovery.d.ts +490 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +1124 -0
- package/dist/recovery.js.map +1 -0
- package/package.json +3 -3
- package/src/export.ts +435 -0
- package/src/fuse.ts +521 -19
- package/src/index.ts +28 -3
- package/src/recovery-write.ts +334 -0
- package/src/recovery.ts +1261 -0
package/README.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# BitGraph
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@mikeargento/bitgraph)
|
|
3
|
+
[](https://www.npmjs.com/package/@mikeargento/bitgraph-sdk)
|
|
4
|
+
[](https://www.npmjs.com/package/@mikeargento/bitgraph-verify)
|
|
4
5
|
[](https://bitgraph.ing)
|
|
5
6
|
[](https://bitgraph.ing/docs)
|
|
6
7
|
|
|
7
8
|
---
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
**Position commitment for AI records.**
|
|
11
|
+
|
|
12
|
+
BitGraph begins the proof before the record arrives.
|
|
13
|
+
|
|
14
|
+
BitGraphs are not labels or metadata added after the fact. They are new computations created when your file's hash *fills* a pre-existing, cryptographically reserved position, constraining the commitment so it cannot be made after the fact. The commit happens off-chain, inside the enclave, and produces a proof permanently bound to that exact digital state. Seconds later, a Merkle root over new records' proof hashes is written to Base, so each record also gets a ceiling in time.
|
|
10
15
|
|
|
11
16
|
Provenance can be enforced or it can be claimed. Most systems claim it: they bind a statement about the content to the content itself. That binding can be cryptographically strong, and it can be made at the moment of capture rather than afterward, so the weakness is not timing. The weakness is that a claim is something a trusted signer can attach to any artifact at all. The artifact does not have to satisfy any prior condition to receive one.
|
|
12
17
|
|
|
@@ -18,26 +23,25 @@ The first thing built on it is AI audit. A BitGraph is a verifiable receipt for
|
|
|
18
23
|
|
|
19
24
|
## Quickstart
|
|
20
25
|
|
|
21
|
-
Make one in your browser at [bitgraph.ing/docs/try](https://bitgraph.ing/docs/try). The file never leaves your machine; only its fingerprint does. From an agent, connect the [MCP server](https://bitgraph.ing/docs/mcp) with one URL. To put a commitment inside a record your own system writes, follow the [integration guide](https://bitgraph.ing/docs/integration).
|
|
26
|
+
Make one in your browser at [bitgraph.ing/docs/try](https://bitgraph.ing/docs/try): the drop box. The file never leaves your machine; only its fingerprint does. From an agent, connect the [MCP server](https://bitgraph.ing/docs/mcp) at `bitgraph.ing/mcp` with one URL. From code, `npx -p @mikeargento/bitgraph-sdk bitgraph record <paths...>`. To put a commitment inside a record your own system writes, follow the [integration guide](https://bitgraph.ing/docs/integration).
|
|
27
|
+
|
|
28
|
+
Making a BitGraph of one or more files yields ONE position: a Merkle tree of the files (tree/1), one file a tree of one. What you keep is the **export** (bitgraph-export/1) beside the files, with `SPEC.md`, the exact text the proof pins. The owner's export lists every leaf and name; a member export holds one file's leaf and path. An export holds no copy of any file and no anchor proofs. `bitgraph export complete` adds the floor header, the Base ceiling and the Ethereum settlement later. If the export is lost, the file alone finds its proof again through its recovery entry (SPEC section 13).
|
|
22
29
|
|
|
23
|
-
Verify a
|
|
30
|
+
Verify a file with its export in code, with the MIT verifier:
|
|
24
31
|
|
|
25
32
|
```bash
|
|
26
33
|
npm install @mikeargento/bitgraph-verify
|
|
27
34
|
```
|
|
28
35
|
|
|
29
36
|
```ts
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
const result = await
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} else {
|
|
36
|
-
console.error(result.reason);
|
|
37
|
-
}
|
|
37
|
+
import { verifyExport } from "@mikeargento/bitgraph-verify";
|
|
38
|
+
|
|
39
|
+
const result = await verifyExport(exportJson, { bytes });
|
|
40
|
+
console.log(result.verdict); // TRUE, FALSE or UNDETERMINED
|
|
41
|
+
for (const c of result.claims) console.log(c.name, c.result, c.restsOn);
|
|
38
42
|
```
|
|
39
43
|
|
|
40
|
-
`
|
|
44
|
+
`verifyExport()` answers one claim per line: the proof and its attestation, the spec pin, the tree root, this file's leaf, the floor, the Base ceiling and the Ethereum settlement, each saying what it rests on. `verify()` in the same package checks a bare bitgraph/1 proof against bytes, and `verifyCarrier()` judges a BitGraphed file (carrier/2), the single-file form that carries its own proof inside it.
|
|
41
45
|
|
|
42
46
|
See [bitgraph.ing/docs](https://bitgraph.ing/docs) for the full proof format, verification checklist, attestation handling, and self-host instructions.
|
|
43
47
|
|
|
@@ -45,13 +49,15 @@ See [bitgraph.ing/docs](https://bitgraph.ing/docs) for the full proof format, ve
|
|
|
45
49
|
|
|
46
50
|
| Path | What it is |
|
|
47
51
|
|---|---|
|
|
48
|
-
| [`
|
|
49
|
-
| [`packages/
|
|
50
|
-
| [`
|
|
51
|
-
| [`packages/
|
|
52
|
+
| [`spec/SPEC.md`](spec/SPEC.md) | The specification, version 1, frozen 2026-10-04. Its SHA-256 (`QazdIR0JYtHQwQuIISo7bvH1gxUvTS2cY+tW6BjUIRs=`, [`spec/FROZEN.json`](spec/FROZEN.json)) is signed into every tree/1 proof. It never changes; a later version is added beside it. |
|
|
53
|
+
| [`packages/verify`](packages/verify) | `@mikeargento/bitgraph-verify`, MIT. The canonical verifier: the `bitgraph/1` schema, canonical serialization, proof and chain hashes, tree/1, exports, BitGraphed files, ceilings and settlement. Every other component checks proofs through this one. |
|
|
54
|
+
| [`packages/audit`](packages/audit) | `@mikeargento/bitgraph-audit`, MIT. Offline audit of a whole bundle: ingest, tiered verification, exports, causal reconstruction, anomaly codes, CLI. |
|
|
55
|
+
| [`packages/sdk`](packages/sdk) | `@mikeargento/bitgraph-sdk`. How software makes a BitGraph: the `BitGraph` class, the `bitgraph` CLI, and `bitgraph serve` on 127.0.0.1. New integrations start here. |
|
|
56
|
+
| [`src`](src) | `@mikeargento/bitgraph`. The older package the SDK is built on: the tree/1 pipeline, the placements, export building and recovery writes. Still published. |
|
|
57
|
+
| [`packages/mcp`](packages/mcp) | `@mikeargento/bitgraph-mcp`. The MCP server an agent connects to; the same engine as the SDK. |
|
|
52
58
|
| [`packages/player`](packages/player) | `@mikeargento/bitgraph-player`. Deterministic evaluation of causal rules over verified evidence. |
|
|
53
59
|
| [`server/commit-service`](server/commit-service) | The enclave that allocates and commits, its parent host, and the reproducible build whose published measurement is in [`PINS.md`](server/commit-service/reproducible-build/PINS.md). |
|
|
54
|
-
| [`website`](website) | [bitgraph.ing](https://bitgraph.ing), including the
|
|
60
|
+
| [`website`](website) | [bitgraph.ing](https://bitgraph.ing), including the drop box, the recovery service and the hosted MCP endpoint. |
|
|
55
61
|
|
|
56
62
|
Trust assumptions, and what each one buys, are in [The trust model](#the-trust-model) below and at [bitgraph.ing/docs/trust-model](https://bitgraph.ing/docs/trust-model).
|
|
57
63
|
|
|
@@ -97,8 +103,8 @@ A BitGraph proof is a portable proof object, a JSON document, that travels with
|
|
|
97
103
|
| Signature | Verifies the proof was issued by the enclave-controlled key |
|
|
98
104
|
| TEE measurement | Shows what code and environment produced the proof |
|
|
99
105
|
| Attestation | Shows the proof came from measured hardware |
|
|
100
|
-
| Public
|
|
101
|
-
|
|
|
106
|
+
| Public floor | A Base block bound in when the position opened: tethers BitGraph logical time to a public reference |
|
|
107
|
+
| Tree marker | Signed: the format (tree/1) and the SHA-256 of SPEC.md, the exact text the proof pins. The artifact hash is then the tree's 84-byte root document; each file's leaf and path live in the export |
|
|
102
108
|
|
|
103
109
|
Taken together: this hash was committed into this reserved position, by this measured environment, at this point in logical order, under this signing identity.
|
|
104
110
|
|
|
@@ -110,23 +116,27 @@ BitGraph proves causal order. It does not assert a clock time.
|
|
|
110
116
|
|
|
111
117
|
## Establishing wall clock time
|
|
112
118
|
|
|
113
|
-
BitGraph's internal ordering does not require
|
|
119
|
+
BitGraph's internal ordering does not require a blockchain. The chain creates internal order through position allocation, consumption, counters, signatures, and chained proof history. What that order lacks, on its own, is a public clock. The recorded time is the enclave platform's signed clock, the AWS Nitro attestation time; the public bounds come from outside.
|
|
120
|
+
|
|
121
|
+
Base (Coinbase's Ethereum layer-2, a block every 2 seconds) is where the order meets the public wall clock. When a position opens, the enclave binds the newest Base block into it: it hashes the block's header itself, checks that the block's time is Base mainnet's schedule for its number, that it is not stamped after the enclave's clock, and that floors never go backwards, and signs the block into the proof (`commit.slotFloor`). The record was made after that block. This is the floor in time, and it runs in one direction: no earlier than. That the block is Base's own is one lookup on Base, by its number, comparing the hash; Coinbase runs Base's sequencer. Nothing is written to a chain for the floor.
|
|
122
|
+
|
|
123
|
+
The other side is stated apart, never merged. The ceiling in time is the Base block carrying a Merkle root over the record's proof hash, written seconds after the commit: the record existed by that block. Settlement is Ethereum's record of that Base block through Base's output root (bitgraph-output-root/1), so the Base time rests on Ethereum too. Order after the record is the next BitGraph in the chain, which carries this proof's hash: a bound in the sequence, never a clock time.
|
|
114
124
|
|
|
115
|
-
|
|
125
|
+
The ceilings also fix history backward, through content. Each proof's hash is chained into the next, so once a proof hash sits in a Base transaction, the history behind it is fixed: alter any earlier proof and the chain no longer reaches it. When the epoch ends, its signing key is destroyed, and the set closes.
|
|
116
126
|
|
|
117
|
-
|
|
127
|
+
Base is not asked to be a good source of randomness, and it is not asked to establish the artifact's position. BitGraph establishes the position. The public blocks tie the positions to the public timeline, so anyone, years later, can check the order and the earliest date each position could have existed.
|
|
118
128
|
|
|
119
|
-
|
|
129
|
+
Proofs made before the switch to the Base floor stand on an Ethereum floor instead: an anchor, an ordinary proof on the same chain whose artifact was the hash of a recent Ethereum block, fixed when the position was allocated and signed in as `commit.slotAnchor`. They verify exactly as before.
|
|
120
130
|
|
|
121
131
|
## Compromise and containment
|
|
122
132
|
|
|
123
133
|
BitGraph assumes the boundary can be compromised and bounds the damage instead of claiming it cannot happen.
|
|
124
134
|
|
|
125
|
-
The signing key exists only in enclave memory. Every restart destroys it and begins a new epoch with a fresh key and a fresh counter. Proofs from prior epochs were signed by keys that no longer exist, so a compromise cannot reach backward.
|
|
135
|
+
The signing key exists only in enclave memory. Every restart destroys it and begins a new epoch with a fresh key and a fresh counter. Proofs from prior epochs were signed by keys that no longer exist, so a compromise that begins later cannot reach backward.
|
|
126
136
|
|
|
127
|
-
Forgery requires more than key theft. Every proof carries a hardware attestation whose user_data must equal the hash of that exact proof body, and only the enclave's secure module can produce one. A useful breach must execute inside the running enclave, and
|
|
137
|
+
Forgery requires more than key theft. Every proof carries a hardware attestation whose user_data must equal the hash of that exact proof body, and only the enclave's secure module can produce one. A useful breach must execute inside the running enclave. A restart ends that foothold but not the flaw that allowed it: the same flaw could be used again in a later epoch, and proofs already forged stay valid.
|
|
128
138
|
|
|
129
|
-
Damage control is precise. Every proof names its epoch permanently, so a suspect window is identified exactly: rotate the epoch, publish the affected epochId as quarantined
|
|
139
|
+
Damage control is precise. Every proof names its epoch permanently, so a suspect window is identified exactly: rotate the epoch, publish the affected epochId as quarantined; epochs that were not themselves compromised are unaffected. Verifiers that pin measurements and track epochs account for the gap.
|
|
130
140
|
|
|
131
141
|
The production deployment makes rotation routine rather than exceptional: the boundary restarts every day at 23:59 UTC, destroying the epoch key and starting a fresh one, so a normally operating epoch runs about a day. An unexpected restart ends one early and a failed rotation extends one; either way the boundary is recorded in the proofs themselves. A breach that depends on staying resident inside the enclave cannot outlive its epoch without freshly re-compromising a new one. The schedule is deliberately public: rotation times are visible in BitGraph's public copy regardless, and the protection comes from the key dying, not from anyone guessing when.
|
|
132
142
|
|
|
@@ -141,7 +151,7 @@ BitGraph does not ask for blind trust in any single component. It has real depen
|
|
|
141
151
|
| Atomic binding | Prevents post-hoc attachment |
|
|
142
152
|
| Counters | Internal logical order |
|
|
143
153
|
| Proof chain | Historical continuity |
|
|
144
|
-
|
|
|
154
|
+
| Base floor and ceiling | Public wall-clock bounds |
|
|
145
155
|
| Epoch rotation | Damage containment |
|
|
146
156
|
| Portable verification | Independence from the original server |
|
|
147
157
|
|
|
@@ -168,7 +178,7 @@ BitGraph is often confused with adjacent systems. The differences are structural
|
|
|
168
178
|
| Signatures | This key signed this data | This key was controlled by a measured environment that consumed an unused position |
|
|
169
179
|
| Timestamps | This hash existed by time T | This hash consumed a pre-existing position in causal order |
|
|
170
180
|
| C2PA | Here are signed claims about this content | This exact digital state occupied this pre-existing position |
|
|
171
|
-
| Blockchains | Public ordering of shared transactions | Ordering established inside a measured enclave, then
|
|
181
|
+
| Blockchains | Public ordering of shared transactions | Ordering established inside a measured enclave, then bracketed by public blocks |
|
|
172
182
|
|
|
173
183
|
Signatures, timestamps, content credentials, and blockchains all answer "who claimed what, when?" BitGraph answers "what position does this exact digital state occupy?" They are complementary, not competing. A signature can be inside a BitGraph proof. A timestamp can decorate one. Content credentials can ride alongside one. None of them, alone, do what BitGraph does.
|
|
174
184
|
|
|
@@ -180,7 +190,7 @@ BitGraph does not restore originality. It makes it unnecessary. The artifact's h
|
|
|
180
190
|
|
|
181
191
|
## The simplest version
|
|
182
192
|
|
|
183
|
-
A measured TEE reserves a random unused position. The producer writes the position's commitment into the bytes, whether that is a new file around an original or a record with a field of its own, and hashes the finished bytes. That hash arrives. The TEE binds it to the position, consumes the position, signs the result, and links it into an ordered chain. Every restart begins a new epoch with a new key, so a compromised boundary is bounded, never retroactive.
|
|
193
|
+
A measured TEE reserves a random unused position. The producer writes the position's commitment into the bytes, whether that is a new file around an original or a record with a field of its own, and hashes the finished bytes. That hash arrives. The TEE binds it to the position, consumes the position, signs the result, and links it into an ordered chain. Every restart begins a new epoch with a new key, so a compromised boundary is bounded, never retroactive. Each position opens on the newest Base block, a public date the record provably followed, and seconds after the commit the proof's hash is written to Base, fixing the history behind it.
|
|
184
194
|
|
|
185
195
|
The result is a protocol that does not say "someone signed this."
|
|
186
196
|
|
|
@@ -192,9 +202,9 @@ The result is a protocol that does not say "someone signed this."
|
|
|
192
202
|
|
|
193
203
|
Two MIT-licensed packages in this repository make BitGraph evidence checkable without permission:
|
|
194
204
|
|
|
195
|
-
**[`@mikeargento/bitgraph-verify`](https://www.npmjs.com/package/@mikeargento/bitgraph-verify)** verifies one
|
|
205
|
+
**[`@mikeargento/bitgraph-verify`](https://www.npmjs.com/package/@mikeargento/bitgraph-verify)** (1.16.0) verifies one record. `verifyExport()` checks a tree/1 export with the file it is about, one claim per line, the three time claims kept apart. `verifyCarrier()` judges a BitGraphed file. `verify()` checks a bare proof against the artifact bytes: structure, canonical Ed25519 signature, position binding, epoch link, and the digest match. `verifyProofIntegrity()` runs every check except the artifact binding for cases where the bytes are not available, and its result states explicitly that the binding was not checked.
|
|
196
206
|
|
|
197
|
-
**`@mikeargento/bitgraph-audit`** audits a whole bundle of proofs, fully offline. It ingests a directory, `.tar`, or `.tar.gz`, verifies every proof through the canonical verifier, reconstructs causal order from the hash links and counters, classifies anomalies with stable machine-readable codes, and preserves divergence between valid proofs for the reader to adjudicate instead of choosing a winner. It ships a CLI (`bitgraph-audit <bundle>`) that writes machine-readable and human-readable reports. The bundle format is specified in [docs/BUNDLE-FORMAT.md](docs/BUNDLE-FORMAT.md); the recipient walkthrough is [docs/HOW-TO-AUDIT.md](docs/HOW-TO-AUDIT.md).
|
|
207
|
+
**`@mikeargento/bitgraph-audit`** (0.9.0) audits a whole bundle of proofs, fully offline. It ingests a directory, `.tar`, or `.tar.gz`, or a single BitGraphed file; finds every export by its `format` field and checks it against each file it covers; verifies every proof through the canonical verifier, reconstructs causal order from the hash links and counters, classifies anomalies with stable machine-readable codes, and preserves divergence between valid proofs for the reader to adjudicate instead of choosing a winner. It ships a CLI (`bitgraph-audit <bundle>`) that writes machine-readable and human-readable reports. The bundle format is specified in [docs/BUNDLE-FORMAT.md](docs/BUNDLE-FORMAT.md); the recipient walkthrough is [docs/HOW-TO-AUDIT.md](docs/HOW-TO-AUDIT.md).
|
|
198
208
|
|
|
199
209
|
## License
|
|
200
210
|
|
package/dist/export.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { MerkleTree } from "@mikeargento/bitgraph-verify";
|
|
2
|
+
import type { BitGraphExport, BitGraphProof, TreeLeaf } from "@mikeargento/bitgraph-verify";
|
|
3
|
+
import type { FuseTreeResult } from "./fuse.js";
|
|
4
|
+
/** An export's floor: the block the proof signs (commit.slotAnchor on Ethereum, or commit.slotFloor on Base, with chain "base"), with its RLP header (0x hex). */
|
|
5
|
+
export type ExportFloor = NonNullable<BitGraphExport["floor"]>;
|
|
6
|
+
/** What an export is built from. A FuseTreeResult is one; so is the same data read back from an owner's export. */
|
|
7
|
+
export interface TreeExportSource {
|
|
8
|
+
proof: BitGraphProof;
|
|
9
|
+
/** The 84-byte root document the proof commits. */
|
|
10
|
+
rootDocument: Uint8Array;
|
|
11
|
+
/** Every leaf, in tree order. */
|
|
12
|
+
leaves: readonly TreeLeaf[];
|
|
13
|
+
/** The tree over those leaves, when already built (reused across many member exports). */
|
|
14
|
+
tree?: MerkleTree;
|
|
15
|
+
}
|
|
16
|
+
/** The parts beside the tree. Each defaults to the make-time state: no floor header, ceiling and settlement pending. */
|
|
17
|
+
export interface ExportParts {
|
|
18
|
+
floor?: ExportFloor | null;
|
|
19
|
+
ceiling?: BitGraphExport["ceiling"];
|
|
20
|
+
settlement?: BitGraphExport["settlement"];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One member's export: its leaf, its index and its path, and nothing of the
|
|
24
|
+
* other files but sibling hashes. The path is checked against the committed
|
|
25
|
+
* root before the export is built, so no export contradicts itself.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildMemberExport(source: TreeExportSource, leafIndex: number, extras?: ExportParts): BitGraphExport;
|
|
28
|
+
/**
|
|
29
|
+
* The owner's export: every leaf in tree order and, when given, a name per
|
|
30
|
+
* leaf (unsigned, informational). The whole list is checked against the
|
|
31
|
+
* committed root first: sorted, without duplicates, rebuilding the root.
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildOwnerExport(source: TreeExportSource, extras?: ExportParts & {
|
|
34
|
+
names?: readonly string[];
|
|
35
|
+
}): BitGraphExport;
|
|
36
|
+
/** A name per leaf, in tree order, from a tree's members ("" for a member made without one). */
|
|
37
|
+
export declare function namesByLeaf(result: Pick<FuseTreeResult, "members" | "count">): string[];
|
|
38
|
+
/**
|
|
39
|
+
* The floor for an export from a block header, or null unless the header
|
|
40
|
+
* decodes and hashes to the block the proof signs as its floor, at that
|
|
41
|
+
* height (for a Base floor, also at the signed time, on Base mainnet's
|
|
42
|
+
* schedule). The header is never trusted for anything it does not hash to.
|
|
43
|
+
*/
|
|
44
|
+
export declare function floorFromHeader(proof: BitGraphProof, headerHex: string): ExportFloor | null;
|
|
45
|
+
export interface ExportFetchOptions {
|
|
46
|
+
/** The site to read from. Default https://bitgraph.ing. */
|
|
47
|
+
baseUrl?: string;
|
|
48
|
+
/** Per request. Default 20 s. */
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
/** The Base node asked for a Base floor's header (enclave v10 floors), by height. Default https://mainnet.base.org. */
|
|
51
|
+
baseRpcUrl?: string;
|
|
52
|
+
}
|
|
53
|
+
type Fetcher = (input: string, init?: RequestInit) => Promise<Response>;
|
|
54
|
+
/**
|
|
55
|
+
* The floor header for a proof, checked against the floor the proof signs:
|
|
56
|
+
* for an Ethereum floor, from the site's witness route
|
|
57
|
+
* (GET /api/proofs/witness?block=N&hash=0x...); for a Base floor, the site's
|
|
58
|
+
* saved copy (GET /api/proofs/floor-header?chain=base&block=N&hash=0x...)
|
|
59
|
+
* when opts.baseUrl names the site, else the Base node's block at the signed
|
|
60
|
+
* height (eth_getBlockByNumber), its header rebuilt from the node's JSON;
|
|
61
|
+
* either kept only when it hashes to the signed block hash.
|
|
62
|
+
* Null when the proof signs no floor, nothing answered with a header, or the
|
|
63
|
+
* header is not that block's.
|
|
64
|
+
*/
|
|
65
|
+
export declare function fetchFloorHeader(proof: BitGraphProof, fetcher?: Fetcher, opts?: ExportFetchOptions): Promise<ExportFloor | null>;
|
|
66
|
+
export interface CompleteExportOptions extends ExportFetchOptions {
|
|
67
|
+
/** The ceiling writer the verifier accepts. Default BitGraph's published writer on Base. */
|
|
68
|
+
writerAddress?: string;
|
|
69
|
+
/** Default Base mainnet (8453). */
|
|
70
|
+
baseChainId?: number;
|
|
71
|
+
/** The chain the settlement is on. Default Ethereum mainnet (1). */
|
|
72
|
+
ethereumChainId?: number;
|
|
73
|
+
/** Keep asking while something is still pending, up to this long. Default 0: one pass. */
|
|
74
|
+
waitMs?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface CompletedExport {
|
|
77
|
+
export: BitGraphExport;
|
|
78
|
+
/** True when anything was added. */
|
|
79
|
+
changed: boolean;
|
|
80
|
+
floor: "present" | "absent";
|
|
81
|
+
ceiling: "present" | "pending";
|
|
82
|
+
settlement: "present" | "pending";
|
|
83
|
+
/** What was asked and not embedded, and why: a route that failed, or evidence that did not verify. */
|
|
84
|
+
notes: string[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Fill what an export is waiting for, from read-only GETs on the site:
|
|
88
|
+
* floor GET /api/proofs/witness?block=N&hash=0x... for an Ethereum floor; a Base floor is
|
|
89
|
+
* GET /api/proofs/floor-header?chain=base&block=N&hash=0x..., else the Base node's
|
|
90
|
+
* block N (opts.baseRpcUrl); or the ceiling sidecar's own floor header
|
|
91
|
+
* ceiling GET /api/ceilings/<proofHash, URL-safe> 404: still pending
|
|
92
|
+
* settlement GET /api/ceilings/settlement/<Base block> 404: still pending
|
|
93
|
+
* Each is verified here before it is embedded, and nothing already present is
|
|
94
|
+
* overwritten. The fetcher is injectable; it defaults to the global fetch.
|
|
95
|
+
*/
|
|
96
|
+
export declare function completeExport(input: BitGraphExport, fetcher?: Fetcher, opts?: CompleteExportOptions): Promise<CompletedExport>;
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"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"}
|