@did-btcr2/method 0.58.0 → 0.59.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 +2 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +3 -3
- package/dist/browser.mjs +3 -3
- package/dist/cjs/index.js +91 -6
- package/dist/esm/core/beacon/beacon.js +8 -1
- package/dist/esm/core/beacon/beacon.js.map +1 -1
- package/dist/esm/core/beacon/signal-discovery.js +24 -3
- package/dist/esm/core/beacon/signal-discovery.js.map +1 -1
- package/dist/esm/core/resolver.js +77 -3
- package/dist/esm/core/resolver.js.map +1 -1
- package/dist/esm/did-btcr2.js +2 -1
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/types/core/beacon/beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/signal-discovery.d.ts +14 -0
- package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +13 -0
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/dist/types/core/resolver.d.ts +13 -0
- package/dist/types/core/resolver.d.ts.map +1 -1
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/beacon/beacon.ts +14 -3
- package/src/core/beacon/signal-discovery.ts +25 -3
- package/src/core/interfaces.ts +13 -0
- package/src/core/resolver.ts +87 -3
- package/src/did-btcr2.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-btcr2.js","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,GAAG,EACH,QAAQ,EACR,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE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AAkB,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,kBAAkB,EAAE,IAAI,CAClG,CAAC,EAAyB,EAAE,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,CAAC,KAAK,QAAQ,CAC3F,CAAC;QAEF,qDAAqD;QACrD,IAAI,CAAC,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,QAAQ,CAChB,YAAY,CAAC,aAAa,EAC1B,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,OAAO,kBAA2C,CAAC;IACrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAqB,MAAM,oBAAoB,CAAC;AACxG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAA4D,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,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E,iBAAiB,CAAC;QAC3B,YAAY,EAAE,YAAY,CAAC;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,YAAY,CAAC;IAkFzB;;;OAGG;cACa,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOtF;;OAEG;cACa,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5F"}
|
|
@@ -51,6 +51,20 @@ export declare class BeaconSignalDiscovery {
|
|
|
51
51
|
/**
|
|
52
52
|
* Retrieves the beacon signals for the given array of BeaconService objects
|
|
53
53
|
* using an esplora/electrs REST API connection via a bitcoin I/O driver.
|
|
54
|
+
*
|
|
55
|
+
* The address listing includes mempool transactions. The method skips a
|
|
56
|
+
* transaction whose `status.confirmed` is not `true`. A mempool transaction
|
|
57
|
+
* has no block height and no block time, so it cannot carry block metadata.
|
|
58
|
+
* The specification also says that a resolver must not process an
|
|
59
|
+
* unconfirmed transaction. An absent flag counts as unconfirmed, as it does
|
|
60
|
+
* for UTXO selection. The check runs before the OP_RETURN parse, so a
|
|
61
|
+
* mempool transaction costs no prevout fetch. The {@link fullnode} path
|
|
62
|
+
* needs no such check: it walks mined blocks only.
|
|
63
|
+
*
|
|
64
|
+
* The `confirmations` count uses the block count fetched before the listing.
|
|
65
|
+
* A block that arrives between the two calls yields a count of `0` for its
|
|
66
|
+
* transactions. The resolver then excludes them, because its minimum is at
|
|
67
|
+
* least `1`. An under-count is the safe direction, so keep that order.
|
|
54
68
|
* @param {Array<BeaconService>} beaconServices Array of BeaconService objects to retrieve signals for
|
|
55
69
|
* @param {BitcoinConnection} bitcoin Bitcoin network connection to use for REST calls
|
|
56
70
|
* @returns {Promise<Map<BeaconService, Array<BeaconSignal>>>} Map of beacon service to its discovered signals
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-discovery.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/signal-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAGA,MAAM,oBAAoB,CAAC;AAM9C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAWnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAWzF;AAED;;;;;GAKG;AACH,qBAAa,qBAAqB;IAEhC;;;;;;;;;;;;;;;;;;OAkBG;mBACkB,iBAAiB;IA2BtC
|
|
1
|
+
{"version":3,"file":"signal-discovery.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/signal-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAGA,MAAM,oBAAoB,CAAC;AAM9C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAWnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAWzF;AAED;;;;;GAKG;AACH,qBAAa,qBAAqB;IAEhC;;;;;;;;;;;;;;;;;;OAkBG;mBACkB,iBAAiB;IA2BtC;;;;;;;;;;;;;;;;;;;;OAoBG;WACU,OAAO,CAClB,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,EACpC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IA+EnD;;;;;OAKG;WACU,QAAQ,CACnB,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,EACpC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;CAgKpD"}
|
|
@@ -41,6 +41,19 @@ export interface ResolutionOptions extends DidResolutionOptions {
|
|
|
41
41
|
* document is well-formed, the resolver simply stopped at the caller's limit.
|
|
42
42
|
*/
|
|
43
43
|
maxDiscoveryRounds?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Minimum number of Bitcoin block confirmations a Beacon Signal transaction
|
|
46
|
+
* must have before resolution processes it. A positive integer, minimum `1`.
|
|
47
|
+
* Defaults to `6` ({@link DEFAULT_MIN_CONF}), the value the specification
|
|
48
|
+
* mandates. A signal below the threshold is excluded from the resolution
|
|
49
|
+
* as if it did not exist yet; the rest of the signals are processed. A lower
|
|
50
|
+
* value shows a fresh update sooner and raises the exposure to a block
|
|
51
|
+
* reorganization. The `confirmations` field of the resolution metadata
|
|
52
|
+
* reports the depth of the last applied signal, so a consumer can judge it.
|
|
53
|
+
* Any other value (`0`, a negative number, a fraction, `NaN`, a string)
|
|
54
|
+
* fails with a `ResolveError` of type `INVALID_OPTIONS`.
|
|
55
|
+
*/
|
|
56
|
+
minConf?: number;
|
|
44
57
|
}
|
|
45
58
|
/**
|
|
46
59
|
* {@link https://dcdpr.github.io/did-btcr2/terminology.html#smt-proof | SMT Proof}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
|
@@ -5,6 +5,14 @@ import type { BeaconService, BeaconSignal, BlockMetadata } from './beacon/interf
|
|
|
5
5
|
import type { DidComponents } from './identifier.js';
|
|
6
6
|
import type { SMTProof } from './interfaces.js';
|
|
7
7
|
import type { CASAnnouncement, Sidecar, SidecarData } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Default minimum number of Bitcoin block confirmations a Beacon Signal
|
|
10
|
+
* transaction must have before resolution processes it. The specification
|
|
11
|
+
* mandates `6` when `ResolutionOptions.minConf` is not set: six confirmations
|
|
12
|
+
* is the accepted standard for a settled Bitcoin transaction. A resolution
|
|
13
|
+
* request can raise or lower it through `minConf`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_MIN_CONF = 6;
|
|
8
16
|
/**
|
|
9
17
|
* The response object for DID Resolution.
|
|
10
18
|
*/
|
|
@@ -107,6 +115,7 @@ export declare class Resolver {
|
|
|
107
115
|
versionTime?: string;
|
|
108
116
|
genesisDocument?: object;
|
|
109
117
|
maxDiscoveryRounds?: number;
|
|
118
|
+
minConf?: number;
|
|
110
119
|
});
|
|
111
120
|
/**
|
|
112
121
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#if-genesis_bytes-is-a-secp256k1-public-key | 7.2.d.1 if genesis bytes is a secp256k1 Public Key}.
|
|
@@ -138,6 +147,10 @@ export declare class Resolver {
|
|
|
138
147
|
* Version counter and update-hash history carried from earlier discovery rounds.
|
|
139
148
|
* Standalone callers omit it and start fresh at version 1 with an empty history.
|
|
140
149
|
* @returns {DidResolutionResponse} The updated DID Document, number of confirmations, and version id.
|
|
150
|
+
*
|
|
151
|
+
* Confirmation depth is not checked here. The BeaconProcess phase excludes a
|
|
152
|
+
* signal below `ResolutionOptions.minConf` before its update reaches this method,
|
|
153
|
+
* so every tuple here comes from a block at or above the threshold.
|
|
141
154
|
*/
|
|
142
155
|
static updates(currentDocument: DidDocument, unsortedUpdates: Array<[SignedBTCR2Update, BlockMetadata]>, versionTime?: string, versionId?: string, resolutionState?: {
|
|
143
156
|
currentVersionId: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/core/resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/core/resolver.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,KAAK,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGxE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE;QACR,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAA;CACF;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,yFAAyF;IACzF,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CACvD;AAED,2FAA2F;AAC3F,MAAM,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MAAM,CAAC;QACxB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO;IAwEX;;;;;;;;;OASG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAG,QAAQ,CAAC,EAAE,MAAM,GAAG,qBAAqB;CAiClG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@did-btcr2/method",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Reference implementation for the did:btcr2 DID method written in TypeScript and JavaScript. did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. This is the core method implementation for the did-btcr2-js monorepo.",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"@scure/base": "^1.2.6",
|
|
70
70
|
"@scure/btc-signer": "^1.8.1",
|
|
71
71
|
"@web5/dids": "^1.2.0",
|
|
72
|
-
"@did-btcr2/bitcoin": "^0.
|
|
73
|
-
"@did-btcr2/smt": "^0.3.0",
|
|
72
|
+
"@did-btcr2/bitcoin": "^0.11.0",
|
|
74
73
|
"@did-btcr2/cryptosuite": "^10.0.0",
|
|
74
|
+
"@did-btcr2/common": "^9.4.0",
|
|
75
75
|
"@did-btcr2/keypair": "^0.13.1",
|
|
76
|
-
"@did-btcr2/
|
|
76
|
+
"@did-btcr2/smt": "^0.3.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@eslint/js": "^9.39.4",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AddressUtxo, BitcoinConnection, BTCNetwork } from '@did-btcr2/bitcoin';
|
|
1
|
+
import type { AddressUtxo, BitcoinConnection, BTCNetwork, TransactionStatus } from '@did-btcr2/bitcoin';
|
|
2
2
|
import type { KeyBytes } from '@did-btcr2/common';
|
|
3
3
|
import type { SignedBTCR2Update } from '../btcr2-update.js';
|
|
4
4
|
import type { Signer } from '@did-btcr2/keypair';
|
|
@@ -280,13 +280,24 @@ export function opReturnScript(signalBytes: Uint8Array): Uint8Array {
|
|
|
280
280
|
*/
|
|
281
281
|
export const SPENDABLE_DUST_LIMIT_SATS = 546;
|
|
282
282
|
|
|
283
|
+
/** A UTXO whose status carries the block fields: the confirmed arm of {@link TransactionStatus}. */
|
|
284
|
+
type ConfirmedUtxo = AddressUtxo & { status: Extract<TransactionStatus, { confirmed: true }> };
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* True if the UTXO is confirmed. Narrows the status to the confirmed arm, so the
|
|
288
|
+
* block height reads as a number. An absent flag counts as unconfirmed.
|
|
289
|
+
*/
|
|
290
|
+
function isConfirmedUtxo(utxo: AddressUtxo): utxo is ConfirmedUtxo {
|
|
291
|
+
return utxo.status.confirmed === true;
|
|
292
|
+
}
|
|
293
|
+
|
|
283
294
|
/**
|
|
284
295
|
* Deterministic ordering for spendable UTXO selection: deepest first (ascending
|
|
285
296
|
* block height, so the most-confirmed UTXO sorts first), tie-broken by `txid` then
|
|
286
297
|
* `vout`. The tie-break makes the winner independent of the order the REST API
|
|
287
298
|
* returns UTXOs in, so retries and independent resolvers converge on the same input.
|
|
288
299
|
*/
|
|
289
|
-
function byDepthThenId(a:
|
|
300
|
+
function byDepthThenId(a: ConfirmedUtxo, b: ConfirmedUtxo): number {
|
|
290
301
|
if(a.status.block_height !== b.status.block_height) {
|
|
291
302
|
return a.status.block_height - b.status.block_height;
|
|
292
303
|
}
|
|
@@ -321,7 +332,7 @@ export function selectSpendableUtxo(utxos: Array<AddressUtxo>, address?: string)
|
|
|
321
332
|
'UNFUNDED_BEACON_ADDRESS', { address }
|
|
322
333
|
);
|
|
323
334
|
}
|
|
324
|
-
const confirmed = utxos.filter(
|
|
335
|
+
const confirmed = utxos.filter(isConfirmedUtxo);
|
|
325
336
|
const spendable = confirmed.filter(utxo => utxo.value > SPENDABLE_DUST_LIMIT_SATS);
|
|
326
337
|
if(!spendable.length) {
|
|
327
338
|
const reason = confirmed.length === 0
|
|
@@ -109,6 +109,20 @@ export class BeaconSignalDiscovery {
|
|
|
109
109
|
/**
|
|
110
110
|
* Retrieves the beacon signals for the given array of BeaconService objects
|
|
111
111
|
* using an esplora/electrs REST API connection via a bitcoin I/O driver.
|
|
112
|
+
*
|
|
113
|
+
* The address listing includes mempool transactions. The method skips a
|
|
114
|
+
* transaction whose `status.confirmed` is not `true`. A mempool transaction
|
|
115
|
+
* has no block height and no block time, so it cannot carry block metadata.
|
|
116
|
+
* The specification also says that a resolver must not process an
|
|
117
|
+
* unconfirmed transaction. An absent flag counts as unconfirmed, as it does
|
|
118
|
+
* for UTXO selection. The check runs before the OP_RETURN parse, so a
|
|
119
|
+
* mempool transaction costs no prevout fetch. The {@link fullnode} path
|
|
120
|
+
* needs no such check: it walks mined blocks only.
|
|
121
|
+
*
|
|
122
|
+
* The `confirmations` count uses the block count fetched before the listing.
|
|
123
|
+
* A block that arrives between the two calls yields a count of `0` for its
|
|
124
|
+
* transactions. The resolver then excludes them, because its minimum is at
|
|
125
|
+
* least `1`. An under-count is the safe direction, so keep that order.
|
|
112
126
|
* @param {Array<BeaconService>} beaconServices Array of BeaconService objects to retrieve signals for
|
|
113
127
|
* @param {BitcoinConnection} bitcoin Bitcoin network connection to use for REST calls
|
|
114
128
|
* @returns {Promise<Map<BeaconService, Array<BeaconSignal>>>} Map of beacon service to its discovered signals
|
|
@@ -136,6 +150,14 @@ export class BeaconSignalDiscovery {
|
|
|
136
150
|
|
|
137
151
|
// Iterate over each signal
|
|
138
152
|
for (const beaconSignal of beaconSignals) {
|
|
153
|
+
// Skip a mempool transaction before any parse or fetch. Esplora reports it
|
|
154
|
+
// as `{ confirmed: false }` with no block fields, so it has no block
|
|
155
|
+
// metadata, and the specification forbids a resolver to process it.
|
|
156
|
+
const status = beaconSignal.status;
|
|
157
|
+
if(status.confirmed !== true) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
|
|
139
161
|
// Get the last vout in the transaction
|
|
140
162
|
const lastSignalVout = beaconSignal.vout.slice(-1)[0];
|
|
141
163
|
|
|
@@ -169,7 +191,7 @@ export class BeaconSignalDiscovery {
|
|
|
169
191
|
}
|
|
170
192
|
|
|
171
193
|
// Use the pre-fetched block count instead of calling per-signal
|
|
172
|
-
const confirmations = currentBlockCount -
|
|
194
|
+
const confirmations = currentBlockCount - status.block_height + 1;
|
|
173
195
|
|
|
174
196
|
// Push the beacon signal object to the signals array for the beacon service
|
|
175
197
|
beaconServiceSignals.get(beaconService)?.push({
|
|
@@ -177,8 +199,8 @@ export class BeaconSignalDiscovery {
|
|
|
177
199
|
signalBytes : updateHash,
|
|
178
200
|
blockMetadata : {
|
|
179
201
|
confirmations,
|
|
180
|
-
height :
|
|
181
|
-
time :
|
|
202
|
+
height : status.block_height,
|
|
203
|
+
time : status.block_time,
|
|
182
204
|
}
|
|
183
205
|
});
|
|
184
206
|
}
|
package/src/core/interfaces.ts
CHANGED
|
@@ -47,6 +47,19 @@ export interface ResolutionOptions extends DidResolutionOptions {
|
|
|
47
47
|
*/
|
|
48
48
|
maxDiscoveryRounds?: number;
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Minimum number of Bitcoin block confirmations a Beacon Signal transaction
|
|
52
|
+
* must have before resolution processes it. A positive integer, minimum `1`.
|
|
53
|
+
* Defaults to `6` ({@link DEFAULT_MIN_CONF}), the value the specification
|
|
54
|
+
* mandates. A signal below the threshold is excluded from the resolution
|
|
55
|
+
* as if it did not exist yet; the rest of the signals are processed. A lower
|
|
56
|
+
* value shows a fresh update sooner and raises the exposure to a block
|
|
57
|
+
* reorganization. The `confirmations` field of the resolution metadata
|
|
58
|
+
* reports the depth of the last applied signal, so a consumer can judge it.
|
|
59
|
+
* Any other value (`0`, a negative number, a fraction, `NaN`, a string)
|
|
60
|
+
* fails with a `ResolveError` of type `INVALID_OPTIONS`.
|
|
61
|
+
*/
|
|
62
|
+
minConf?: number;
|
|
50
63
|
}
|
|
51
64
|
|
|
52
65
|
/**
|
package/src/core/resolver.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
INTERNAL_ERROR,
|
|
10
10
|
INVALID_DID_DOCUMENT,
|
|
11
11
|
INVALID_DID_UPDATE,
|
|
12
|
+
INVALID_OPTIONS,
|
|
12
13
|
JSONPatch,
|
|
13
14
|
JSONUtils,
|
|
14
15
|
LATE_PUBLISHING_ERROR,
|
|
@@ -37,6 +38,15 @@ import type { SMTProof } from './interfaces.js';
|
|
|
37
38
|
import type { CASAnnouncement, Sidecar, SidecarData } from './types.js';
|
|
38
39
|
import { equalBytes } from '@noble/curves/utils.js';
|
|
39
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Default minimum number of Bitcoin block confirmations a Beacon Signal
|
|
43
|
+
* transaction must have before resolution processes it. The specification
|
|
44
|
+
* mandates `6` when `ResolutionOptions.minConf` is not set: six confirmations
|
|
45
|
+
* is the accepted standard for a settled Bitcoin transaction. A resolution
|
|
46
|
+
* request can raise or lower it through `minConf`.
|
|
47
|
+
*/
|
|
48
|
+
export const DEFAULT_MIN_CONF = 6;
|
|
49
|
+
|
|
40
50
|
/**
|
|
41
51
|
* The response object for DID Resolution.
|
|
42
52
|
*/
|
|
@@ -149,6 +159,22 @@ function isSMTProof(value: unknown): value is SMTProof {
|
|
|
149
159
|
&& Array.isArray(value.hashes);
|
|
150
160
|
}
|
|
151
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Validate `ResolutionOptions.minConf`. `undefined` selects the specification
|
|
164
|
+
* default, {@link DEFAULT_MIN_CONF}. Any other value must be an integer of at
|
|
165
|
+
* least 1, as the specification defines the option.
|
|
166
|
+
* @throws {ResolveError} `INVALID_OPTIONS` for every other value.
|
|
167
|
+
*/
|
|
168
|
+
function validateMinConf(value: unknown): number {
|
|
169
|
+
if(value === undefined) return DEFAULT_MIN_CONF;
|
|
170
|
+
if(typeof value === 'number' && Number.isInteger(value) && value >= 1) return value;
|
|
171
|
+
const shown = typeof value === 'string' ? JSON.stringify(value) : String(value);
|
|
172
|
+
throw new ResolveError(
|
|
173
|
+
`Invalid resolution option minConf: expected a positive integer (minimum 1), got ${shown}.`,
|
|
174
|
+
INVALID_OPTIONS, { minConf: value }
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
152
178
|
/**
|
|
153
179
|
* Different possible Resolver states representing phases in the resolution process.
|
|
154
180
|
*/
|
|
@@ -225,6 +251,15 @@ export class Resolver {
|
|
|
225
251
|
/** Count of beacon-discovery passes driven by updates adding new beacon services. */
|
|
226
252
|
#discoveryRounds = 0;
|
|
227
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Minimum block confirmations a Beacon Signal must have before this resolver
|
|
256
|
+
* processes it: `ResolutionOptions.minConf`, default {@link DEFAULT_MIN_CONF}.
|
|
257
|
+
* Applied at signal intake in the BeaconProcess phase. A signal below the
|
|
258
|
+
* threshold is excluded from the resolution; the rest of the signals are
|
|
259
|
+
* processed.
|
|
260
|
+
*/
|
|
261
|
+
readonly #minConf: number;
|
|
262
|
+
|
|
228
263
|
|
|
229
264
|
/**
|
|
230
265
|
* @internal Use {@link DidBtcr2.resolve} to create instances.
|
|
@@ -238,6 +273,7 @@ export class Resolver {
|
|
|
238
273
|
versionTime?: string;
|
|
239
274
|
genesisDocument?: object;
|
|
240
275
|
maxDiscoveryRounds?: number;
|
|
276
|
+
minConf?: number;
|
|
241
277
|
}
|
|
242
278
|
) {
|
|
243
279
|
this.#didComponents = didComponents;
|
|
@@ -249,6 +285,9 @@ export class Resolver {
|
|
|
249
285
|
// finite resource guard. A non-positive or omitted value means no limit.
|
|
250
286
|
const rounds = options?.maxDiscoveryRounds;
|
|
251
287
|
this.#maxDiscoveryRounds = typeof rounds === 'number' && rounds > 0 ? rounds : Infinity;
|
|
288
|
+
// The signal confirmation threshold. An invalid value fails here, before any
|
|
289
|
+
// data need is emitted, so the caller does no I/O for a request it cannot serve.
|
|
290
|
+
this.#minConf = validateMinConf(options?.minConf);
|
|
252
291
|
|
|
253
292
|
// If a genesis document was provided (from sidecar), pre-seed it for validation
|
|
254
293
|
if(options?.genesisDocument) {
|
|
@@ -374,6 +413,10 @@ export class Resolver {
|
|
|
374
413
|
* Version counter and update-hash history carried from earlier discovery rounds.
|
|
375
414
|
* Standalone callers omit it and start fresh at version 1 with an empty history.
|
|
376
415
|
* @returns {DidResolutionResponse} The updated DID Document, number of confirmations, and version id.
|
|
416
|
+
*
|
|
417
|
+
* Confirmation depth is not checked here. The BeaconProcess phase excludes a
|
|
418
|
+
* signal below `ResolutionOptions.minConf` before its update reaches this method,
|
|
419
|
+
* so every tuple here comes from a block at or above the threshold.
|
|
377
420
|
*/
|
|
378
421
|
static updates(
|
|
379
422
|
currentDocument: DidDocument,
|
|
@@ -414,8 +457,6 @@ export class Resolver {
|
|
|
414
457
|
// Safely convert block.time to timestamp
|
|
415
458
|
const blocktime = DateUtils.blocktimeToTimestamp(block.time);
|
|
416
459
|
|
|
417
|
-
// TODO: How to detect if block is unconfirmed and exit gracefully or return without it
|
|
418
|
-
|
|
419
460
|
// Set the updated field to the blocktime of the current update
|
|
420
461
|
response.metadata.updated = DateUtils.toISOStringNonFractional(blocktime);
|
|
421
462
|
|
|
@@ -752,11 +793,17 @@ export class Resolver {
|
|
|
752
793
|
// Skip already-processed services and services with no signals
|
|
753
794
|
if(this.#processedServices.has(service.id) || !signals.length) continue;
|
|
754
795
|
|
|
796
|
+
// Keep only the signals at or above the confirmation threshold. A
|
|
797
|
+
// service whose signals are all below it is treated like a service
|
|
798
|
+
// with no signals: it is not processed and not marked processed.
|
|
799
|
+
const eligible = this.#eligibleSignals(signals);
|
|
800
|
+
if(!eligible.length) continue;
|
|
801
|
+
|
|
755
802
|
// Establish a typed beacon and process its signals
|
|
756
803
|
// The beacon is bound to the DID under resolution: a beacon service
|
|
757
804
|
// `id` may be a relative DID URL, so it cannot supply the subject.
|
|
758
805
|
const beacon = BeaconFactory.establish(service, this.#currentDocument!.id);
|
|
759
|
-
const result = beacon.processSignals(
|
|
806
|
+
const result = beacon.processSignals(eligible, this.#sidecarData);
|
|
760
807
|
|
|
761
808
|
if(result.needs.length > 0) {
|
|
762
809
|
// This service has unmet data needs, collect them
|
|
@@ -846,6 +893,43 @@ export class Resolver {
|
|
|
846
893
|
}
|
|
847
894
|
}
|
|
848
895
|
|
|
896
|
+
/**
|
|
897
|
+
* Return the signals of one beacon service that resolution may process: the
|
|
898
|
+
* signals with at least `#minConf` confirmations. The specification removes a
|
|
899
|
+
* transaction below the threshold from the set of Beacon Signals, so an
|
|
900
|
+
* excluded signal emits no data need and applies no update. A signal with no
|
|
901
|
+
* integer confirmation count is excluded too: that is a mempool transaction
|
|
902
|
+
* from a driver that did not skip it.
|
|
903
|
+
*
|
|
904
|
+
* An eligible signal must carry a finite block height and block time. A
|
|
905
|
+
* signal that passes the count but lacks them is malformed. It fails fast
|
|
906
|
+
* here with a typed error, in the style of the {@link provide} guards, and
|
|
907
|
+
* not later with an invalid date inside {@link updates}.
|
|
908
|
+
* @param {Array<BeaconSignal>} signals The signals the caller provided for one service.
|
|
909
|
+
* @returns {Array<BeaconSignal>} The signals at or above the threshold, in the given order.
|
|
910
|
+
* @throws {ResolveError} `INVALID_DID_UPDATE` for an eligible signal with no valid block metadata.
|
|
911
|
+
*/
|
|
912
|
+
#eligibleSignals(signals: Array<BeaconSignal>): Array<BeaconSignal> {
|
|
913
|
+
const eligible: Array<BeaconSignal> = [];
|
|
914
|
+
for(const signal of signals) {
|
|
915
|
+
const block = signal.blockMetadata as Partial<BlockMetadata> | undefined;
|
|
916
|
+
const confirmations = block?.confirmations;
|
|
917
|
+
if(!Number.isInteger(confirmations) || (confirmations as number) < this.#minConf) {
|
|
918
|
+
continue;
|
|
919
|
+
}
|
|
920
|
+
if(!Number.isFinite(block?.height) || !Number.isFinite(block?.time)) {
|
|
921
|
+
throw new ResolveError(
|
|
922
|
+
`Beacon signal ${signal.signalBytes} has ${confirmations} confirmations `
|
|
923
|
+
+ 'but no valid block height or block time.',
|
|
924
|
+
INVALID_DID_UPDATE,
|
|
925
|
+
{ signalBytes: signal.signalBytes, confirmations, height: block?.height, time: block?.time }
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
eligible.push(signal);
|
|
929
|
+
}
|
|
930
|
+
return eligible;
|
|
931
|
+
}
|
|
932
|
+
|
|
849
933
|
/**
|
|
850
934
|
* Provide data the resolver requested in a previous {@link resolve} call.
|
|
851
935
|
* Call once per need, then call {@link resolve} again to continue.
|
package/src/did-btcr2.ts
CHANGED
|
@@ -131,7 +131,8 @@ export class DidBtcr2 implements DidMethod {
|
|
|
131
131
|
versionId : resolutionOptions.versionId,
|
|
132
132
|
versionTime : resolutionOptions.versionTime,
|
|
133
133
|
genesisDocument : resolutionOptions.sidecar?.genesisDocument,
|
|
134
|
-
maxDiscoveryRounds : resolutionOptions.maxDiscoveryRounds
|
|
134
|
+
maxDiscoveryRounds : resolutionOptions.maxDiscoveryRounds,
|
|
135
|
+
minConf : resolutionOptions.minConf
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
|