@smartledger/bsv 7.10.1 → 7.11.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.
@@ -55,19 +55,19 @@ Three advanced modules totaling **~2.7MB** of functionality:
55
55
  - **Purpose**: Threshold cryptography for secure secret distribution
56
56
  - **Use Cases**: Backup keys, multi-party security, key recovery
57
57
  - **Features**: Split secrets into N shares, require M to reconstruct
58
- - **CDN**: `unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js`
58
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.11.0/bsv-shamir.min.js`
59
59
 
60
60
  #### **🌐 Global Digital Attestation Framework - GDAF (1184KB)**
61
61
  - **Purpose**: W3C Verifiable Credentials and decentralized identity
62
62
  - **Use Cases**: Identity verification, attestations, zero-knowledge proofs
63
63
  - **Features**: DID creation, credential issuance, selective disclosure
64
- - **CDN**: `unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.11.0/bsv-gdaf.min.js`
65
65
 
66
66
  #### **⚖️ Legal Token Protocol - LTP (1184KB)**
67
67
  - **Purpose**: Legal compliance framework for tokenized assets
68
68
  - **Use Cases**: Property rights, obligations, compliant tokenization
69
69
  - **Features**: Legal primitives, compliance checking, attestation anchoring
70
- - **CDN**: `unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js`
71
71
 
72
72
  ### **2. Incorrect File Sizes in Documentation**
73
73
 
@@ -81,18 +81,18 @@ Three advanced modules totaling **~2.7MB** of functionality:
81
81
 
82
82
  | Module | Size | Use Case | CDN Link |
83
83
  |--------|------|----------|----------|
84
- | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js` |
85
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js` |
86
- | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js` |
87
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.10.1/bsv-covenant.min.js` |
88
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.10.1/bsv-script-helper.min.js` |
89
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.10.1/bsv-security.min.js` |
90
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.10.1/bsv-ecies.min.js` |
91
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.10.1/bsv-message.min.js` |
92
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.10.1/bsv-mnemonic.min.js` |
93
- | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js` |
94
- | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js` |
95
- | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js` |
84
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.11.0/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.11.0/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.11.0/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.11.0/bsv-script-helper.min.js` |
89
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.11.0/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.11.0/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.11.0/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.11.0/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js` |
96
96
 
97
97
  ## 🎯 **Updated Usage Examples**
98
98
 
@@ -100,22 +100,22 @@ Three advanced modules totaling **~2.7MB** of functionality:
100
100
 
101
101
  #### **1. Basic Development (~963KB)**
102
102
  ```html
103
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
104
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-script-helper.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-script-helper.min.js"></script>
105
105
  ```
106
106
 
107
107
  #### **2. Smart Contract Development (~2.7MB — each bundle re-embeds core BSV)**
108
108
  ```html
109
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
110
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-covenant.min.js"></script>
111
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js"></script>
109
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-smartcontract.min.js"></script>
112
112
  ```
113
113
 
114
114
  #### **3. 🆕 Legal & Compliance Development (~3.2MB — each bundle re-embeds core BSV)**
115
115
  ```html
116
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
117
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js"></script>
118
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js"></script>
116
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-gdaf.min.js"></script>
119
119
  <script>
120
120
  // Legal Token Protocol
121
121
  const legalToken = bsv.createLegalToken({
@@ -132,9 +132,9 @@ Three advanced modules totaling **~2.7MB** of functionality:
132
132
 
133
133
  #### **4. 🆕 Security & Cryptography (~1.4MB)**
134
134
  ```html
135
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
136
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-security.min.js"></script>
137
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js"></script>
135
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-shamir.min.js"></script>
138
138
  <script>
139
139
  // Shamir Secret Sharing
140
140
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -146,7 +146,7 @@ Three advanced modules totaling **~2.7MB** of functionality:
146
146
 
147
147
  #### **5. Everything Bundle (937KB)**
148
148
  ```html
149
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.bundle.js"></script>
150
150
  <script>
151
151
  // Everything available immediately
152
152
  const shares = bsv.splitSecret('secret', 5, 3);
@@ -722,7 +722,7 @@ interface UTXO {
722
722
  <html>
723
723
  <head>
724
724
  <title>UTXO Manager Demo</title>
725
- <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.10.1/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.11.0/bsv.min.js"></script>
726
726
  </head>
727
727
  <body>
728
728
  <script>
@@ -48,7 +48,7 @@ const tx: Transaction = new Transaction();
48
48
  #### **Core Library Only (937KB)**
49
49
  For basic Bitcoin SV operations:
50
50
  ```html
51
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
51
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
52
52
  <script>
53
53
  const privateKey = new bsv.PrivateKey();
54
54
  const address = privateKey.toAddress();
@@ -58,7 +58,7 @@ For basic Bitcoin SV operations:
58
58
  #### **Complete Bundle (937KB)**
59
59
  Everything in one file:
60
60
  ```html
61
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.bundle.js"></script>
62
62
  <script>
63
63
  // All features available immediately
64
64
  const shares = bsv.splitSecret('secret', 5, 3);
@@ -71,9 +71,9 @@ Everything in one file:
71
71
 
72
72
  #### **Smart Contract Development (~2.7MB total — each bundle is self-contained and re-embeds core BSV)**
73
73
  ```html
74
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
75
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-covenant.min.js"></script>
76
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js"></script>
74
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-smartcontract.min.js"></script>
77
77
  <script>
78
78
  const covenant = bsv.SmartContract.createCovenantBuilder()
79
79
  .extractField('amount').push(50000).greaterThanOrEqual().build();
@@ -82,9 +82,9 @@ Everything in one file:
82
82
 
83
83
  #### **Legal & Identity Development (~3.2MB total — each bundle is self-contained and re-embeds core BSV)**
84
84
  ```html
85
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
86
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js"></script>
87
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js"></script>
85
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-gdaf.min.js"></script>
88
88
  <script>
89
89
  // Legal Token Protocol
90
90
  const propertyToken = bsv.createPropertyToken({
@@ -98,9 +98,9 @@ Everything in one file:
98
98
 
99
99
  #### **Security & Cryptography (~1.4MB total — each bundle is self-contained and re-embeds core BSV)**
100
100
  ```html
101
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
102
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-security.min.js"></script>
103
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js"></script>
101
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-shamir.min.js"></script>
104
104
  <script>
105
105
  // Threshold Cryptography
106
106
  const shares = bsv.splitSecret('my_secret_key', 5, 3);
@@ -114,18 +114,18 @@ Everything in one file:
114
114
 
115
115
  | Module | Size | Purpose | CDN Link |
116
116
  |--------|------|---------|----------|
117
- | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js` |
118
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js` |
119
- | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js` |
120
- | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js` |
121
- | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js` |
122
- | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.10.1/bsv-shamir.min.js` |
123
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.10.1/bsv-security.min.js` |
124
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.10.1/bsv-mnemonic.min.js` |
125
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.10.1/bsv-ecies.min.js` |
126
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.10.1/bsv-covenant.min.js` |
127
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.10.1/bsv-script-helper.min.js` |
128
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.10.1/bsv-message.min.js` |
117
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.11.0/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.11.0/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.11.0/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.11.0/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.11.0/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.11.0/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.11.0/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.11.0/bsv-message.min.js` |
129
129
 
130
130
  ## ⚙️ **Development Environment Setup**
131
131
 
@@ -14,10 +14,10 @@ npm install @smartledger/bsv
14
14
  ### Browser CDN (Instant)
15
15
  ```html
16
16
  <!-- Core library (937KB) -->
17
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
17
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
18
18
 
19
19
  <!-- Everything included (937KB) -->
20
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
20
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.bundle.js"></script>
21
21
  ```
22
22
 
23
23
  ## 💰 **Your First Transaction (60 seconds)**
@@ -127,19 +127,19 @@ SmartLedger-BSV offers 12 different loading options - use only what you need:
127
127
 
128
128
  ```html
129
129
  <!-- Core BSV only (937KB) -->
130
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
130
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
131
131
 
132
132
  <!-- Smart contracts (937KB) -->
133
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js"></script>
133
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-smartcontract.min.js"></script>
134
134
 
135
135
  <!-- Legal tokens (1.16MB) -->
136
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js"></script>
137
137
 
138
138
  <!-- Digital identity (1.16MB) -->
139
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js"></script>
139
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-gdaf.min.js"></script>
140
140
 
141
141
  <!-- Everything (937KB) -->
142
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
142
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.bundle.js"></script>
143
143
  ```
144
144
 
145
145
  ## ⚡ **Key Advantages**
@@ -159,17 +159,17 @@ const recovered = bsv.reconstructSecret([shares[0], shares[2], shares[4]]);
159
159
  ### **New Modular Options**
160
160
  ```html
161
161
  <!-- Core compatibility (same size as bsv@1.5.6) -->
162
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.min.js"></script>
162
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
163
163
 
164
164
  <!-- Add smart contracts when ready -->
165
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-smartcontract.min.js"></script>
165
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-smartcontract.min.js"></script>
166
166
 
167
167
  <!-- Add advanced features as needed -->
168
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-ltp.min.js"></script>
169
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv-gdaf.min.js"></script>
168
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js"></script>
169
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-gdaf.min.js"></script>
170
170
 
171
171
  <!-- Everything in one file -->
172
- <script src="https://unpkg.com/@smartledger/bsv@7.10.1/bsv.bundle.js"></script>
172
+ <script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.bundle.js"></script>
173
173
  ```
174
174
 
175
175
  ## 🔍 **Testing Your Migration**
@@ -390,6 +390,56 @@ Interpreter.SCRIPT_ENABLE_MAGNETIC_OPCODES = (1 << 19)
390
390
  // exactly like the Monolith and Magnetic flags above.
391
391
  Interpreter.SCRIPT_ENABLE_CHRONICLE = (1 << 20)
392
392
 
393
+ /**
394
+ * Block height at which Chronicle activated on BSV mainnet (2026-04-07).
395
+ *
396
+ * Recorded because the node gates on it PER UTXO — `utxo_after_chronicle` — not
397
+ * globally. Whether Chronicle rules apply to a script depends on the output being
398
+ * spent, so this is a property of the input under validation, never a property of
399
+ * the library.
400
+ */
401
+ Interpreter.CHRONICLE_ACTIVATION_HEIGHT = 943816
402
+
403
+ /**
404
+ * The script-verification flags matching BSV mainnet consensus.
405
+ *
406
+ * This library has no default flag set — `verify()` falls back to `0`, meaning no
407
+ * optional feature is enabled. That is deliberate and stays: a validator should state
408
+ * the consensus context it is validating against rather than inherit one. But leaving
409
+ * callers to assemble the set by hand invites getting it wrong, and "wrong" here means
410
+ * a verdict that disagrees with the network.
411
+ *
412
+ * `afterChronicle` defaults to TRUE because Chronicle activated at block 943,816 and
413
+ * every output created since is subject to it. Pass `false` to validate the spend of a
414
+ * pre-activation UTXO, which is exactly the distinction the node makes.
415
+ *
416
+ * NOTE: script-number and element-size limits are NOT flags — they are process-wide
417
+ * statics raised by `useGenesisLimits()`. A post-Genesis validator needs both this flag
418
+ * set and that call.
419
+ *
420
+ * @param {object} [opts]
421
+ * @param {boolean} [opts.afterChronicle=true] is the UTXO being spent post-activation
422
+ * @returns {number} the combined flags
423
+ */
424
+ Interpreter.mainnetFlags = function (opts) {
425
+ opts = opts || {}
426
+ var flags = Interpreter.SCRIPT_VERIFY_P2SH |
427
+ Interpreter.SCRIPT_VERIFY_STRICTENC |
428
+ Interpreter.SCRIPT_VERIFY_DERSIG |
429
+ Interpreter.SCRIPT_VERIFY_LOW_S |
430
+ Interpreter.SCRIPT_VERIFY_NULLFAIL |
431
+ Interpreter.SCRIPT_VERIFY_MINIMALDATA |
432
+ Interpreter.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY |
433
+ Interpreter.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY |
434
+ Interpreter.SCRIPT_ENABLE_SIGHASH_FORKID |
435
+ Interpreter.SCRIPT_ENABLE_MAGNETIC_OPCODES |
436
+ Interpreter.SCRIPT_ENABLE_MONOLITH_OPCODES
437
+ if (opts.afterChronicle !== false) {
438
+ flags |= Interpreter.SCRIPT_ENABLE_CHRONICLE
439
+ }
440
+ return flags
441
+ }
442
+
393
443
  /* Below flags apply in the context of BIP 68 */
394
444
  /**
395
445
  * If this flag set, CTxIn::nSequence is NOT interpreted as a relative
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartledger/bsv",
3
- "version": "7.10.1",
3
+ "version": "7.11.0",
4
4
  "description": "🚀 Complete Bitcoin SV development framework with legally-recognizable DID:web + W3C VC-JWT toolkit, Legal Token Protocol (LTP), Global Digital Attestation Framework (GDAF), StatusList2021 revocation, and 16 flexible loading options. Standards-based credentials with ES256/ES256K support, on-chain BSV anchoring, and comprehensive Bitcoin SV API. Perfect for legal tokens, verifiable credentials, DeFi, smart contracts, and secure Bitcoin applications.",
5
5
  "author": "SmartLedger Technology <hello@smartledger.technology> (https://smartledger.technology)",
6
6
  "homepage": "https://github.com/codenlighten/smartledger-bsv#readme",
@@ -68,9 +68,13 @@ describe('feature bundles externalise the shared primitives', function () {
68
68
  // from an externalised entry would bundle a second copy silently, with every existing
69
69
  // test green.
70
70
  it('contains only its own feature code, pinned per bundle', function () {
71
- // Accepted in any bundle: a tiny lodash subset with no library state, deliberately
72
- // duplicated rather than routed through the global.
73
- var SHARED = ['lib/util/']
71
+ // Accepted in any bundle: stateless helpers, deliberately duplicated rather than
72
+ // routed through the global.
73
+ //
74
+ // Named FILES, not the directory. `lib/util/` as a prefix exempts anything added
75
+ // under it later, including something stateful — which is the property this test
76
+ // exists to prevent. Listing them means a new util file has to be considered.
77
+ var SHARED = ['lib/util/_.js', 'lib/util/preconditions.js', 'lib/util/js.js']
74
78
  var EXPECTED = {
75
79
  'bsv-ecies.min.js': ['lib/ecies/'],
76
80
  'bsv-message.min.js': ['lib/message/'],
@@ -35,7 +35,10 @@ function run (build, opts) {
35
35
  return {
36
36
  verified: verified,
37
37
  errstr: interp.errstr || '',
38
- stack: (interp.stack || []).map(function (b) { return BN.fromScriptNumBuffer(b).toString() })
38
+ stack: (interp.stack || []).map(function (b) { return BN.fromScriptNumBuffer(b).toString() }),
39
+ // The raw bytes as well: several Chronicle behaviours are about WIDTH, not
40
+ // value, and a script-number reading collapses that distinction.
41
+ raw: (interp.stack || []).map(function (b) { return Buffer.from(b) })
39
42
  }
40
43
  }
41
44
 
@@ -53,8 +56,37 @@ describe('Chronicle script surface', function () {
53
56
  })
54
57
  })
55
58
 
56
- it('is off by default, so none of this changes existing evaluation', function () {
57
- (Interpreter.DEFAULT_FLAGS & CHRONICLE).should.equal(0)
59
+ // This assertion used to read `(Interpreter.DEFAULT_FLAGS & CHRONICLE).should.equal(0)`
60
+ // — and Interpreter.DEFAULT_FLAGS does not exist, so it evaluated `undefined & n`,
61
+ // which is 0 for every n. A tautology, written by me, in the same change that added
62
+ // the flag. What it MEANT to assert is that verify() enables nothing on its own.
63
+ it('is not enabled unless the caller asks: verify() defaults to no flags', function () {
64
+ // Deliberately NOT via run(): that helper defaults to CHRONICLE, so it would
65
+ // measure the helper rather than the library. Omit the argument entirely.
66
+ var script = new Script().add(Opcode.OP_VER)
67
+ var interp = new Interpreter()
68
+ var verified = interp.verify(new Script(), script, new bsv.Transaction(), 0)
69
+ verified.should.equal(false)
70
+ interp.errstr.should.match(/BAD_OPCODE/)
71
+ })
72
+
73
+ it('mainnetFlags() opts in, and can opt out for a pre-activation UTXO', function () {
74
+ // Chronicle gates PER UTXO in the node (`utxo_after_chronicle`), so the library
75
+ // cannot decide this globally — it can only make both answers easy to express.
76
+ (Interpreter.mainnetFlags() & CHRONICLE).should.not.equal(0)
77
+ ;(Interpreter.mainnetFlags({ afterChronicle: false }) & CHRONICLE).should.equal(0)
78
+ Interpreter.CHRONICLE_ACTIVATION_HEIGHT.should.equal(943816)
79
+ })
80
+
81
+ it('mainnetFlags() actually evaluates a Chronicle script', function () {
82
+ var r = run(function (s) { s.add(Opcode.OP_VER) },
83
+ { flags: Interpreter.mainnetFlags(), version: 7 })
84
+ r.stack[r.stack.length - 1].should.equal('7')
85
+
86
+ var pre = run(function (s) { s.add(Opcode.OP_VER) },
87
+ { flags: Interpreter.mainnetFlags({ afterChronicle: false }), version: 7 })
88
+ pre.verified.should.equal(false)
89
+ pre.errstr.should.match(/BAD_OPCODE/)
58
90
  })
59
91
  })
60
92
 
@@ -109,6 +141,11 @@ describe('Chronicle script surface', function () {
109
141
  ;[1, 2, 10].forEach(function (v) {
110
142
  var r = run(function (s) { s.add(Opcode.OP_VER) }, { version: v })
111
143
  r.stack[r.stack.length - 1].should.equal(String(v))
144
+ // LENGTH too, not just the numeric reading. `01000000` and `01` both read
145
+ // as 1, so the value check alone passes whether OP_VER pushes four
146
+ // little-endian bytes or a minimally-encoded script number — and pushing
147
+ // the script number was the bug fixed in #95.
148
+ r.raw[r.raw.length - 1].length.should.equal(4)
112
149
  })
113
150
  })
114
151
  })
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  'use strict'
2
2
  // GENERATED by scripts/sync-version.js on `npm version` — do not edit.
3
- module.exports = '7.10.1'
3
+ module.exports = '7.11.0'