@did-btcr2/method 0.29.0 → 0.32.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.
Files changed (104) hide show
  1. package/README.md +13 -5
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/browser.js +8174 -7157
  4. package/dist/browser.mjs +8174 -7157
  5. package/dist/cjs/index.js +1845 -455
  6. package/dist/esm/core/aggregation/transport/factory.js +15 -6
  7. package/dist/esm/core/aggregation/transport/factory.js.map +1 -1
  8. package/dist/esm/core/aggregation/transport/http/client.js +350 -0
  9. package/dist/esm/core/aggregation/transport/http/client.js.map +1 -0
  10. package/dist/esm/core/aggregation/transport/http/envelope.js +126 -0
  11. package/dist/esm/core/aggregation/transport/http/envelope.js.map +1 -0
  12. package/dist/esm/core/aggregation/transport/http/errors.js +11 -0
  13. package/dist/esm/core/aggregation/transport/http/errors.js.map +1 -0
  14. package/dist/esm/core/aggregation/transport/http/inbox-buffer.js +45 -0
  15. package/dist/esm/core/aggregation/transport/http/inbox-buffer.js.map +1 -0
  16. package/dist/esm/core/aggregation/transport/http/index.js +12 -0
  17. package/dist/esm/core/aggregation/transport/http/index.js.map +1 -0
  18. package/dist/esm/core/aggregation/transport/http/nonce-cache.js +38 -0
  19. package/dist/esm/core/aggregation/transport/http/nonce-cache.js.map +1 -0
  20. package/dist/esm/core/aggregation/transport/http/protocol.js +28 -0
  21. package/dist/esm/core/aggregation/transport/http/protocol.js.map +1 -0
  22. package/dist/esm/core/aggregation/transport/http/rate-limiter.js +45 -0
  23. package/dist/esm/core/aggregation/transport/http/rate-limiter.js.map +1 -0
  24. package/dist/esm/core/aggregation/transport/http/request-auth.js +100 -0
  25. package/dist/esm/core/aggregation/transport/http/request-auth.js.map +1 -0
  26. package/dist/esm/core/aggregation/transport/http/server.js +481 -0
  27. package/dist/esm/core/aggregation/transport/http/server.js.map +1 -0
  28. package/dist/esm/core/aggregation/transport/http/sse-stream.js +110 -0
  29. package/dist/esm/core/aggregation/transport/http/sse-stream.js.map +1 -0
  30. package/dist/esm/core/aggregation/transport/http/sse-writer.js +25 -0
  31. package/dist/esm/core/aggregation/transport/http/sse-writer.js.map +1 -0
  32. package/dist/esm/core/aggregation/transport/index.js +1 -0
  33. package/dist/esm/core/aggregation/transport/index.js.map +1 -1
  34. package/dist/esm/core/beacon/beacon.js +197 -51
  35. package/dist/esm/core/beacon/beacon.js.map +1 -1
  36. package/dist/esm/core/beacon/cas-beacon.js +3 -3
  37. package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
  38. package/dist/esm/core/beacon/singleton-beacon.js +3 -3
  39. package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
  40. package/dist/esm/core/beacon/smt-beacon.js +3 -3
  41. package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
  42. package/dist/esm/core/updater.js +63 -55
  43. package/dist/esm/core/updater.js.map +1 -1
  44. package/dist/types/core/aggregation/transport/factory.d.ts +22 -7
  45. package/dist/types/core/aggregation/transport/factory.d.ts.map +1 -1
  46. package/dist/types/core/aggregation/transport/http/client.d.ts +48 -0
  47. package/dist/types/core/aggregation/transport/http/client.d.ts.map +1 -0
  48. package/dist/types/core/aggregation/transport/http/envelope.d.ts +64 -0
  49. package/dist/types/core/aggregation/transport/http/envelope.d.ts.map +1 -0
  50. package/dist/types/core/aggregation/transport/http/errors.d.ts +9 -0
  51. package/dist/types/core/aggregation/transport/http/errors.d.ts.map +1 -0
  52. package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts +32 -0
  53. package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts.map +1 -0
  54. package/dist/types/core/aggregation/transport/http/index.d.ts +12 -0
  55. package/dist/types/core/aggregation/transport/http/index.d.ts.map +1 -0
  56. package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts +26 -0
  57. package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts.map +1 -0
  58. package/dist/types/core/aggregation/transport/http/protocol.d.ts +53 -0
  59. package/dist/types/core/aggregation/transport/http/protocol.d.ts.map +1 -0
  60. package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts +41 -0
  61. package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts.map +1 -0
  62. package/dist/types/core/aggregation/transport/http/request-auth.d.ts +50 -0
  63. package/dist/types/core/aggregation/transport/http/request-auth.d.ts.map +1 -0
  64. package/dist/types/core/aggregation/transport/http/server.d.ts +110 -0
  65. package/dist/types/core/aggregation/transport/http/server.d.ts.map +1 -0
  66. package/dist/types/core/aggregation/transport/http/sse-stream.d.ts +34 -0
  67. package/dist/types/core/aggregation/transport/http/sse-stream.d.ts.map +1 -0
  68. package/dist/types/core/aggregation/transport/http/sse-writer.d.ts +12 -0
  69. package/dist/types/core/aggregation/transport/http/sse-writer.d.ts.map +1 -0
  70. package/dist/types/core/aggregation/transport/index.d.ts +1 -0
  71. package/dist/types/core/aggregation/transport/index.d.ts.map +1 -1
  72. package/dist/types/core/aggregation/transport/transport.d.ts +1 -1
  73. package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -1
  74. package/dist/types/core/beacon/beacon.d.ts +72 -12
  75. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  76. package/dist/types/core/beacon/cas-beacon.d.ts +3 -3
  77. package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
  78. package/dist/types/core/beacon/singleton-beacon.d.ts +3 -3
  79. package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -1
  80. package/dist/types/core/beacon/smt-beacon.d.ts +3 -3
  81. package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
  82. package/dist/types/core/updater.d.ts +27 -12
  83. package/dist/types/core/updater.d.ts.map +1 -1
  84. package/package.json +5 -5
  85. package/src/core/aggregation/transport/factory.ts +48 -12
  86. package/src/core/aggregation/transport/http/client.ts +409 -0
  87. package/src/core/aggregation/transport/http/envelope.ts +204 -0
  88. package/src/core/aggregation/transport/http/errors.ts +11 -0
  89. package/src/core/aggregation/transport/http/inbox-buffer.ts +53 -0
  90. package/src/core/aggregation/transport/http/index.ts +11 -0
  91. package/src/core/aggregation/transport/http/nonce-cache.ts +43 -0
  92. package/src/core/aggregation/transport/http/protocol.ts +57 -0
  93. package/src/core/aggregation/transport/http/rate-limiter.ts +75 -0
  94. package/src/core/aggregation/transport/http/request-auth.ts +164 -0
  95. package/src/core/aggregation/transport/http/server.ts +615 -0
  96. package/src/core/aggregation/transport/http/sse-stream.ts +121 -0
  97. package/src/core/aggregation/transport/http/sse-writer.ts +23 -0
  98. package/src/core/aggregation/transport/index.ts +1 -0
  99. package/src/core/aggregation/transport/transport.ts +1 -1
  100. package/src/core/beacon/beacon.ts +255 -64
  101. package/src/core/beacon/cas-beacon.ts +4 -4
  102. package/src/core/beacon/singleton-beacon.ts +4 -4
  103. package/src/core/beacon/smt-beacon.ts +4 -4
  104. package/src/core/updater.ts +113 -67
@@ -1,24 +1,78 @@
1
- import { getPublicKey } from '@noble/secp256k1';
2
- import { hexToBytes } from '@noble/hashes/utils';
3
- import { OP, p2tr, p2wpkh, Script, Transaction } from '@scure/btc-signer';
1
+ import { concatBytes, hexToBytes } from '@noble/hashes/utils.js';
2
+ import { Address, OutScript, p2pkh, p2tr, p2wpkh, Script, SigHash, Transaction } from '@scure/btc-signer';
4
3
  import { BeaconError } from './error.js';
5
4
  import { StaticFeeEstimator } from './fee-estimator.js';
6
5
  /** Default fee estimator used when none is supplied. ~5 sat/vB static rate. */
7
6
  const DEFAULT_FEE_ESTIMATOR = new StaticFeeEstimator(5);
8
7
  /**
9
8
  * Conservative vsize estimate for a 1-input P2TR key-path → 1 P2TR change + 1 OP_RETURN(32) tx.
10
- * Taproot key-path witness is a fixed 64-byte Schnorr signature, so vsize is predictable
11
- * without having to sign. Used for fee estimation in the aggregation path where MuSig2
12
- * signatures are produced externally.
9
+ * Stripped 137 + witness 68 (marker + flag + stack-count + sig-len + 64 BIP-340 sig).
10
+ * Weight = 137*4 + 68 = 616, vsize 154, rounded to 160 for headroom.
13
11
  */
14
- const P2TR_BEACON_TX_VSIZE = 140;
12
+ export const P2TR_BEACON_TX_VSIZE = 160;
13
+ /**
14
+ * Conservative vsize estimate for a 1-input P2WPKH → 1 P2WPKH change + 1 OP_RETURN(32) tx.
15
+ * Stripped 125 + witness ≈ 110 (worst-case DER ECDSA sig 72 + sighash byte + 33 pubkey + framing).
16
+ * vsize = ceil((125*4 + 110) / 4) ≈ 153, rounded to 155.
17
+ */
18
+ export const P2WPKH_BEACON_TX_VSIZE = 155;
19
+ /**
20
+ * Conservative vsize estimate for a 1-input P2PKH → 1 P2PKH change + 1 OP_RETURN(32) tx.
21
+ * Legacy (non-segwit): scriptSig carries the full sig+pubkey (~108 bytes), no witness
22
+ * discount. Stripped ≈ 4 nVer + 1 vin-count + (32+4+1+108+4) input + 1 vout-count +
23
+ * 34 P2PKH-change + 43 OP_RETURN + 4 nLockTime ≈ 236 bytes. vsize = 236, rounded to 240.
24
+ */
25
+ export const P2PKH_BEACON_TX_VSIZE = 240;
26
+ /** Per-kind vsize lookup for singleton beacon fee estimation. */
27
+ export const SINGLETON_BEACON_TX_VSIZE = {
28
+ p2pkh: P2PKH_BEACON_TX_VSIZE,
29
+ p2wpkh: P2WPKH_BEACON_TX_VSIZE,
30
+ p2tr: P2TR_BEACON_TX_VSIZE,
31
+ };
32
+ /**
33
+ * Detect the singleton script kind of a Bitcoin address (P2PKH / P2WPKH / P2TR).
34
+ * The deterministic-DID document emits all three kinds; the broadcast path needs
35
+ * to know which is in use to construct the input and dispatch the signing primitive.
36
+ */
37
+ export function detectSingletonScriptKind(bitcoinAddress, network) {
38
+ const decoded = Address(network).decode(bitcoinAddress);
39
+ if (decoded.type === 'pkh')
40
+ return 'p2pkh';
41
+ if (decoded.type === 'wpkh')
42
+ return 'p2wpkh';
43
+ if (decoded.type === 'tr')
44
+ return 'p2tr';
45
+ throw new BeaconError(`Unsupported singleton beacon address type "${decoded.type}". `
46
+ + 'Expected P2PKH, P2WPKH, or P2TR (taproot key-path).', 'UNSUPPORTED_BEACON_ADDRESS_TYPE', { address: bitcoinAddress, kind: decoded.type });
47
+ }
48
+ /**
49
+ * Derive the address that `pubkey` produces under the given script kind. Used to
50
+ * fail-fast when a caller wires a signer to a beacon address that the signer's
51
+ * pubkey cannot actually spend.
52
+ */
53
+ export function deriveSingletonAddress(kind, pubkey, network) {
54
+ if (kind === 'p2pkh')
55
+ return p2pkh(pubkey, network).address;
56
+ if (kind === 'p2wpkh')
57
+ return p2wpkh(pubkey, network).address;
58
+ // P2TR key-path: x-only internal key (drop the SEC prefix byte).
59
+ return p2tr(pubkey.slice(1, 33), undefined, network).address;
60
+ }
15
61
  /**
16
62
  * Build an OP_RETURN script carrying a 32-byte beacon signal.
17
63
  * Exported as a utility so callers building txs outside Beacon (e.g., the aggregation
18
64
  * `onProvideTxData` callback) can produce identical output.
65
+ *
66
+ * Uses the opcode *string* `'RETURN'` rather than the numeric `OP.RETURN`
67
+ * constant because scure's `Script.encode` interprets a number as a byte to
68
+ * push, not as the opcode. The string form emits the bare opcode (0x6a)
69
+ * followed by an `OP_PUSHBYTES_32` push, producing the standard NULL_DATA
70
+ * shape Bitcoin Core's `IsStandard` accepts. The numeric form silently
71
+ * produces `OP_PUSHBYTES_1 0x6a OP_PUSHBYTES_32 <32 bytes>`, which is
72
+ * non-standard and rejected at broadcast with `RPC error -26: scriptpubkey`.
19
73
  */
20
74
  export function opReturnScript(signalBytes) {
21
- return Script.encode([OP.RETURN, signalBytes]);
75
+ return Script.encode(['RETURN', signalBytes]);
22
76
  }
23
77
  /**
24
78
  * Fetch the most recent confirmed UTXO at `bitcoinAddress` + the raw bytes of its
@@ -27,11 +81,11 @@ export function opReturnScript(signalBytes) {
27
81
  async function fetchSpendableUtxo(bitcoinAddress, bitcoin) {
28
82
  const utxos = await bitcoin.rest.address.getUtxos(bitcoinAddress);
29
83
  if (!utxos.length) {
30
- throw new BeaconError('No UTXOs found, please fund address!', 'UNFUNDED_BEACON_ADDRESS', { bitcoinAddress });
84
+ throw new BeaconError('No UTXOs found, please fund address!', 'UNFUNDED_BEACON_ADDRESS', { address: bitcoinAddress });
31
85
  }
32
86
  const utxo = utxos.sort((a, b) => b.status.block_height - a.status.block_height).shift();
33
87
  if (!utxo) {
34
- throw new BeaconError('Beacon bitcoin address unfunded or utxos unconfirmed.', 'UNFUNDED_BEACON_ADDRESS', { bitcoinAddress });
88
+ throw new BeaconError('Beacon bitcoin address unfunded or utxos unconfirmed.', 'UNFUNDED_BEACON_ADDRESS', { address: bitcoinAddress });
35
89
  }
36
90
  const prevTxHex = await bitcoin.rest.transaction.getHex(utxo.txid);
37
91
  return { utxo, prevTxBytes: hexToBytes(prevTxHex) };
@@ -56,9 +110,12 @@ export async function buildAggregationBeaconTx(opts) {
56
110
  // Fee cannot be probe-measured (no secret key for MuSig2 round). Use fixed P2TR vsize.
57
111
  const feeSats = await feeEstimator.estimateFee(P2TR_BEACON_TX_VSIZE);
58
112
  if (BigInt(utxo.value) <= feeSats) {
59
- throw new BeaconError(`UTXO value (${utxo.value}) insufficient to cover fee (${feeSats}).`, 'INSUFFICIENT_FUNDS', { bitcoinAddress: opts.beaconAddress, utxoValue: utxo.value, fee: feeSats.toString() });
113
+ throw new BeaconError(`UTXO value (${utxo.value}) insufficient to cover fee (${feeSats}).`, 'INSUFFICIENT_FUNDS', { address: opts.beaconAddress, valueSats: utxo.value, feeSats });
60
114
  }
61
- const tx = new Transaction();
115
+ // allowUnknownOutputs: scure does not classify OP_RETURN as a "known" output
116
+ // type because it is unspendable by design. The opt-in flag tells scure we
117
+ // know the output is intentional (the beacon signal embedded in OP_RETURN).
118
+ const tx = new Transaction({ allowUnknownOutputs: true });
62
119
  tx.addInput({
63
120
  txid: utxo.txid,
64
121
  index: utxo.vout,
@@ -75,8 +132,72 @@ export async function buildAggregationBeaconTx(opts) {
75
132
  beaconAddress: opts.beaconAddress,
76
133
  utxo,
77
134
  feeSats,
135
+ scriptKind: 'p2tr',
78
136
  };
79
137
  }
138
+ /**
139
+ * Sign the single input of a singleton beacon transaction. Dispatches to the
140
+ * correct sighash + signature-application path based on `kind`, finalizes the
141
+ * tx, and returns the signed raw hex.
142
+ *
143
+ * - **P2PKH**: legacy ECDSA sighash; scure assembles the scriptSig from `partialSig`.
144
+ * - **P2WPKH**: BIP-143 segwit-v0 sighash (P2PKH-shaped scriptCode); scure assembles
145
+ * the witness from `partialSig`.
146
+ * - **P2TR**: BIP-341 taproot key-path sighash (SIGHASH_DEFAULT); 64-byte BIP-340
147
+ * Schnorr signature applied via `tapKeySig`.
148
+ */
149
+ async function signSingletonInput(tx, inputIdx, kind, signer, prevOutScript, amount) {
150
+ const pubkey = signer.publicKey;
151
+ if (kind === 'p2pkh') {
152
+ // Legacy sighash: scriptCode is the prev-output P2PKH script itself.
153
+ // scure-btc-signer marks `preimageLegacy` as TypeScript-private but does not
154
+ // expose a public alternative; its own `signIdx` consumes the secret key
155
+ // directly. We need only the sighash bytes so an external Signer can produce
156
+ // the signature, so we reach through the type system here. If scure ever
157
+ // renames this method, the P2PKH path tests fail loudly.
158
+ // TODO: track https://github.com/paulmillr/scure-btc-signer/issues/142 —
159
+ // drop the cast once a public preimage (e.g. `preimageP2PKH`) lands upstream.
160
+ const sighashType = SigHash.ALL;
161
+ const sighash = tx.preimageLegacy(inputIdx, prevOutScript, sighashType);
162
+ const sig = signer.sign(sighash, 'ecdsa');
163
+ const sigWithType = concatBytes(sig, new Uint8Array([sighashType]));
164
+ tx.updateInput(inputIdx, { partialSig: [[pubkey, sigWithType]] }, true);
165
+ tx.finalize();
166
+ return tx.hex;
167
+ }
168
+ if (kind === 'p2wpkh') {
169
+ // BIP-143: scriptCode for a P2WPKH input is the equivalent legacy P2PKH script
170
+ // (`OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG`). The P2PKH-shaped
171
+ // script appearing here in P2WPKH signing is intentional, not a bug.
172
+ //
173
+ // Derive the hash from `prevOutScript` (the bytes actually committed on-chain),
174
+ // not by re-hashing `signer.publicKey`. BIP-143 commits to the prev output, so
175
+ // the sighash must follow those bytes exactly. Rebuilding from the signer's
176
+ // pubkey assumes (rather than verifies) the two are in sync.
177
+ const decoded = OutScript.decode(prevOutScript);
178
+ if (decoded.type !== 'wpkh') {
179
+ throw new BeaconError(`Expected P2WPKH prev-output script, got "${decoded.type}".`, 'PREVOUT_SCRIPT_MISMATCH', { kind, observedScriptType: decoded.type });
180
+ }
181
+ const sighashScript = OutScript.encode({ type: 'pkh', hash: decoded.hash });
182
+ const sighashType = SigHash.ALL;
183
+ const sighash = tx.preimageWitnessV0(inputIdx, sighashScript, sighashType, amount);
184
+ const sig = signer.sign(sighash, 'ecdsa');
185
+ const sigWithType = concatBytes(sig, new Uint8Array([sighashType]));
186
+ tx.updateInput(inputIdx, { partialSig: [[pubkey, sigWithType]] }, true);
187
+ tx.finalize();
188
+ return tx.hex;
189
+ }
190
+ // P2TR key-path. BIP-341 requires signing with the taproot-tweaked secret
191
+ // `d' = taprootTweakPrivKey(d, merkleRoot)`; the verifier checks against the
192
+ // tweaked output internal key `Q = P + tG`. The tweak lives inside the Signer
193
+ // (it needs the secret key), so we use scheme 'bip341' rather than the raw
194
+ // 'bip340' scheme. No script tree on singleton beacons → no merkleRoot.
195
+ const sighash = tx.preimageWitnessV1(inputIdx, [prevOutScript], SigHash.DEFAULT, [amount]);
196
+ const sig = signer.sign(sighash, 'bip341');
197
+ tx.updateInput(inputIdx, { tapKeySig: sig });
198
+ tx.finalize();
199
+ return tx.hex;
200
+ }
80
201
  /**
81
202
  * Abstract base class for all BTCR2 Beacon types.
82
203
  * A Beacon is a service listed in a BTCR2 DID document that informs resolvers
@@ -101,7 +222,9 @@ export class Beacon {
101
222
  this.service = service;
102
223
  }
103
224
  /**
104
- * Build + sign + broadcast a single-party beacon signal transaction (P2WPKH spend).
225
+ * Build + sign + broadcast a singleton beacon signal transaction. The beacon
226
+ * address's script kind (P2PKH / P2WPKH / P2TR) is detected automatically
227
+ * and the input is constructed and signed accordingly.
105
228
  *
106
229
  * Composed from the three extracted phases ({@link buildSinglePartyTx},
107
230
  * {@link signSinglePartyTx}, {@link broadcastRawTx}) so each piece can be exercised
@@ -110,72 +233,99 @@ export class Beacon {
110
233
  * plumbing (UTXO fetch + OP_RETURN output + change output) is shared.
111
234
  *
112
235
  * @param signalBytes 32-byte payload to embed in OP_RETURN.
113
- * @param secretKey Secret key used to sign the spending input.
236
+ * @param signer Signer used to sign the spending input.
114
237
  * @param bitcoin Bitcoin network connection.
115
238
  * @param options Broadcast options (fee estimator, etc.).
116
239
  * @returns The txid of the broadcast transaction.
117
240
  * @throws {BeaconError} if the address is unfunded, no UTXO is available, or fee exceeds value.
118
241
  */
119
- async buildSignAndBroadcast(signalBytes, secretKey, bitcoin, options) {
242
+ async buildSignAndBroadcast(signalBytes, signer, bitcoin, options) {
120
243
  const feeEstimator = options?.feeEstimator ?? DEFAULT_FEE_ESTIMATOR;
121
244
  const beaconAddress = this.service.serviceEndpoint.replace('bitcoin:', '');
122
245
  const { utxo, prevTxBytes } = await fetchSpendableUtxo(beaconAddress, bitcoin);
123
246
  const plan = await this.buildSinglePartyTx({
124
- signalBytes, beaconAddress, utxo, prevTxBytes, secretKey, bitcoin, feeEstimator,
247
+ signalBytes, beaconAddress, utxo, prevTxBytes, signer, bitcoin, feeEstimator,
125
248
  });
126
- const signedHex = this.signSinglePartyTx(plan.tx, secretKey);
249
+ const signedHex = await this.signSinglePartyTx(plan, signer);
127
250
  return this.broadcastRawTx(bitcoin, signedHex);
128
251
  }
129
252
  /**
130
- * Build an unsigned P2WPKH single-party beacon tx + probe-sign to determine vsize,
131
- * then rebuild with the real fee. Returns the tx and prev-output metadata.
253
+ * Build an unsigned singleton beacon tx ready for {@link signSinglePartyTx}.
132
254
  *
133
- * The secret key is required here (not just in `signSinglePartyTx`) because the
134
- * two-pass fee estimation requires an actual signature to measure vsize accurately.
255
+ * Detects the beacon address script kind (P2PKH / P2WPKH / P2TR) and configures
256
+ * the input accordingly. Validates that the signer's pubkey produces the beacon
257
+ * address under that script kind — without this check, a misconfigured caller
258
+ * would burn a real UTXO on a tx that fails at broadcast. Fees are computed from
259
+ * the per-kind {@link SINGLETON_BEACON_TX_VSIZE} constant, avoiding any probe-sign
260
+ * round-trip.
135
261
  */
136
262
  async buildSinglePartyTx(opts) {
137
- const pubkey = this.#derivePubkey(opts.secretKey);
138
- const witnessOut = p2wpkh(pubkey, opts.bitcoin.data);
139
- const witnessScript = witnessOut.script;
140
- const build = (feeSats) => {
141
- const tx = new Transaction();
263
+ const network = opts.bitcoin.data;
264
+ const pubkey = opts.signer.publicKey;
265
+ const kind = detectSingletonScriptKind(opts.beaconAddress, network);
266
+ const derivedAddress = deriveSingletonAddress(kind, pubkey, network);
267
+ if (derivedAddress !== opts.beaconAddress) {
268
+ throw new BeaconError(`Signer pubkey produces ${kind.toUpperCase()} address "${derivedAddress}", but beacon address is "${opts.beaconAddress}".`, 'SIGNER_KEY_MISMATCH', { kind, address: opts.beaconAddress, derivedAddress });
269
+ }
270
+ const feeSats = await opts.feeEstimator.estimateFee(SINGLETON_BEACON_TX_VSIZE[kind]);
271
+ const amount = BigInt(opts.utxo.value);
272
+ if (amount <= feeSats) {
273
+ throw new BeaconError(`UTXO value (${opts.utxo.value}) insufficient to cover fee (${feeSats}).`, 'INSUFFICIENT_FUNDS', { address: opts.beaconAddress, valueSats: opts.utxo.value, feeSats });
274
+ }
275
+ // allowUnknownOutputs: scure does not classify OP_RETURN as a "known" output
276
+ // type because it is unspendable by design. The opt-in flag tells scure we
277
+ // know the output is intentional (the beacon signal embedded in OP_RETURN).
278
+ const tx = new Transaction({ allowUnknownOutputs: true });
279
+ // Per-kind input setup: P2PKH consumes via nonWitnessUtxo only (legacy);
280
+ // P2WPKH and P2TR also carry a witnessUtxo (and P2TR carries tapInternalKey).
281
+ let prevOutScript;
282
+ if (kind === 'p2pkh') {
283
+ prevOutScript = p2pkh(pubkey, network).script;
142
284
  tx.addInput({
143
285
  txid: opts.utxo.txid,
144
286
  index: opts.utxo.vout,
145
287
  nonWitnessUtxo: opts.prevTxBytes,
146
- witnessUtxo: { amount: BigInt(opts.utxo.value), script: witnessScript },
147
288
  });
148
- tx.addOutputAddress(opts.beaconAddress, BigInt(opts.utxo.value) - feeSats, opts.bitcoin.data);
149
- tx.addOutput({ script: opReturnScript(opts.signalBytes), amount: 0n });
150
- return tx;
151
- };
152
- // First pass: sign with zero fee to measure vsize.
153
- const probe = build(0n);
154
- probe.signIdx(opts.secretKey, 0);
155
- probe.finalize();
156
- const vsize = probe.vsize;
157
- const feeSats = await opts.feeEstimator.estimateFee(vsize);
158
- if (BigInt(opts.utxo.value) <= feeSats) {
159
- throw new BeaconError(`UTXO value (${opts.utxo.value}) insufficient to cover fee (${feeSats}).`, 'INSUFFICIENT_FUNDS', { bitcoinAddress: opts.beaconAddress, utxoValue: opts.utxo.value, fee: feeSats.toString() });
160
289
  }
161
- // Second pass: real fee.
162
- const tx = build(feeSats);
290
+ else if (kind === 'p2wpkh') {
291
+ prevOutScript = p2wpkh(pubkey, network).script;
292
+ tx.addInput({
293
+ txid: opts.utxo.txid,
294
+ index: opts.utxo.vout,
295
+ nonWitnessUtxo: opts.prevTxBytes,
296
+ witnessUtxo: { amount, script: prevOutScript },
297
+ });
298
+ }
299
+ else {
300
+ // p2tr key-path
301
+ const internalKey = pubkey.slice(1, 33);
302
+ prevOutScript = p2tr(internalKey, undefined, network).script;
303
+ tx.addInput({
304
+ txid: opts.utxo.txid,
305
+ index: opts.utxo.vout,
306
+ nonWitnessUtxo: opts.prevTxBytes,
307
+ witnessUtxo: { amount, script: prevOutScript },
308
+ tapInternalKey: internalKey,
309
+ });
310
+ }
311
+ tx.addOutputAddress(opts.beaconAddress, amount - feeSats, network);
312
+ tx.addOutput({ script: opReturnScript(opts.signalBytes), amount: 0n });
163
313
  return {
164
314
  tx,
165
- prevOutScripts: [witnessScript],
166
- prevOutValues: [BigInt(opts.utxo.value)],
315
+ prevOutScripts: [prevOutScript],
316
+ prevOutValues: [amount],
167
317
  beaconAddress: opts.beaconAddress,
168
318
  utxo: opts.utxo,
169
319
  feeSats,
320
+ scriptKind: kind,
170
321
  };
171
322
  }
172
323
  /**
173
324
  * Sign + finalize the unsigned single-party tx and return its raw hex.
325
+ * Dispatches to the correct signing primitive based on `plan.scriptKind`.
174
326
  */
175
- signSinglePartyTx(tx, secretKey) {
176
- tx.signIdx(secretKey, 0);
177
- tx.finalize();
178
- return tx.hex;
327
+ async signSinglePartyTx(plan, signer) {
328
+ return signSingletonInput(plan.tx, 0, plan.scriptKind, signer, plan.prevOutScripts[0], plan.prevOutValues[0]);
179
329
  }
180
330
  /**
181
331
  * Broadcast raw transaction hex via the Bitcoin REST endpoint. Returns the txid.
@@ -183,9 +333,5 @@ export class Beacon {
183
333
  async broadcastRawTx(bitcoin, rawHex) {
184
334
  return bitcoin.rest.transaction.send(rawHex);
185
335
  }
186
- /** Derive the compressed secp256k1 public key from a raw secret key. */
187
- #derivePubkey(secretKey) {
188
- return getPublicKey(secretKey, true);
189
- }
190
336
  }
191
337
  //# sourceMappingURL=beacon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"beacon.js","sourceRoot":"","sources":["../../../../src/core/beacon/beacon.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD,+EAA+E;AAC/E,MAAM,qBAAqB,GAAiB,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,GAAG,CAAC;AA6BjC;;;;GAIG;AACH,MAAM,UAAU,cAA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AAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE;gBAClD,cAAc,EAAG,WAAW;aAC7B,CAAC,CAAC;QACL,CAAC;QAED,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QAEvE,OAAO;YACL,EAAE;YACF,cAAc,EAAG,CAAC,aAAa,CAAC;YAChC,aAAa,EAAI,CAAC,MAAM,CAAC;YACzB,aAAa,EAAI,IAAI,CAAC,aAAa;YACnC,IAAI,EAAa,IAAI,CAAC,IAAI;YAC1B,OAAO;YACP,UAAU,EAAO,IAAI;SACtB,CAAC;IACJ,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,iBAAiB,CAAC,IAAkB,EAAE,MAAc;QAClE,OAAO,kBAAkB,CACvB,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EACnC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAE,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAE,CAChD,CAAC;IACJ,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,cAAc,CAAC,OAA0B,EAAE,MAAc;QACvE,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -85,14 +85,14 @@ export class CASBeacon extends Beacon {
85
85
  * and broadcast are delegated to {@link Beacon.buildSignAndBroadcast}.
86
86
  *
87
87
  * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
88
- * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
88
+ * @param {Signer} signer Signer that produces the ECDSA signature for the Bitcoin transaction.
89
89
  * @param {BitcoinConnection} bitcoin The Bitcoin network connection.
90
90
  * @param {CASBroadcastOptions} [options] Optional broadcast configuration, including a
91
91
  * `casPublish` callback to publish the announcement off-chain and a `feeEstimator`.
92
92
  * @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
93
93
  * @throws {BeaconError} if the bitcoin address is invalid, unfunded, or UTXO cannot cover the fee.
94
94
  */
95
- async broadcastSignal(signedUpdate, secretKey, bitcoin, options) {
95
+ async broadcastSignal(signedUpdate, signer, bitcoin, options) {
96
96
  // Extract the DID from the beacon service id (strip the #fragment)
97
97
  const did = this.service.id.split('#')[0];
98
98
  // Hash the signed update (base64urlnopad for the CAS Announcement entry per spec)
@@ -102,7 +102,7 @@ export class CASBeacon extends Beacon {
102
102
  // Canonicalize and hash the CAS Announcement for the OP_RETURN output
103
103
  const announcementHash = hash(canonicalize(casAnnouncement));
104
104
  // Delegate UTXO selection, PSBT construction, fee estimation, signing, and broadcast
105
- await this.buildSignAndBroadcast(announcementHash, secretKey, bitcoin, options);
105
+ await this.buildSignAndBroadcast(announcementHash, signer, bitcoin, options);
106
106
  // Publish CAS Announcement to content-addressed store if callback provided
107
107
  if (options?.casPublish) {
108
108
  await options.casPublish(casAnnouncement);
@@ -1 +1 @@
1
- {"version":3,"file":"cas-beacon.js","sourceRoot":"","sources":["../../../../src/core/beacon/cas-beacon.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAKtF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAYrC;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,SAAU,SAAQ,MAAM;IACnC;;;OAGG;IACH,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAA4B,EAC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C5C,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAe,kBAAkB;oBACrC,UAAU;oBACV,eAAe,EAAI,IAAI,CAAC,OAAO,CAAC,EAAE;iBACnC,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,eAAe,CACnB,YAA+B,EAC/B,MAAc,EACd,OAA0B,EAC1B,OAA6B;QAE7B,mEAAmE;QACnE,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1C,kFAAkF;QAClF,MAAM,UAAU,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;QAE/C,kEAAkE;QAClE,MAAM,eAAe,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC;QAE9C,sEAAsE;QACtE,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC;QAE7D,qFAAqF;QACrF,MAAM,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAE7E,2EAA2E;QAC3E,IAAG,OAAO,EAAE,UAAU,EAAE,CAAC;YACvB,MAAM,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;CACF"}
@@ -49,15 +49,15 @@ export class SingletonBeacon extends Beacon {
49
49
  * {@link Beacon.buildSignAndBroadcast}.
50
50
  *
51
51
  * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
52
- * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
52
+ * @param {Signer} signer Signer that produces the ECDSA signature for the Bitcoin transaction.
53
53
  * @param {BitcoinConnection} bitcoin The Bitcoin network connection.
54
54
  * @param {BroadcastOptions} [options] Optional broadcast configuration (e.g. fee estimator).
55
55
  * @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
56
56
  * @throws {BeaconError} if the bitcoin address is invalid, unfunded, or UTXO cannot cover the fee.
57
57
  */
58
- async broadcastSignal(signedUpdate, secretKey, bitcoin, options) {
58
+ async broadcastSignal(signedUpdate, signer, bitcoin, options) {
59
59
  const signalBytes = hash(canonicalize(signedUpdate));
60
- await this.buildSignAndBroadcast(signalBytes, secretKey, bitcoin, options);
60
+ await this.buildSignAndBroadcast(signalBytes, signer, bitcoin, options);
61
61
  return signedUpdate;
62
62
  }
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"singleton-beacon.js","sourceRoot":"","sources":["../../../../src/core/beacon/singleton-beacon.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAKvD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,MAAM;IAEzC;;;OAGG;IACH,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACH,cAAc,CACZ,OAA4B,EAC5B,OAAoB;QAEpB,MAAM,OAAO,GAAG,IAAI,KAAK,EAAsC,CAAC;QAChE,MAAM,KAAK,GAAG,IAAI,KAAK,EAAY,CAAC;QAEpC,KAAI,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC5B,iEAAiE;YACjE,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;YAEtC,iDAAiD;YACjD,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAA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AK,EAAY,CAAC;QAEpC,KAAI,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC5B,iEAAiE;YACjE,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;YAEtC,iDAAiD;YACjD,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAEvD,IAAG,CAAC,YAAY,EAAE,CAAC;gBACjB,uDAAuD;gBACvD,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAe,kBAAkB;oBACrC,UAAU;oBACV,eAAe,EAAI,IAAI,CAAC,OAAO,CAAC,EAAE;iBACnC,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IACD;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,eAAe,CACnB,YAA+B,EAC/B,MAAc,EACd,OAA0B,EAC1B,OAA0B;QAE1B,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;QACrD,MAAM,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACxE,OAAO,YAAY,CAAC;IACtB,CAAC;CACF"}
@@ -92,13 +92,13 @@ export class SMTBeacon extends Beacon {
92
92
  * signing, and broadcast are delegated to {@link Beacon.buildSignAndBroadcast}.
93
93
  *
94
94
  * @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
95
- * @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
95
+ * @param {Signer} signer Signer that produces the ECDSA signature for the Bitcoin transaction.
96
96
  * @param {BitcoinConnection} bitcoin The Bitcoin network connection.
97
97
  * @param {BroadcastOptions} [options] Optional broadcast configuration (e.g. fee estimator).
98
98
  * @return {Promise<SignedBTCR2Update>} The signed update that was broadcast.
99
99
  * @throws {BeaconError} if the bitcoin address is invalid, unfunded, or UTXO cannot cover the fee.
100
100
  */
101
- async broadcastSignal(signedUpdate, secretKey, bitcoin, options) {
101
+ async broadcastSignal(signedUpdate, signer, bitcoin, options) {
102
102
  // Extract the DID from the beacon service id (strip the #fragment)
103
103
  const did = this.service.id.split('#')[0];
104
104
  // Build a single-entry SMT from the signed update
@@ -108,7 +108,7 @@ export class SMTBeacon extends Beacon {
108
108
  tree.addEntries([{ did, nonce, signedUpdate: canonicalBytes }]);
109
109
  tree.finalize();
110
110
  // Root hash is the signal bytes for the OP_RETURN output
111
- await this.buildSignAndBroadcast(tree.rootHash, secretKey, bitcoin, options);
111
+ await this.buildSignAndBroadcast(tree.rootHash, signer, bitcoin, options);
112
112
  return signedUpdate;
113
113
  }
114
114
  }
@@ -1 +1 @@
1
- {"version":3,"file":"smt-beacon.js","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,SAAU,SAAQ,MAAM;IACnC;;;OAGG;IACH,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAA4B,EAC5B,OAAoB;QAEpB,MAAM,OAAO,GAAG,IAAI,KA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