@smartledger/bsv 7.5.8 → 7.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 +55 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +38 -38
- package/bsv-ltp.min.js +38 -38
- package/bsv-smartcontract.min.js +8 -8
- package/bsv.bundle.js +38 -38
- package/bsv.min.js +38 -38
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/lib/opcode.js +26 -10
- package/lib/script/interpreter.js +4 -5
- package/lib/smart_contract/opcode_map.js +9 -36
- package/package.json +1 -1
- package/test/opcode.js +28 -3
- package/test/script/interpreter.js +43 -4
- package/test/script/script.js +5 -4
- package/version.js +1 -1
|
@@ -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.
|
|
58
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.6.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.
|
|
64
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.6.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.
|
|
70
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.6.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.
|
|
85
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.
|
|
86
|
-
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.
|
|
87
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.
|
|
88
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.
|
|
89
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.
|
|
90
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.
|
|
91
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.
|
|
92
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.
|
|
93
|
-
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.
|
|
94
|
-
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.
|
|
95
|
-
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.
|
|
84
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js` |
|
|
85
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.6.0/bsv.bundle.js` |
|
|
86
|
+
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.6.0/bsv-smartcontract.min.js` |
|
|
87
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.6.0/bsv-covenant.min.js` |
|
|
88
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.6.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.6.0/bsv-security.min.js` |
|
|
90
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.6.0/bsv-ecies.min.js` |
|
|
91
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.6.0/bsv-message.min.js` |
|
|
92
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.6.0/bsv-mnemonic.min.js` |
|
|
93
|
+
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.6.0/bsv-shamir.min.js` |
|
|
94
|
+
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.6.0/bsv-gdaf.min.js` |
|
|
95
|
+
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.6.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.
|
|
104
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
103
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
104
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
110
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
111
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
109
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
110
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-covenant.min.js"></script>
|
|
111
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
117
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
118
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
116
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
117
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-ltp.min.js"></script>
|
|
118
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
137
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
135
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-security.min.js"></script>
|
|
137
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
149
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
725
|
+
<script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.6.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.
|
|
51
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
61
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
75
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
76
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
74
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
75
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-covenant.min.js"></script>
|
|
76
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
86
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
87
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
85
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
86
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-ltp.min.js"></script>
|
|
87
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
102
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
103
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
101
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
102
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-security.min.js"></script>
|
|
103
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
118
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.
|
|
119
|
-
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.
|
|
120
|
-
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.
|
|
121
|
-
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.
|
|
122
|
-
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.
|
|
123
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.
|
|
124
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.
|
|
125
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.
|
|
126
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.
|
|
127
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.
|
|
128
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.
|
|
117
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js` |
|
|
118
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.6.0/bsv.bundle.js` |
|
|
119
|
+
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.6.0/bsv-smartcontract.min.js` |
|
|
120
|
+
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.6.0/bsv-ltp.min.js` |
|
|
121
|
+
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.6.0/bsv-gdaf.min.js` |
|
|
122
|
+
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.6.0/bsv-shamir.min.js` |
|
|
123
|
+
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.6.0/bsv-security.min.js` |
|
|
124
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.6.0/bsv-mnemonic.min.js` |
|
|
125
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.6.0/bsv-ecies.min.js` |
|
|
126
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.6.0/bsv-covenant.min.js` |
|
|
127
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.6.0/bsv-script-helper.min.js` |
|
|
128
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.6.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.
|
|
17
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
18
18
|
|
|
19
19
|
<!-- Everything included (937KB) -->
|
|
20
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
20
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
130
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
131
131
|
|
|
132
132
|
<!-- Smart contracts (937KB) -->
|
|
133
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
133
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-smartcontract.min.js"></script>
|
|
134
134
|
|
|
135
135
|
<!-- Legal tokens (1.16MB) -->
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-ltp.min.js"></script>
|
|
137
137
|
|
|
138
138
|
<!-- Digital identity (1.16MB) -->
|
|
139
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
139
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-gdaf.min.js"></script>
|
|
140
140
|
|
|
141
141
|
<!-- Everything (937KB) -->
|
|
142
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
142
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.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.
|
|
162
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv.min.js"></script>
|
|
163
163
|
|
|
164
164
|
<!-- Add smart contracts when ready -->
|
|
165
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
165
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-smartcontract.min.js"></script>
|
|
166
166
|
|
|
167
167
|
<!-- Add advanced features as needed -->
|
|
168
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
169
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
168
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-ltp.min.js"></script>
|
|
169
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/bsv-gdaf.min.js"></script>
|
|
170
170
|
|
|
171
171
|
<!-- Everything in one file -->
|
|
172
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
172
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.6.0/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
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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,
|
|
@@ -937,12 +937,11 @@ Interpreter.prototype.step = function () {
|
|
|
937
937
|
}
|
|
938
938
|
break
|
|
939
939
|
|
|
940
|
+
// OP_NOP4..OP_NOP8 are gone: Chronicle reassigned their bytes to
|
|
941
|
+
// OP_SUBSTR/OP_LEFT/OP_RIGHT/OP_LSHIFTNUM/OP_RSHIFTNUM. OP_NOP1/9/10 are all that
|
|
942
|
+
// remain of the upgradable-NOP range, so 182/183 now fall through to the default
|
|
943
|
+
// case (SCRIPT_ERR_BAD_OPCODE) instead of silently succeeding as no-ops.
|
|
940
944
|
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
945
|
case Opcode.OP_NOP9:
|
|
947
946
|
case Opcode.OP_NOP10:
|
|
948
947
|
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
|
-
|
|
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
|
-
|
|
934
|
-
code:
|
|
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 ==================== */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartledger/bsv",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.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",
|
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
|
|
87
|
-
Object.keys(Opcode.map).length.should.equal(
|
|
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('
|
|
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 = [
|
|
@@ -15,6 +15,26 @@ var scriptTests = require('../data/bitcoind/script_tests')
|
|
|
15
15
|
var txValid = require('../data/bitcoind/tx_valid')
|
|
16
16
|
var txInvalid = require('../data/bitcoind/tx_invalid')
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Bitcoin Core names for the bytes BSV reassigned at Chronicle.
|
|
20
|
+
*
|
|
21
|
+
* The vendored script_tests.json is a faithful upstream copy and is never edited, so it
|
|
22
|
+
* still says NOP4..NOP8 — names this library no longer defines, because 0xb3-0xb7 now
|
|
23
|
+
* carry OP_SUBSTR/OP_LEFT/OP_RIGHT/OP_LSHIFTNUM/OP_RSHIFTNUM.
|
|
24
|
+
*
|
|
25
|
+
* Resolving them to Core's BYTES keeps each vector assembling the exact script Core
|
|
26
|
+
* meant, so the comparison stays honest: same bytes in, different BSV verdict out.
|
|
27
|
+
* Letting them fail to parse would turn a documented consensus divergence into an
|
|
28
|
+
* opaque harness error.
|
|
29
|
+
*/
|
|
30
|
+
var CORE_ONLY_OPCODES = {
|
|
31
|
+
OP_NOP4: 0xb3,
|
|
32
|
+
OP_NOP5: 0xb4,
|
|
33
|
+
OP_NOP6: 0xb5,
|
|
34
|
+
OP_NOP7: 0xb6,
|
|
35
|
+
OP_NOP8: 0xb7
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
// the script string format used in bitcoind data tests
|
|
19
39
|
Script.fromBitcoindString = function (str) {
|
|
20
40
|
var bw = new BufferWriter()
|
|
@@ -40,6 +60,8 @@ Script.fromBitcoindString = function (str) {
|
|
|
40
60
|
opstr = 'OP_' + token
|
|
41
61
|
opcodenum = Opcode[opstr]
|
|
42
62
|
bw.writeUInt8(opcodenum)
|
|
63
|
+
} else if (typeof CORE_ONLY_OPCODES['OP_' + token] === 'number') {
|
|
64
|
+
bw.writeUInt8(CORE_ONLY_OPCODES['OP_' + token])
|
|
43
65
|
} else if (typeof Opcode[token] === 'number') {
|
|
44
66
|
opstr = token
|
|
45
67
|
opcodenum = Opcode[opstr]
|
|
@@ -618,9 +640,15 @@ describe('Interpreter', function () {
|
|
|
618
640
|
// the surrounding `0 IF <op> ELSE 1 ENDIF` form fails under upstream only
|
|
619
641
|
// because disabled opcodes are rejected even in unexecuted branches; once
|
|
620
642
|
// enabled, the branch is simply skipped and the script is 'OK'.)
|
|
621
|
-
// -
|
|
622
|
-
//
|
|
623
|
-
//
|
|
643
|
+
// - Chronicle reassigned 0xb3-0xb7 to OP_SUBSTR/OP_LEFT/OP_RIGHT/OP_LSHIFTNUM/
|
|
644
|
+
// OP_RSHIFTNUM, so Core's NOP4..NOP8 no longer exist as no-ops. Vectors that
|
|
645
|
+
// expect those bytes to do nothing now fail here: 0xb3-0xb5 consume stack as
|
|
646
|
+
// string ops (INVALID_STACK_OPERATION), and 0xb6/0xb7 are rejected outright
|
|
647
|
+
// (BAD_OPCODE) because the shift SEMANTICS are deliberately unimplemented —
|
|
648
|
+
// the spec underdetermines them, and validating wrongly is worse than
|
|
649
|
+
// refusing. This is a real consensus divergence from Core, not a quirk.
|
|
650
|
+
// (0xba is no longer a NOP either; it is unassigned, which now AGREES with
|
|
651
|
+
// Core, so its former override has been removed.)
|
|
624
652
|
var BSV_DIVERGENCES = {
|
|
625
653
|
"'a' 'b'|CAT|P2SH,STRICTENC": 'OK',
|
|
626
654
|
"'a' 'b' 0|IF CAT ELSE 1 ENDIF|P2SH,STRICTENC": 'OK',
|
|
@@ -635,7 +663,18 @@ describe('Interpreter', function () {
|
|
|
635
663
|
'2 2 0 IF MOD ELSE 1 ENDIF|NOP|P2SH,STRICTENC': 'OK',
|
|
636
664
|
'2 DUP DIV|1 EQUAL|P2SH,STRICTENC': 'OK',
|
|
637
665
|
'7 3 MOD|1 EQUAL|P2SH,STRICTENC': 'OK',
|
|
638
|
-
|
|
666
|
+
|
|
667
|
+
// Chronicle byte reassignment (see the note above). Values are the BSV error,
|
|
668
|
+
// recorded for documentation; the harness only distinguishes 'OK' from not-'OK'.
|
|
669
|
+
'1|NOP1 CHECKLOCKTIMEVERIFY CHECKSEQUENCEVERIFY NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10 1 EQUAL|P2SH,STRICTENC': 'SCRIPT_ERR_INVALID_STACK_OPERATION',
|
|
670
|
+
"'NOP_1_to_10' NOP1 CHECKLOCKTIMEVERIFY CHECKSEQUENCEVERIFY NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10|'NOP_1_to_10' EQUAL|P2SH,STRICTENC": 'SCRIPT_ERR_INVALID_STACK_OPERATION',
|
|
671
|
+
'NOP|NOP4 1|P2SH,STRICTENC': 'SCRIPT_ERR_INVALID_STACK_OPERATION',
|
|
672
|
+
'NOP|NOP5 1|P2SH,STRICTENC': 'SCRIPT_ERR_INVALID_STACK_OPERATION',
|
|
673
|
+
'NOP|NOP6 1|P2SH,STRICTENC': 'SCRIPT_ERR_INVALID_STACK_OPERATION',
|
|
674
|
+
'NOP|NOP7 1|P2SH,STRICTENC': 'SCRIPT_ERR_BAD_OPCODE',
|
|
675
|
+
'NOP|NOP8 1|P2SH,STRICTENC': 'SCRIPT_ERR_BAD_OPCODE',
|
|
676
|
+
'0x47 0x3044022018a2a81a93add5cb5f5da76305718e4ea66045ec4888b28d84cb22fae7f4645b02201e6daa5ed5d2e4b2b2027cf7ffd43d8d9844dd49f74ef86899ec8e669dfd39aa01 NOP8 0x23 0x2103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640ac|HASH160 0x14 0x215640c2f72f0d16b4eced26762035a42ffed39a EQUAL|': 'SCRIPT_ERR_BAD_OPCODE',
|
|
677
|
+
'0x47 0x304402203e4516da7253cf068effec6b95c41221c0cf3a8e6ccb8cbf1725b562e9afde2c022054e1c258c2981cdfba5df1f46661fb6541c44f77ca0092f3600331abfffb125101 NOP8|0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 CHECKSIG|': 'SCRIPT_ERR_BAD_OPCODE'
|
|
639
678
|
}
|
|
640
679
|
|
|
641
680
|
describe('bitcoind script evaluation fixtures', function () {
|
package/test/script/script.js
CHANGED
|
@@ -701,10 +701,11 @@ describe('Script', function () {
|
|
|
701
701
|
|
|
702
702
|
describe('#add and #prepend', function () {
|
|
703
703
|
it('should add these ops', function () {
|
|
704
|
-
//
|
|
705
|
-
//
|
|
706
|
-
//
|
|
707
|
-
Script().add(1).add(10).add(
|
|
704
|
+
// 185 (0xb9) is OP_NOP10, the highest byte Chronicle still assigns, so it
|
|
705
|
+
// disassembles by name. 186 is unassigned and renders as a raw byte — the
|
|
706
|
+
// NOP names are no longer slid upward past 185 (see lib/opcode.js).
|
|
707
|
+
Script().add(1).add(10).add(185).toString().should.equal('0x01 0x0a OP_NOP10')
|
|
708
|
+
Script().add(1).add(10).add(186).toString().should.equal('0x01 0x0a 0xba')
|
|
708
709
|
Script().add(1000).toString().should.equal('0x03e8')
|
|
709
710
|
Script().add('OP_CHECKMULTISIG').toString().should.equal('OP_CHECKMULTISIG')
|
|
710
711
|
Script().add('OP_1').add('OP_2').toString().should.equal('OP_1 OP_2')
|
package/version.js
CHANGED