@smartledger/bsv 9.12.0 → 9.14.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/bsv.d.ts CHANGED
@@ -987,6 +987,10 @@ declare module '@smartledger/bsv' {
987
987
  * The easiest target a header may declare and still be believed: difficulty 1,
988
988
  * 0x1d00ffff, the proof-of-work limit of mainnet and testnet. Regtest declares
989
989
  * 0x207fffff, so regtest headers need `powLimit` set explicitly.
990
+ *
991
+ * This rules out a FREE forgery, not a cheap one: a header at difficulty 1 costs
992
+ * about 4.3e9 double-SHA256 attempts, against about 1e20 for a real mainnet header.
993
+ * Use `minWork`, or check the header against your own chain source.
990
994
  */
991
995
  const POW_LIMIT_BITS: number;
992
996
  /** A Merkle branch proof. All hashes are DISPLAY-order hex; a node of '*' means "duplicate the working hash". */
@@ -1005,8 +1009,18 @@ declare module '@smartledger/bsv' {
1005
1009
  * declares its own target, so without this a forged header costs nothing to make.
1006
1010
  */
1007
1011
  powLimit?: number | string | object;
1008
- /** Minimum work the header must represent: 2^256 / (target + 1). Difficulty 1 is about 4.295e9. */
1012
+ /**
1013
+ * Minimum work the header must represent, in HASHES: 2^256 / (target + 1).
1014
+ * Difficulty 1 is about 4.295e9. Use `minDifficulty` to say it in difficulty.
1015
+ */
1009
1016
  minWork?: number | string | object;
1017
+ /**
1018
+ * The same floor in DIFFICULTY, which is the unit difficulty is quoted in: a real
1019
+ * BSV header is about 2.6e10, i.e. about 1.1e20 hashes. Exactly one of the two —
1020
+ * passing both throws, because they are 4.3e9 apart and silence would hide which
1021
+ * one applied.
1022
+ */
1023
+ minDifficulty?: number | string;
1010
1024
  }
1011
1025
  interface InclusionResult {
1012
1026
  valid: boolean;
@@ -1723,6 +1737,11 @@ declare module '@smartledger/bsv' {
1723
1737
  /**
1724
1738
  * The block hash the caller's own chain source has at that height. No amount of
1725
1739
  * proof of work detects an orphan: a block that lost a race carries real work.
1740
+ *
1741
+ * Supplying this or `minWork` will be REQUIRED in 10.0.0: the proof-of-work limit
1742
+ * rules out a free forgery, not a cheap one — a header at difficulty 1 costs about
1743
+ * 4.3e9 hashes, while a real mainnet header carries about 1e20. Verifying with a
1744
+ * header alone warns since 9.13.0.
1726
1745
  */
1727
1746
  blockHashAtHeight?: string;
1728
1747
  /**
@@ -1730,8 +1749,17 @@ declare module '@smartledger/bsv' {
1730
1749
  * SPV.POW_LIMIT_BITS (difficulty 1); regtest headers need 0x207fffff.
1731
1750
  */
1732
1751
  powLimit?: number | string;
1733
- /** Minimum work the header must represent. Difficulty 1 is about 4.295e9. */
1752
+ /**
1753
+ * Minimum work the header must represent, in HASHES. Difficulty 1 is about
1754
+ * 4.295e9, and a real mainnet header carries about 1e20. Either this,
1755
+ * `minDifficulty` or `blockHashAtHeight` will be required in 10.0.0.
1756
+ */
1734
1757
  minWork?: number | string;
1758
+ /**
1759
+ * The same floor in DIFFICULTY (a real BSV header is about 2.6e10). Exactly one
1760
+ * of this and `minWork`; passing both throws.
1761
+ */
1762
+ minDifficulty?: number | string;
1735
1763
  /** Pass false only for test fixtures. Defaults to true. */
1736
1764
  requirePow?: boolean;
1737
1765
  }