@smartledger/bsv 7.5.8 → 7.6.1

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.5.8/bsv-shamir.min.js`
58
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js` |
85
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js` |
86
- | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js` |
87
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js` |
88
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.8/bsv-script-helper.min.js` |
89
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js` |
90
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ecies.min.js` |
91
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.8/bsv-message.min.js` |
92
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.8/bsv-mnemonic.min.js` |
93
- | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-shamir.min.js` |
94
- | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js` |
95
- | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js` |
84
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.6.1/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.6.1/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.6.1/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.6.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.6.1/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.6.1/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.6.1/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.6.1/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.6.1/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.6.1/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
104
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-script-helper.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
110
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js"></script>
111
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js"></script>
109
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
117
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
118
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js"></script>
116
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
136
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js"></script>
137
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-shamir.min.js"></script>
135
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
51
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
75
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js"></script>
76
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js"></script>
74
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
86
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
87
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js"></script>
85
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
102
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js"></script>
103
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-shamir.min.js"></script>
101
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js` |
118
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js` |
119
- | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js` |
120
- | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js` |
121
- | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js` |
122
- | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.5.8/bsv-shamir.min.js` |
123
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.8/bsv-security.min.js` |
124
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.8/bsv-mnemonic.min.js` |
125
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.8/bsv-ecies.min.js` |
126
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.8/bsv-covenant.min.js` |
127
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.8/bsv-script-helper.min.js` |
128
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.8/bsv-message.min.js` |
117
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.6.1/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.6.1/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.6.1/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.6.1/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.6.1/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.6.1/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.6.1/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.6.1/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.6.1/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.6.1/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
17
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
18
18
 
19
19
  <!-- Everything included (937KB) -->
20
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js"></script>
20
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
130
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
131
131
 
132
132
  <!-- Smart contracts (937KB) -->
133
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js"></script>
133
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-smartcontract.min.js"></script>
134
134
 
135
135
  <!-- Legal tokens (1.16MB) -->
136
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-ltp.min.js"></script>
137
137
 
138
138
  <!-- Digital identity (1.16MB) -->
139
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js"></script>
139
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-gdaf.min.js"></script>
140
140
 
141
141
  <!-- Everything (937KB) -->
142
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js"></script>
142
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/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.5.8/bsv.min.js"></script>
162
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.min.js"></script>
163
163
 
164
164
  <!-- Add smart contracts when ready -->
165
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-smartcontract.min.js"></script>
165
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-smartcontract.min.js"></script>
166
166
 
167
167
  <!-- Add advanced features as needed -->
168
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-ltp.min.js"></script>
169
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv-gdaf.min.js"></script>
168
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-ltp.min.js"></script>
169
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv-gdaf.min.js"></script>
170
170
 
171
171
  <!-- Everything in one file -->
172
- <script src="https://unpkg.com/@smartledger/bsv@7.5.8/bsv.bundle.js"></script>
172
+ <script src="https://unpkg.com/@smartledger/bsv@7.6.1/bsv.bundle.js"></script>
173
173
  ```
174
174
 
175
175
  ## 🔍 **Testing Your Migration**
package/lib/opcode.js CHANGED
@@ -203,19 +203,35 @@ Opcode.map = {
203
203
  OP_NOP2: 177,
204
204
  OP_NOP3: 178,
205
205
 
206
- // Chronicle string operations (re-enabled in Chronicle release)
206
+ // Chronicle reassigns five bytes, and the spec fixes the mapping itself by naming
207
+ // which NOP each one used to be:
208
+ //
209
+ // 179 OP_SUBSTR was OP_NOP4
210
+ // 180 OP_LEFT was OP_NOP5
211
+ // 181 OP_RIGHT was OP_NOP6
212
+ // 182 OP_LSHIFTNUM was OP_NOP7
213
+ // 183 OP_RSHIFTNUM was OP_NOP8
214
+ //
215
+ // So OP_NOP4..OP_NOP8 no longer exist. This table previously slid the NOP names
216
+ // upward instead, which put OP_NOP4/OP_NOP5 on the shift opcodes' bytes and
217
+ // invented OP_NOP8..OP_NOP10 at 186-188 — bytes that are not opcodes at all.
218
+ //
219
+ // The consequence was the worst kind of bug: byte 182 parsed as a NOP, so a script
220
+ // using OP_LSHIFTNUM VERIFIED AS TRUE with both operands still on the stack — a
221
+ // shift that never happened, reported as success. 182/183 now fall through to
222
+ // SCRIPT_ERR_BAD_OPCODE. The semantics are deliberately NOT implemented: the
223
+ // published spec is one sentence and leaves operand order, what "preserving sign"
224
+ // means for sign-magnitude numbers, out-of-range shift counts and result encoding
225
+ // all undetermined. Refusing to validate is safe; validating wrongly is not.
207
226
  OP_SUBSTR: 179,
208
227
  OP_LEFT: 180,
209
228
  OP_RIGHT: 181,
210
-
211
- // remaining NOPs (shifted due to Chronicle string ops)
212
- OP_NOP4: 182,
213
- OP_NOP5: 183,
214
- OP_NOP6: 184,
215
- OP_NOP7: 185,
216
- OP_NOP8: 186,
217
- OP_NOP9: 187,
218
- OP_NOP10: 188,
229
+ OP_LSHIFTNUM: 182,
230
+ OP_RSHIFTNUM: 183,
231
+
232
+ // The only NOPs left above OP_NOP3.
233
+ OP_NOP9: 184,
234
+ OP_NOP10: 185,
219
235
 
220
236
  // template matching params
221
237
  OP_PUBKEYHASH: 253,
@@ -681,7 +681,11 @@ Interpreter.prototype.checkSequence = function (nSequence) {
681
681
  var nLockTimeMask =
682
682
  Interpreter.SEQUENCE_LOCKTIME_TYPE_FLAG | Interpreter.SEQUENCE_LOCKTIME_MASK
683
683
  var txToSequenceMasked = new BN(txToSequence & nLockTimeMask)
684
- var nSequenceMasked = nSequence.and(nLockTimeMask)
684
+ // new BN(...) is required: bn.js `and` takes a BN, and passing the plain
685
+ // number threw 'num.clone is not a function'. The interpreter's try/catch
686
+ // swallowed it and reported SCRIPT_ERR_UNKNOWN_ERROR, making every
687
+ // OP_CHECKSEQUENCEVERIFY script fail with a misleading error.
688
+ var nSequenceMasked = nSequence.and(new BN(nLockTimeMask))
685
689
 
686
690
  // There are two kinds of nSequence: lock-by-blockheight and
687
691
  // lock-by-blocktime, distinguished by whether nSequenceMasked <
@@ -937,12 +941,11 @@ Interpreter.prototype.step = function () {
937
941
  }
938
942
  break
939
943
 
944
+ // OP_NOP4..OP_NOP8 are gone: Chronicle reassigned their bytes to
945
+ // OP_SUBSTR/OP_LEFT/OP_RIGHT/OP_LSHIFTNUM/OP_RSHIFTNUM. OP_NOP1/9/10 are all that
946
+ // remain of the upgradable-NOP range, so 182/183 now fall through to the default
947
+ // case (SCRIPT_ERR_BAD_OPCODE) instead of silently succeeding as no-ops.
940
948
  case Opcode.OP_NOP1:
941
- case Opcode.OP_NOP4:
942
- case Opcode.OP_NOP5:
943
- case Opcode.OP_NOP6:
944
- case Opcode.OP_NOP7:
945
- case Opcode.OP_NOP8:
946
949
  case Opcode.OP_NOP9:
947
950
  case Opcode.OP_NOP10:
948
951
  if (this.flags & Interpreter.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS) {
@@ -900,47 +900,20 @@ const opcodeMap = {
900
900
  description: 'No operation (formerly CHECKSEQUENCEVERIFY)',
901
901
  action: s => {}
902
902
  },
903
- OP_NOP4: {
904
- code: 0xb6,
903
+ // Chronicle reassigned 0xb3-0xb7, so OP_NOP4..OP_NOP8 no longer exist. The two
904
+ // survivors keep their own numbers; 0xb6/0xb7 are the shift opcodes and are rejected
905
+ // rather than treated as no-ops (see lib/opcode.js).
906
+ OP_NOP9: {
907
+ code: 0xb8,
905
908
  category: 'nop',
906
909
  description: 'No operation (reserved for future use)',
907
- action: s => {}
908
- },
909
- OP_NOP5: {
910
- code: 0xb7,
911
- category: 'nop',
912
- description: 'No operation (reserved for future use)',
913
- action: s => {}
914
- },
915
- OP_NOP6: {
916
- code: 0xb8,
917
- category: 'nop',
918
- description: 'No operation (reserved for future use)',
919
- action: s => {}
920
- },
921
- OP_NOP7: {
922
- code: 0xb9,
923
- category: 'nop',
924
- description: 'No operation (reserved for future use)',
925
- action: s => {}
926
- },
927
- OP_NOP8: {
928
- code: 0xba,
929
- category: 'nop',
930
- description: 'No operation (reserved for future use)',
931
- action: s => {}
910
+ action: s => {}
932
911
  },
933
- OP_NOP9: {
934
- code: 0xbb,
912
+ OP_NOP10: {
913
+ code: 0xb9,
935
914
  category: 'nop',
936
915
  description: 'No operation (reserved for future use)',
937
- action: s => {}
938
- },
939
- OP_NOP10: {
940
- code: 0xbc,
941
- category: 'nop',
942
- description: 'No operation (reserved for future use)',
943
- action: s => {}
916
+ action: s => {}
944
917
  },
945
918
 
946
919
  /* ==================== RESERVED/DISABLED OPERATIONS ==================== */
@@ -180,7 +180,22 @@ function sFromPreimage (preimage) {
180
180
  if (z[0] < 0x01 || z[0] > 0x7f) return null
181
181
  var s = new BN(z).add(new BN(Gx)).mod(N)
182
182
  if (s.gt(HALF_N)) return null // enforce low-S (canonical / non-malleable)
183
- var sBE = s.toBuffer('be', 32)
183
+ // NOT s.toBuffer('be', 32): lib/crypto/bn.js REPLACES toBuffer with an
184
+ // options-object form, so 'be' would land in `opts`, opts.size would be
185
+ // undefined and the 32 ignored — yielding a natural-length buffer.
186
+ //
187
+ // That truncation is currently UNREACHABLE, and the reason is worth writing
188
+ // down because it is not obvious: z is filtered to a leading byte of
189
+ // 0x01..0x7f above, so z is in [2**248, 2**255); adding Gx (~0.476 * 2**256)
190
+ // never wraps; and the low-S check caps the result at n/2. s therefore lands
191
+ // in a narrow band with a leading byte of 0x7a..0x7f and is always 32 bytes.
192
+ //
193
+ // The call is still wrong, and worth fixing, because that safety is an
194
+ // accident of two filters that have nothing to do with buffer length. Widen
195
+ // the MINIMALDATA range or drop low-S and the truncation becomes reachable —
196
+ // silently, inside a covenant, where DER_PREFIX declares s to be exactly 32
197
+ // bytes and a short one makes the spend invalid.
198
+ var sBE = s.toBuffer({ size: 32 })
184
199
  return (sBE[0] >= 0x01) ? sBE : null // s <= n/2 already guarantees sBE[0] <= 0x7f
185
200
  }
186
201
 
@@ -215,7 +230,12 @@ function grind (spend, inputIndex, lockingScript, satoshis, opts) {
215
230
  if (field === 'nLockTime') spend.nLockTime = nonce
216
231
  else input.sequenceNumber = 0xfffffffe - nonce // stay < 0xffffffff (non-final)
217
232
  var preimage = H.rawPreimage(spend, inputIndex, lockingScript, satoshis, sighashType)
218
- if (sFromPreimage(preimage)) return { preimage: preimage, tries: i + 1, field: field, nonce: nonce }
233
+ // Length-checked, not truthy: grind's contract is a FIXED-length DER
234
+ // signature, and a short s would be truthy. Belt-and-braces alongside the
235
+ // toBuffer fix above — this is the check that would catch it if the
236
+ // upstream filters that currently make a short s impossible ever change.
237
+ var sBE = sFromPreimage(preimage)
238
+ if (sBE && sBE.length === 32) return { preimage: preimage, tries: i + 1, field: field, nonce: nonce }
219
239
  }
220
240
  throw new Error('OP_PUSH_TX grind failed after ' + maxTries + ' tries')
221
241
  }
@@ -340,7 +340,7 @@ Transaction.prototype.fromObject = function fromObject (arg) {
340
340
  var self = this
341
341
  var transaction
342
342
  if (arg instanceof Transaction) {
343
- transaction = transaction.toObject()
343
+ transaction = arg.toObject()
344
344
  } else {
345
345
  transaction = arg
346
346
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartledger/bsv",
3
- "version": "7.5.8",
3
+ "version": "7.6.1",
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",
package/test/opcode.js CHANGED
@@ -83,15 +83,40 @@ describe('Opcode', function () {
83
83
  })
84
84
 
85
85
  describe('@map', function () {
86
- it('should have a map containing 121 elements', function () {
87
- Object.keys(Opcode.map).length.should.equal(121)
86
+ it('should have a map containing 118 elements', function () {
87
+ Object.keys(Opcode.map).length.should.equal(118)
88
88
  })
89
89
  })
90
90
 
91
91
  describe('@reverseMap', function () {
92
92
  it('should exist and have op 185', function () {
93
93
  should.exist(Opcode.reverseMap)
94
- Opcode.reverseMap[185].should.equal('OP_NOP7')
94
+ Opcode.reverseMap[185].should.equal('OP_NOP10')
95
+ })
96
+
97
+ // Chronicle reassigns 179-183 and names which NOP each byte used to be, so
98
+ // OP_NOP4..OP_NOP8 cease to exist and OP_NOP9/OP_NOP10 keep their own numbers.
99
+ // Pinning the whole range by name catches a future edit sliding them again —
100
+ // which is how 182 came to parse as a no-op and verify a shift that never ran.
101
+ it('assigns the Chronicle range exactly, with no invented NOPs above it', function () {
102
+ var expected = {
103
+ 179: 'OP_SUBSTR',
104
+ 180: 'OP_LEFT',
105
+ 181: 'OP_RIGHT',
106
+ 182: 'OP_LSHIFTNUM',
107
+ 183: 'OP_RSHIFTNUM',
108
+ 184: 'OP_NOP9',
109
+ 185: 'OP_NOP10'
110
+ }
111
+ Object.keys(expected).forEach(function (b) {
112
+ Opcode.reverseMap[b].should.equal(expected[b])
113
+ })
114
+ ;[186, 187, 188].forEach(function (b) {
115
+ should.not.exist(Opcode.reverseMap[b])
116
+ })
117
+ ;['OP_NOP4', 'OP_NOP5', 'OP_NOP6', 'OP_NOP7', 'OP_NOP8'].forEach(function (n) {
118
+ should.not.exist(Opcode.map[n])
119
+ })
95
120
  })
96
121
  })
97
122
  var smallints = [