@ledgerhq/zcash-utils 2.5.0 → 2.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ledgerhq/zcash-utils
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 841b576: Transactions now target the next block (tip + 1) instead of anchor + 40, keep the builder's expiry, and cap it below the next network upgrade known to the bundled consensus parameters (none is pending on mainnet or testnet with this release; NU7 is covered once its heights ship). A craft whose capped expiry would leave fewer than 8 blocks (zcashd's 3-block expiring-soon rule plus 5 blocks for signing on the device) is refused with an error containing `expiry too close to activation`. An explicit `anchorHeight` above the chain tip is rejected, and the chain tip is now queried even when `anchorHeight` is given.
8
+
9
+ ### Patch Changes
10
+
11
+ - 378e859: Widen the shard-0 scan-width safety limit so that two years of chain growth still pass at NU7's 25-second block spacing, while a scan started from genesis is still refused.
12
+
13
+ ## 2.5.1
14
+
15
+ ### Patch Changes
16
+
17
+ - c963227: The Node addon now creates Orchard and Ironwood proofs on every core, about five times faster on an Apple M1 Max; the proof itself is unchanged.
18
+
3
19
  ## 2.5.0
4
20
 
5
21
  ### Minor Changes
package/README.md CHANGED
@@ -16,7 +16,7 @@ Published on the public npm registry under the `@ledgerhq` scope; no registry co
16
16
 
17
17
  Prebuilt `.node` binaries are bundled for six targets — `darwin-arm64`, `darwin-x64`, `linux-x64-gnu`, `linux-arm64-gnu`, `win32-x64-msvc`, `win32-arm64-msvc` — so there is no compilation step and no Rust toolchain to install. On any other platform, build from source: see [`CONTRIBUTING.md`](CONTRIBUTING.md).
18
18
 
19
- Node.js 20 or later. The addon is a native module, so it runs in Node and in the Electron main process, not in a browser or a renderer without `nodeIntegration`.
19
+ Node.js 24 or later. The addon is a native module, so it runs in Node and in the Electron main process, not in a browser or a renderer without `nodeIntegration`.
20
20
 
21
21
  ## Quick start — scanning
22
22
 
@@ -155,7 +155,7 @@ Full signatures, every field, and its constraints are in [`index.d.ts`](index.d.
155
155
 
156
156
  | Export | Purpose |
157
157
  | --- | --- |
158
- | `buildTransaction(params)` | Builds, proves, and serializes a V5 PCZT from Orchard notes, transparent UTXOs, or both. Bears the Halo 2 proving cost inline (~2–5 s cold, ~hundreds of ms after, via a process-global proving-key cache). |
158
+ | `buildTransaction(params)` | Builds, proves, and serializes a V5 PCZT from Orchard notes, transparent UTXOs, or both. Halo 2 proving runs on every core, off the JavaScript thread: about five times faster than on a single core (roughly 0.35–0.4 s per action on an Apple M1 Max), plus a one-time proving-key build per circuit (cached process-wide). The Node addon enables this. A consumer of the `zcash-crypto` Rust crate proves on a single core unless it enables the crate's `multicore` feature; inside this workspace, feature unification turns it on for every build and test. |
159
159
  | `buildIronwoodTransaction(params)` | Same, for an Ironwood (NU6.3) source — a redacted V6 PCZT. See [Ironwood (NU6.3)](#ironwood-nu63) below. |
160
160
  | `parsePczt(pcztHex)` | Decodes canonical PCZT bytes into the `PcztTransaction` the device signer consumes. Fails if a field the device needs to sign is missing. |
161
161
  | `finalizeTransaction(params)` | Injects device signatures, computes the binding signature, extracts the signed transaction and its txid. CPU-bound (proof verification), dispatched to a blocking thread. |
package/index.d.ts CHANGED
@@ -261,6 +261,11 @@ export interface BuildTransactionParams {
261
261
  /** Transparent (P2PKH) UTXOs to spend. Empty for Private→* flows. */
262
262
  transparentInputs: Array<TransparentInputJs>
263
263
  outputs: Array<OutputRequestJs>
264
+ /**
265
+ * Explicit anchor height; omitted → `tip − 10`. An explicit height above the
266
+ * tip is rejected. The transaction always targets the next block, `tip + 1`,
267
+ * so the chain tip is queried in either case.
268
+ */
264
269
  anchorHeight?: number
265
270
  }
266
271
  export interface BuildTransactionResult {
@@ -272,7 +277,7 @@ export interface BuildTransactionResult {
272
277
  pcztHex: string
273
278
  /** Decimal fee in zatoshis. */
274
279
  feeZat: string
275
- /** Block height the Merkle paths were computed against. */
280
+ /** Block height the Merkle paths were computed against (the resolved anchor). */
276
281
  anchorHeight: number
277
282
  /** Orchard action count after dummy padding. */
278
283
  nActionsOrchard: number
@@ -285,10 +290,12 @@ export interface BuildTransactionResult {
285
290
  * Build, prove, and serialize a PCZT for a send transaction.
286
291
  *
287
292
  * Supports Orchard-source (Private→*) and transparent-source (Public→*)
288
- * flows. Halo 2 proof generation happens here for Orchard-bundle transactions
289
- * (~2-5 s first call, ~hundreds of ms thereafter thanks to the process-global
290
- * ProvingKey cache). Transparent-only transactions skip the Orchard prover, and
291
- * need no UFVK — see `ufvk` / `transparentAccountPubkey` on the params.
293
+ * flows. Halo 2 proof generation happens here for Orchard-bundle transactions.
294
+ * It runs on every core, off the JavaScript thread: about five times faster
295
+ * than on a single core (roughly 0.35–0.4 s per action on an Apple M1 Max),
296
+ * plus a one-time proving-key build per circuit that the
297
+ * process-global ProvingKey cache then amortizes. Transparent-only transactions
298
+ * skip the Orchard prover, and need no UFVK — see `ufvk` / `transparentAccountPubkey` on the params.
292
299
  *
293
300
  * Note: unlike `finalize_transaction` (purely CPU-bound, offloaded via
294
301
  * `spawn_blocking`), this is an async orchestrator that interleaves gRPC
@@ -347,6 +354,11 @@ export interface BuildIronwoodTransactionParams {
347
354
  /** Transparent (P2PKH) UTXOs to spend. Empty for Ironwood→* flows. */
348
355
  transparentInputs: Array<TransparentInputJs>
349
356
  outputs: Array<IronwoodOutputRequestJs>
357
+ /**
358
+ * Explicit anchor height; omitted → `tip − 10`. An explicit height above the
359
+ * tip is rejected. The transaction always targets the next block, `tip + 1`,
360
+ * so the chain tip is queried in either case.
361
+ */
350
362
  anchorHeight?: number
351
363
  }
352
364
  export interface BuildIronwoodTransactionResult {
@@ -359,7 +371,7 @@ export interface BuildIronwoodTransactionResult {
359
371
  pcztHex: string
360
372
  /** Decimal fee in zatoshis. */
361
373
  feeZat: string
362
- /** Block height the Merkle paths were computed against. */
374
+ /** Block height the Merkle paths were computed against (the resolved anchor). */
363
375
  anchorHeight: number
364
376
  /** Ironwood action count after dummy padding. */
365
377
  nActionsIronwood: number
@@ -375,9 +387,10 @@ export interface BuildIronwoodTransactionResult {
375
387
  * place of Orchard ones and emitting a V6 (ZIP-230) PCZT.
376
388
  *
377
389
  * Same proving-cost profile as `buildTransaction`: Halo 2 proof generation
378
- * happens here for the Ironwood bundle (~2-5 s first call against the
379
- * `PostNu6_3` circuit, ~hundreds of ms thereafter via the process-global
380
- * proving-key cache).
390
+ * happens here for the Ironwood bundle, on every core and off the JavaScript
391
+ * thread (roughly 0.35–0.4 s per action on an Apple M1 Max), plus a one-time
392
+ * proving-key build for the `PostNu6_3` circuit that the process-global
393
+ * proving-key cache then amortizes.
381
394
  */
382
395
  export declare function buildIronwoodTransaction(params: BuildIronwoodTransactionParams): Promise<BuildIronwoodTransactionResult>
383
396
  /** Parameters for finalizing a PCZT with device-provided signatures. */
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/zcash-utils",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Native Zcash key derivation and shielded sync — Node.js (NAPI)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "access": "public"
19
19
  },
20
20
  "devDependencies": {
21
- "@changesets/cli": "^2.29.8",
21
+ "@changesets/cli": "^3.0.3",
22
22
  "@napi-rs/cli": "^2.18.0",
23
23
  "@types/node": "^25.5.2",
24
24
  "prettier": "^3.9.6",