@bsv/overlay 0.1.10 → 0.1.12

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.
Files changed (36) hide show
  1. package/README.md +89 -4
  2. package/dist/cjs/package.json +1 -1
  3. package/dist/cjs/src/Engine.js +402 -21
  4. package/dist/cjs/src/Engine.js.map +1 -1
  5. package/dist/cjs/src/GASP/OverlayGASPRemote.js +4 -6
  6. package/dist/cjs/src/GASP/OverlayGASPRemote.js.map +1 -1
  7. package/dist/cjs/src/GASP/OverlayGASPStorage.js +77 -152
  8. package/dist/cjs/src/GASP/OverlayGASPStorage.js.map +1 -1
  9. package/dist/cjs/src/SHIPAdvertisement.js +3 -0
  10. package/dist/cjs/src/SHIPAdvertisement.js.map +1 -0
  11. package/dist/cjs/src/SLAPAdvertisement.js +3 -0
  12. package/dist/cjs/src/SLAPAdvertisement.js.map +1 -0
  13. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  14. package/dist/esm/src/Engine.js +402 -20
  15. package/dist/esm/src/Engine.js.map +1 -1
  16. package/dist/esm/src/GASP/OverlayGASPRemote.js +4 -7
  17. package/dist/esm/src/GASP/OverlayGASPRemote.js.map +1 -1
  18. package/dist/esm/src/GASP/OverlayGASPStorage.js +77 -151
  19. package/dist/esm/src/GASP/OverlayGASPStorage.js.map +1 -1
  20. package/dist/esm/src/SHIPAdvertisement.js +2 -0
  21. package/dist/esm/src/SHIPAdvertisement.js.map +1 -0
  22. package/dist/esm/src/SLAPAdvertisement.js +2 -0
  23. package/dist/esm/src/SLAPAdvertisement.js.map +1 -0
  24. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  25. package/dist/types/src/Engine.d.ts +118 -4
  26. package/dist/types/src/Engine.d.ts.map +1 -1
  27. package/dist/types/src/GASP/OverlayGASPRemote.d.ts +2 -3
  28. package/dist/types/src/GASP/OverlayGASPRemote.d.ts.map +1 -1
  29. package/dist/types/src/GASP/OverlayGASPStorage.d.ts +3 -29
  30. package/dist/types/src/GASP/OverlayGASPStorage.d.ts.map +1 -1
  31. package/dist/types/src/SHIPAdvertisement.d.ts +9 -0
  32. package/dist/types/src/SHIPAdvertisement.d.ts.map +1 -0
  33. package/dist/types/src/SLAPAdvertisement.d.ts +9 -0
  34. package/dist/types/src/SLAPAdvertisement.d.ts.map +1 -0
  35. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  36. package/package.json +2 -2
@@ -1,9 +1,7 @@
1
1
  export class OverlayGASPRemote {
2
2
  endpointURL;
3
- topic;
4
- constructor(endpointURL, topic) {
3
+ constructor(endpointURL) {
5
4
  this.endpointURL = endpointURL;
6
- this.topic = topic;
7
5
  }
8
6
  /**
9
7
  * Given an outgoing initial request, sends the request to the foreign instance and obtains their initial response.
@@ -14,12 +12,11 @@ export class OverlayGASPRemote {
14
12
  // Send out an HTTP request to the URL (current host for topic)
15
13
  // Include the topic in the request
16
14
  // Parse out response and return correct format
17
- const url = `${this.endpointURL}/requestSyncResponse`;
15
+ const url = `${this.endpointURL}/requestSyncResponse`; // TODO: Verify endpoint name
18
16
  const response = await fetch(url, {
19
17
  method: 'POST',
20
18
  headers: {
21
- 'Content-Type': 'application/json',
22
- 'X-BSV-Topic': this.topic
19
+ 'Content-Type': 'application/json'
23
20
  },
24
21
  body: JSON.stringify(request)
25
22
  });
@@ -49,7 +46,7 @@ export class OverlayGASPRemote {
49
46
  */
50
47
  async requestNode(graphID, txid, outputIndex, metadata) {
51
48
  // Send an HTTP request with the provided info and get back a gaspNode
52
- const url = `${this.endpointURL}/requestForeignGASPNode`;
49
+ const url = `${this.endpointURL}/requestForeignGASPNode`; // Assuming the endpoint is /node, adjust as needed
53
50
  const body = {
54
51
  graphID,
55
52
  txid,
@@ -1 +1 @@
1
- {"version":3,"file":"OverlayGASPRemote.js","sourceRoot":"","sources":["../../../../src/GASP/OverlayGASPRemote.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IACT;IAA4B;IAA/C,YAAmB,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M,CAAC,UAAU;YAC7B,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAA;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,iCAAiC;IAEjC,gCAAgC;IAChC,KAAK,CAAC,eAAe,CAAE,QAA6B;QAClD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IAED,gDAAgD;IAChD,0CAA0C;IAC1C,KAAK,CAAC,UAAU,CAAE,IAAc;QAC9B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;IACnD,CAAC;CACF"}
@@ -21,30 +21,9 @@ export class OverlayGASPStorage {
21
21
  outputIndex: output.outputIndex
22
22
  }));
23
23
  }
24
- /**
25
- * For a given txid and output index, returns the associated transaction, a merkle proof if the transaction is in a block, and metadata if if requested. If no metadata is requested, metadata hashes on inputs are not returned.
26
- * @param graphID
27
- * @param txid
28
- * @param outputIndex
29
- * @param metadata
30
- * @returns
31
- */
24
+ // TODO: Consider optionality on interface
32
25
  async hydrateGASPNode(graphID, txid, outputIndex, metadata) {
33
- const output = await this.engine.storage.findOutput(txid, outputIndex, undefined, undefined, true);
34
- if (output?.beef === undefined) {
35
- throw new Error('No matching output found!');
36
- }
37
- const tx = Transaction.fromBEEF(output.beef);
38
- const rawTx = tx.toHex();
39
- const node = {
40
- rawTx,
41
- graphID,
42
- outputIndex
43
- };
44
- if (tx.merklePath !== undefined) {
45
- node.proof = tx.merklePath.toHex();
46
- }
47
- return node;
26
+ throw new Error('GASP node hydration Not supported!');
48
27
  }
49
28
  /**
50
29
  * For a given node, returns the inputs needed to complete the graph, including whether updated metadata is requested for those inputs.
@@ -63,7 +42,7 @@ export class OverlayGASPStorage {
63
42
  metadata: false
64
43
  };
65
44
  }
66
- return await this.stripAlreadyKnownInputs(response);
45
+ return response;
67
46
  }
68
47
  // Attempt to check if the current transaction is admissible
69
48
  parsedTx.merklePath = MerklePath.fromHex(tx.proof);
@@ -75,6 +54,14 @@ export class OverlayGASPStorage {
75
54
  // The transaction is not admissible, get inputs needed for further verification
76
55
  // TopicManagers should implement a function to identify which inputs are needed.
77
56
  if (this.engine.managers[this.topic] !== undefined && typeof this.engine.managers[this.topic].identifyNeededInputs === 'function') {
57
+ for (const input of parsedTx.inputs) {
58
+ response.requestedInputs[`${input.sourceTXID}.${input.sourceOutputIndex}`] = {
59
+ metadata: false
60
+ };
61
+ }
62
+ return response;
63
+ }
64
+ else {
78
65
  try {
79
66
  const neededInputs = await this.engine.managers[this.topic].identifyNeededInputs?.(parsedTx.toBEEF()) ?? [];
80
67
  for (const input of neededInputs) {
@@ -82,37 +69,13 @@ export class OverlayGASPStorage {
82
69
  metadata: false
83
70
  };
84
71
  }
85
- return await this.stripAlreadyKnownInputs(response);
72
+ return response;
86
73
  }
87
74
  catch (e) {
88
75
  console.error(`An error occurred when identifying needed inputs for transaction: ${parsedTx.id('hex')}.${tx.outputIndex}!`);
89
- // Cut off the graph in case of an error here.
90
76
  }
91
77
  }
92
- // By default, if the topic manager isn't able to stipulate needed inputs, only the inputs necessary for SPV are requested.
93
78
  }
94
- // Everything else falls through to returning undefined/void, which will terminate the synchronization at this point.
95
- }
96
- /**
97
- * Ensures that no inputs are requested from foreign nodes before sending any GASP response
98
- * Also terminates graphs if the response would be empty.
99
- */
100
- async stripAlreadyKnownInputs(response) {
101
- if (typeof response === 'undefined') {
102
- return response;
103
- }
104
- for (const inputNodeId of Object.keys(response.requestedInputs)) {
105
- const [txid, outputIndex] = inputNodeId.split('.');
106
- const found = await this.engine.storage.findOutput(txid, Number(outputIndex), this.topic);
107
- if (found !== null && found !== undefined) {
108
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
109
- delete response.requestedInputs[inputNodeId];
110
- }
111
- }
112
- if (Object.keys(response.requestedInputs).length === 0) {
113
- return undefined;
114
- }
115
- return response;
116
79
  }
117
80
  /**
118
81
  * Appends a new node to a temporary graph.
@@ -129,10 +92,14 @@ export class OverlayGASPStorage {
129
92
  if (tx.proof !== undefined) {
130
93
  parsedTx.merklePath = MerklePath.fromHex(tx.proof);
131
94
  }
95
+ // Throw if:
96
+ // 1. TODO: graphID is for a graph the recipient does not want (stipulated where?)
97
+ // 2. TODO: The graph has grown to be too large before being finalized (based on some defined limit?)
132
98
  // Given the passed in node, append to the temp graph
133
99
  // Use the spentBy param which should be a txid.inputIndex for the node which spent this one in 36-byte format
134
100
  const newGraphNode = {
135
101
  txid,
102
+ time: 0, // TODO: Use block height potentially
136
103
  graphID: tx.graphID,
137
104
  rawTx: tx.rawTx,
138
105
  outputIndex: tx.outputIndex,
@@ -151,9 +118,9 @@ export class OverlayGASPStorage {
151
118
  const parentNode = this.temporaryGraphNodeRefs[spentBy];
152
119
  if (parentNode !== undefined) {
153
120
  // Set parent-child relationship
154
- parentNode.children.push(newGraphNode);
121
+ parentNode.children.push(newGraphNode); // Maybe just the graphID should be pushed?
155
122
  newGraphNode.parent = parentNode;
156
- this.temporaryGraphNodeRefs[`${newGraphNode.txid}.${newGraphNode.outputIndex}`] = newGraphNode;
123
+ this.temporaryGraphNodeRefs[tx.graphID] = newGraphNode;
157
124
  }
158
125
  else {
159
126
  throw new Error(`Parent node with GraphID ${spentBy} not found`);
@@ -162,52 +129,70 @@ export class OverlayGASPStorage {
162
129
  }
163
130
  /**
164
131
  * Checks whether the given graph, in its current state, makes reference only to transactions that are proven in the blockchain, or already known by the recipient to be valid.
165
- * Additionally, in a breadth-first manner (ensuring that all inputs for any given node are processed before nodes that spend them), it ensures that the root node remains valid according to the rules of the overlay's topic manager,
166
- * while considering any coins which the Manager had previously indicated were either valid or invalid.
167
132
  * @param graphID The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
168
- * @throws If the graph is not well-anchored, according to the rules of Bitcoin or the rules of the Overlay Topic Manager.
133
+ * @throws If the graph is not well-anchored.
169
134
  */
170
135
  async validateGraphAnchor(graphID) {
171
- const rootNode = this.temporaryGraphNodeRefs[graphID];
172
- if (rootNode === undefined) {
173
- throw new Error(`Graph node with ID ${graphID} not found`);
174
- }
175
- // Check that the root node is Bitcoin-valid.
176
- const beef = this.getBEEFForNode(rootNode);
177
- const spvTx = Transaction.fromBEEF(beef);
178
- const isBitcoinValid = await spvTx.verify(this.engine.chainTracker);
179
- if (!isBitcoinValid) {
180
- throw new Error('The graph is not well-anchored according to the rules of Bitcoin.');
181
- }
182
- // Then, ensure the node is Overlay-valid.
183
- const beefs = this.computeOrderedBEEFsForGraph(graphID);
184
- // coins: a Set of all historical coins to retain (no need to remove them), used to emulate topical admittance of previous inputs over time.
185
- const coins = new Set();
186
- // Submit all historical BEEFs in order through the topic manager, tracking what would be retained until we submit the root node last.
187
- // If, at the end, the root node is admitted, we have a valid overlay-specific graph.
188
- for (const beef of beefs) {
189
- // For any input to this transaction, see if it's a valid coin that's admitted. If so, it's a previous coin.
190
- const previousCoins = [];
191
- const tx = Transaction.fromBEEF(beef);
192
- for (const inputIndex in tx.inputs) {
193
- const input = tx.inputs[inputIndex];
194
- const sourceTXID = input.sourceTXID || input.sourceTransaction?.id('hex');
195
- const coin = `${sourceTXID}.${input.sourceOutputIndex}`;
196
- if (coins.has(coin)) {
197
- previousCoins.push(Number(inputIndex));
136
+ // 1. Confirm that we are well anchored (according to the rules of SPV)
137
+ // 2. Is there some sequence of nodes that will result in the admittance of the root node into the topic
138
+ // 3. If some route that when executed in order to the root node leads to a valid admittance, we are good to go.
139
+ // a) For each node in the chain we need to check topical admittance. For every chain.
140
+ // Take into account previousCoins once you've validated child outputs
141
+ // TODO: Test call stack implications with many recursive function calls for large graphs.
142
+ const validationMap = new Map();
143
+ const validationFunc = async (graphNode) => {
144
+ if (validationMap.has(graphNode.graphID)) {
145
+ return validationMap.get(graphNode.graphID) || false;
146
+ }
147
+ let parsedTx;
148
+ try {
149
+ parsedTx = Transaction.fromHex(graphNode.rawTx);
150
+ if (graphNode.proof !== undefined) {
151
+ parsedTx.merklePath = MerklePath.fromHex(graphNode.proof);
198
152
  }
199
153
  }
200
- const admittanceInstructions = await this.engine.managers[this.topic].identifyAdmissibleOutputs(beef, previousCoins);
201
- // Every admitted output is now a coin.
202
- for (const outputIndex of admittanceInstructions.outputsToAdmit) {
203
- coins.add(`${tx.id('hex')}.${outputIndex}`);
154
+ catch (error) {
155
+ console.error('Error parsing transaction or proof:', error);
156
+ return false;
204
157
  }
158
+ const validatedChildren = [];
159
+ for (const child of graphNode.children) {
160
+ if (!validationMap.has(child.graphID)) {
161
+ const isValidChild = await validationFunc(child);
162
+ if (isValidChild) {
163
+ validatedChildren.push(child);
164
+ }
165
+ }
166
+ else if (validationMap.get(child.graphID)) {
167
+ validatedChildren.push(child);
168
+ }
169
+ }
170
+ let admittanceResult;
171
+ try {
172
+ admittanceResult = await this.engine.managers[this.topic].identifyAdmissibleOutputs(parsedTx.toBEEF(), validatedChildren.map(child => child.outputIndex));
173
+ }
174
+ catch (error) {
175
+ console.error('Error in admittance check:', error);
176
+ return false;
177
+ }
178
+ const isValid = admittanceResult.outputsToAdmit.includes(graphNode.outputIndex);
179
+ validationMap.set(graphNode.graphID, isValid);
180
+ if (isValid === false) {
181
+ return false;
182
+ }
183
+ // Reached the root successfully
184
+ if (graphNode.parent === undefined) {
185
+ return true;
186
+ }
187
+ return await validationFunc(graphNode.parent);
188
+ };
189
+ const tipNode = this.temporaryGraphNodeRefs[graphID];
190
+ if (tipNode === undefined) {
191
+ throw new Error(`Graph node with ID ${graphID} not found`);
205
192
  }
206
- // After sending through all the graph's BEEFs...
207
- // If the root node is now a coin, we have acceptance by the overlay.
208
- // Otherwise, throw.
209
- if (!coins.has(graphID)) {
210
- throw new Error('This graph did not result in topical admittance of the root node. Rejecting.');
193
+ const isValid = await validationFunc(tipNode);
194
+ if (!isValid) {
195
+ throw new Error('The graph is not well-anchored');
211
196
  }
212
197
  }
213
198
  /**
@@ -225,69 +210,10 @@ export class OverlayGASPStorage {
225
210
  }
226
211
  /**
227
212
  * Finalizes a graph, solidifying the new UTXO and its ancestors so that it will appear in the list of known UTXOs.
228
- * @param graphID The TXID and output index (in 36-byte format) for the UTXO at the root of this graph.
213
+ * @param graphID The TXID and output index (in 36-byte format) for the UTXO at the tip of this graph.
229
214
  */
230
215
  async finalizeGraph(graphID) {
231
- const beefs = this.computeOrderedBEEFsForGraph(graphID);
232
- // Submit all historical BEEFs in order, finalizing the graph for the current UTXO
233
- for (const beef of beefs) {
234
- await this.engine.submit({
235
- beef,
236
- topics: [this.topic]
237
- }, () => { }, 'historical-tx');
238
- }
239
- }
240
- /**
241
- * Computes an ordered set of BEEFs for the graph with the given graph IDs
242
- * @param {string} graphID — The ID of the graph for which BEEFs are required
243
- * @returns Ordered BEEFs for the graph
244
- */
245
- computeOrderedBEEFsForGraph(graphID) {
246
- const beefs = [];
247
- const hydrator = (node) => {
248
- const currentBEEF = this.getBEEFForNode(node);
249
- if (beefs.indexOf(currentBEEF) === -1) {
250
- beefs.unshift(currentBEEF);
251
- }
252
- for (const child of node.children) {
253
- // Continue backwards to the earliest nodes, adding them onto the beginning
254
- hydrator(child);
255
- }
256
- };
257
- // Start the hydrator with the root node
258
- const foundRoot = this.temporaryGraphNodeRefs[graphID];
259
- if (!foundRoot) {
260
- throw new Error('Unable to find root node in graph for finalization!');
261
- }
262
- hydrator(foundRoot);
263
- return beefs;
264
- }
265
- /**
266
- * Computes a full BEEF for a given graph node, based on the temporary graph store.
267
- * @param node Graph node for which BEEF is needed.
268
- * @returns BEEF array, including all proofs on inputs.
269
- */
270
- getBEEFForNode(node) {
271
- // Given a node, hydrate its merkle proof or all inputs, returning a reference to the hydrated node's Transaction object
272
- const hydrator = (node) => {
273
- const tx = Transaction.fromHex(node.rawTx);
274
- if (node.proof) {
275
- tx.merklePath = MerklePath.fromHex(node.proof);
276
- return tx; // Transaction with proof, end of the line.
277
- }
278
- // For each input, look it up and recurse.
279
- for (const inputIndex in tx.inputs) {
280
- const input = tx.inputs[inputIndex];
281
- const foundNode = this.temporaryGraphNodeRefs[`${input.sourceTXID}.${input.sourceOutputIndex}`];
282
- if (!foundNode) {
283
- throw new Error('Required input node for unproven parent not found in temporary graph store. Ensure, for every parent of any given already-proven node (kept for Overlay-specific historical reasons), that a proof is also provided on those inputs. While implicitly they are valid by virtue of their descendents being proven in the blockchain, BEEF serialization will still fail when winding forward the topical UTXO set histories during sync.');
284
- }
285
- tx.inputs[inputIndex].sourceTransaction = hydrator(foundNode);
286
- }
287
- return tx;
288
- };
289
- const finalTX = hydrator(node);
290
- return finalTX.toBEEF();
216
+ // TODO: use similar function as validationFunc to construct the finalized graph with necessary components
291
217
  }
292
218
  }
293
219
  //# sourceMappingURL=OverlayGASPStorage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OverlayGASPStorage.js","sourceRoot":"","sources":["../../../../src/GASP/OverlayGASPStorage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAoBlD,MAAM,OAAO,kBAAkB;IAGV;IAAsB;IAAuB;IAFvD,sBAAsB,GAA8B,EAAE,CAAA;IAE/D,YAAmB,KAAa,EAAS,MAAc,EAAS,eAAwB;QAArE,UAAK,GAAL,KAAK,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAQ;QAAS,oBAAe,GAAf,eAAe,CAAS;IAAI,CAAC;IAE7F;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,KAAa;QAChC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAC5E,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC1B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC,CAAC,CAAA;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,eAAe,CAAC,OAAe,EAAE,IAAY,EAAE,WAAmB,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CAAC,CAAA;QACpD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,YAAY,CAAC,CAAA;QAC5D,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAA;QAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACnD,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,OAAe;QAChC,KAAK,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAC7E,IAAI,QAAQ,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;gBACjC,oBAAoB;gBACpB,gEAAgE;gBAChE,OAAO,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAA;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa,CAAC,OAAe;QACjC,0GAA0G;IAC5G,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SHIPAdvertisement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SHIPAdvertisement.js","sourceRoot":"","sources":["../../../src/SHIPAdvertisement.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SLAPAdvertisement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SLAPAdvertisement.js","sourceRoot":"","sources":["../../../src/SLAPAdvertisement.ts"],"names":[],"mappings":""}