@smartledger/bsv 1.5.6-fix1 โ 3.0.2
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 +111 -0
- package/README.md +38 -10
- package/bsv.min.js +8 -8
- package/index.js +10 -0
- package/lib/crypto/ecdsa.js +57 -38
- package/lib/crypto/smartledger_verify.js +42 -11
- package/lib/script/interpreter.js +8 -8
- package/lib/smartminer.js +169 -0
- package/lib/smartutxo.js +200 -0
- package/lib/transaction/transaction.js +39 -0
- package/package.json +29 -4
- package/utilities/README.md +132 -0
- package/utilities/blockchain-state.js +332 -0
- package/utilities/blockchain-state.json +41 -0
- package/utilities/miner-simulator.js +620 -0
- package/utilities/mock-utxo-generator.js +149 -0
- package/utilities/raw-tx-examples.js +213 -0
- package/utilities/success-demo.js +193 -0
- package/utilities/transaction-examples.js +328 -0
- package/utilities/utxo-manager.js +162 -0
- package/utilities/wallet-setup.js +167 -0
- package/utilities/wallet.json +30 -0
- package/utilities/working-signature-demo.js +181 -0
- package/validation_test.js +97 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to SmartLedger-BSV will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [3.0.2] - 2025-10-19
|
|
9
|
+
|
|
10
|
+
### ๐ง Fixed
|
|
11
|
+
- **CRITICAL**: Fixed signature verification bug that caused all ECDSA.verify() calls to return false
|
|
12
|
+
- **CRITICAL**: Fixed SmartVerify.smartVerify() failure when processing DER-encoded signatures
|
|
13
|
+
- Fixed ECDSA.set() method to automatically parse DER buffers to Signature objects for compatibility
|
|
14
|
+
- Fixed double canonicalization issue in ECDSA.sigError() that corrupted signature verification
|
|
15
|
+
- Fixed SmartVerify.isCanonical() to properly handle DER buffer inputs
|
|
16
|
+
- Enhanced backward compatibility for both canonical and non-canonical signature inputs
|
|
17
|
+
|
|
18
|
+
### โจ Added
|
|
19
|
+
- **NEW**: SmartUTXO - Comprehensive UTXO management system for BSV development and testing
|
|
20
|
+
- **NEW**: SmartMiner - BSV blockchain miner simulator with full transaction validation
|
|
21
|
+
- **NEW**: Signature verification validation test suite (`npm run test:signatures`)
|
|
22
|
+
- **NEW**: Blockchain state management with persistent JSON storage
|
|
23
|
+
- **NEW**: Mock UTXO generation for testing and development
|
|
24
|
+
- **NEW**: Transaction mempool simulation and block mining
|
|
25
|
+
- **NEW**: Enhanced development tools for BSV application testing
|
|
26
|
+
|
|
27
|
+
### ๐ Enhanced
|
|
28
|
+
- Improved signature verification pipeline for external developer compatibility
|
|
29
|
+
- Enhanced DER buffer parsing throughout the crypto modules
|
|
30
|
+
- Added comprehensive logging and debugging capabilities for development tools
|
|
31
|
+
- Improved error handling and validation in signature processing
|
|
32
|
+
- Added compatibility layer for mixed signature formats (DER buffers + Signature objects)
|
|
33
|
+
|
|
34
|
+
### ๐ฆ Developer Experience
|
|
35
|
+
- Added `validation_test.js` for signature verification testing
|
|
36
|
+
- Exposed `bsv.SmartUTXO` and `bsv.SmartMiner` modules in main API
|
|
37
|
+
- Enhanced npm scripts with signature testing capabilities
|
|
38
|
+
- Added comprehensive documentation for new UTXO management features
|
|
39
|
+
- Included utilities/ directory in npm package for developer access
|
|
40
|
+
|
|
41
|
+
### ๐ Bug Impact
|
|
42
|
+
- **Before**: External developers importing smartledger-bsv experienced 100% signature verification failure
|
|
43
|
+
- **After**: All signature verification methods now work correctly with 100% success rate
|
|
44
|
+
- **Affected Methods**: ECDSA.verify(), SmartVerify.smartVerify(), SmartVerify.isCanonical()
|
|
45
|
+
- **Root Cause**: Double canonicalization and improper DER buffer handling in verification pipeline
|
|
46
|
+
- **Solution**: Enhanced signature object parsing and canonical verification logic
|
|
47
|
+
|
|
48
|
+
### ๐ Validation Results
|
|
49
|
+
```
|
|
50
|
+
Test Results: 14/14 tests passed (100% success rate)
|
|
51
|
+
โ
ECDSA.verify(hash, derSig, publicKey): true
|
|
52
|
+
โ
ECDSA.verify(hash, canonicalDer, publicKey): true
|
|
53
|
+
โ
ECDSA.verify(hash, signature, publicKey): true
|
|
54
|
+
โ
SmartVerify.smartVerify(hash, derSig, publicKey): true
|
|
55
|
+
โ
SmartVerify.smartVerify(hash, canonicalDer, publicKey): true
|
|
56
|
+
โ
SmartVerify.isCanonical(derSig): true
|
|
57
|
+
โ
SmartVerify.isCanonical(canonicalDer): true
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## [3.0.1] - 2025-10-19
|
|
61
|
+
|
|
62
|
+
### ๐ Security
|
|
63
|
+
- Security-hardened Bitcoin SV library with zero known vulnerabilities
|
|
64
|
+
- Enhanced signature canonicalization and malleability protection
|
|
65
|
+
- Fixed elliptic curve vulnerabilities from upstream dependencies
|
|
66
|
+
- Implemented SmartVerify hardened verification module
|
|
67
|
+
|
|
68
|
+
### ๐๏ธ Infrastructure
|
|
69
|
+
- Complete drop-in replacement for bsv@1.5.6
|
|
70
|
+
- Maintained full API compatibility while enhancing security
|
|
71
|
+
- Added comprehensive security feature documentation
|
|
72
|
+
- Enhanced error handling and input validation
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Migration Guide
|
|
77
|
+
|
|
78
|
+
### From v3.0.1 to v3.0.2
|
|
79
|
+
|
|
80
|
+
**No Breaking Changes** - This is a bug fix release that maintains full backward compatibility.
|
|
81
|
+
|
|
82
|
+
**New Features Available:**
|
|
83
|
+
```javascript
|
|
84
|
+
const bsv = require('smartledger-bsv');
|
|
85
|
+
|
|
86
|
+
// New UTXO Management System
|
|
87
|
+
const utxoManager = new bsv.SmartUTXO();
|
|
88
|
+
const balance = utxoManager.getBalance('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa');
|
|
89
|
+
|
|
90
|
+
// New Miner Simulator
|
|
91
|
+
const miner = new bsv.SmartMiner(bsv);
|
|
92
|
+
const accepted = miner.acceptTransaction(transaction);
|
|
93
|
+
const block = miner.mineBlock();
|
|
94
|
+
|
|
95
|
+
// Signature verification now works correctly
|
|
96
|
+
const verified = bsv.crypto.ECDSA.verify(hash, derSig, publicKey); // Now returns true
|
|
97
|
+
const smartVerified = bsv.SmartVerify.smartVerify(hash, derSig, publicKey); // Now returns true
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Testing Your Integration:**
|
|
101
|
+
```bash
|
|
102
|
+
npm run test:signatures # Validates signature verification works correctly
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Support
|
|
108
|
+
|
|
109
|
+
- **GitHub**: https://github.com/codenlighten/smartledger-bsv
|
|
110
|
+
- **Issues**: https://github.com/codenlighten/smartledger-bsv/issues
|
|
111
|
+
- **Email**: hello@smartledger.technology
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# SmartLedger BSV
|
|
1
|
+
# SmartLedger BSV v3.0
|
|
2
2
|
### Security-Hardened Bitcoin SV Library
|
|
3
3
|
|
|
4
|
-
[](https://www.npmjs.com/package/smartledger-bsv)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
[]()
|
|
7
7
|
[]()
|
|
@@ -12,12 +12,12 @@ A **complete drop-in replacement** for BSV@1.5.6 with critical security vulnerab
|
|
|
12
12
|
## ๐ Quick Start
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm install
|
|
15
|
+
npm install smartledger-bsv
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
```javascript
|
|
19
19
|
// Drop-in replacement - no code changes required
|
|
20
|
-
const bsv = require('
|
|
20
|
+
const bsv = require('smartledger-bsv');
|
|
21
21
|
|
|
22
22
|
const privateKey = bsv.PrivateKey();
|
|
23
23
|
const message = bsv.Message('hello world');
|
|
@@ -61,13 +61,36 @@ console.log(signature.validate()); // comprehensive validation
|
|
|
61
61
|
- `bsv-ecies.min.js` - Encryption support (71KB)
|
|
62
62
|
|
|
63
63
|
### CDN Usage
|
|
64
|
+
|
|
65
|
+
#### unpkg CDN
|
|
64
66
|
```html
|
|
65
67
|
<!-- Security-hardened BSV library -->
|
|
66
|
-
<script src="https://
|
|
68
|
+
<script src="https://unpkg.com/smartledger-bsv@3.0.0/bsv.min.js"></script>
|
|
67
69
|
|
|
68
70
|
<!-- Optional modules -->
|
|
69
|
-
<script src="https://
|
|
70
|
-
<script src="https://
|
|
71
|
+
<script src="https://unpkg.com/smartledger-bsv@3.0.0/bsv-message.min.js"></script>
|
|
72
|
+
<script src="https://unpkg.com/smartledger-bsv@3.0.0/bsv-mnemonic.min.js"></script>
|
|
73
|
+
<script src="https://unpkg.com/smartledger-bsv@3.0.0/bsv-ecies.min.js"></script>
|
|
74
|
+
|
|
75
|
+
<!-- Always latest version -->
|
|
76
|
+
<script src="https://unpkg.com/smartledger-bsv/bsv.min.js"></script>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### jsDelivr CDN
|
|
80
|
+
```html
|
|
81
|
+
<script src="https://cdn.jsdelivr.net/npm/smartledger-bsv@3.0.0/bsv.min.js"></script>
|
|
82
|
+
<script src="https://cdn.jsdelivr.net/npm/smartledger-bsv@3.0.0/bsv-message.min.js"></script>
|
|
83
|
+
<script src="https://cdn.jsdelivr.net/npm/smartledger-bsv@3.0.0/bsv-mnemonic.min.js"></script>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### ES6 Module CDN
|
|
87
|
+
```html
|
|
88
|
+
<script type="module">
|
|
89
|
+
import bsv from 'https://unpkg.com/smartledger-bsv@3.0.0/bsv.min.js';
|
|
90
|
+
|
|
91
|
+
const privateKey = new bsv.PrivateKey();
|
|
92
|
+
console.log('BSV Address:', privateKey.toAddress().toString());
|
|
93
|
+
</script>
|
|
71
94
|
```
|
|
72
95
|
|
|
73
96
|
## ๐งช Validation & Testing
|
|
@@ -93,7 +116,7 @@ console.log(signature.validate()); // comprehensive validation
|
|
|
93
116
|
const bsv = require('bsv');
|
|
94
117
|
|
|
95
118
|
// After (security-hardened)
|
|
96
|
-
const bsv = require('
|
|
119
|
+
const bsv = require('smartledger-bsv');
|
|
97
120
|
|
|
98
121
|
// All existing code works unchanged
|
|
99
122
|
const tx = new bsv.Transaction()
|
|
@@ -134,14 +157,19 @@ Full browser support with proper Buffer handling and crypto compatibility:
|
|
|
134
157
|
<!DOCTYPE html>
|
|
135
158
|
<html>
|
|
136
159
|
<head>
|
|
137
|
-
|
|
160
|
+
<!-- Using unpkg CDN -->
|
|
161
|
+
<script src="https://unpkg.com/smartledger-bsv@3.0.0/bsv.min.js"></script>
|
|
138
162
|
</head>
|
|
139
163
|
<body>
|
|
140
164
|
<script>
|
|
141
165
|
// Works in all modern browsers
|
|
142
|
-
const privateKey = bsv.PrivateKey();
|
|
166
|
+
const privateKey = new bsv.PrivateKey();
|
|
143
167
|
const address = privateKey.toAddress().toString();
|
|
144
168
|
console.log('BSV Address:', address);
|
|
169
|
+
|
|
170
|
+
// SmartLedger security features available
|
|
171
|
+
console.log('Security Features:', bsv.SmartLedger.securityFeatures);
|
|
172
|
+
console.log('Hardened by:', bsv.SmartLedger.hardenedBy);
|
|
145
173
|
</script>
|
|
146
174
|
</body>
|
|
147
175
|
</html>
|