smartledger-bsv 3.1.1 → 3.2.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 +123 -1
- package/README.md +233 -277
- package/bsv.bundle.js +39 -0
- package/bsv.min.js +8 -8
- package/docs/ADVANCED_COVENANT_DEVELOPMENT.md +533 -0
- package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +169 -0
- package/docs/CUSTOM_SCRIPT_DEVELOPMENT.md +320 -0
- package/docs/README.md +201 -0
- package/docs/block.md +46 -0
- package/docs/ecies.md +102 -0
- package/docs/index.md +104 -0
- package/docs/nchain.md +958 -0
- package/docs/networks.md +55 -0
- package/docs/preimage.md +126 -0
- package/docs/script.md +139 -0
- package/docs/transaction.md +174 -0
- package/docs/unspentoutput.md +32 -0
- package/examples/README.md +200 -0
- package/examples/basic/transaction-creation.js +534 -0
- package/examples/basic/transaction_signature_api_gap.js +178 -0
- package/examples/covenants/advanced_covenant_demo.js +219 -0
- package/examples/covenants/covenant_interface_demo.js +270 -0
- package/examples/covenants/covenant_manual_signature_resolved.js +212 -0
- package/examples/covenants/covenant_signature_template.js +117 -0
- package/examples/covenants2/covenant_bidirectional_example.js +262 -0
- package/examples/covenants2/covenant_utils_demo.js +120 -0
- package/examples/covenants2/preimage_covenant_utils.js +287 -0
- package/examples/covenants2/production_integration.js +256 -0
- package/examples/data/covenant_utxos.json +28 -0
- package/examples/data/utxos.json +26 -0
- package/examples/preimage/README.md +178 -0
- package/examples/preimage/extract_preimage_bidirectional.js +421 -0
- package/examples/preimage/generate_sample_preimage.js +208 -0
- package/examples/preimage/generate_sighash_examples.js +152 -0
- package/examples/preimage/parse_preimage.js +117 -0
- package/examples/preimage/test_preimage_extractor.js +53 -0
- package/examples/preimage/test_varint_extraction.js +95 -0
- package/examples/scripts/custom_script_helper_example.js +273 -0
- package/examples/scripts/custom_script_signature_test.js +344 -0
- package/examples/scripts/script_interpreter.js +193 -0
- package/examples/smart_contract/complete_workflow_demo.js +343 -0
- package/examples/smart_contract/covenant_builder_demo.js +176 -0
- package/examples/smart_contract/script_testing_integration.js +198 -0
- package/index.js +3 -0
- package/lib/covenant-interface.js +713 -0
- package/lib/opcode.js +14 -7
- package/lib/smart_contract/API_REFERENCE.md +754 -0
- package/lib/smart_contract/DOCUMENTATION_SUMMARY.md +201 -0
- package/lib/smart_contract/EXAMPLES.md +751 -0
- package/lib/smart_contract/QUICK_START.md +549 -0
- package/lib/smart_contract/README.md +395 -0
- package/lib/smart_contract/builder.js +452 -0
- package/lib/smart_contract/covenant.js +336 -0
- package/lib/smart_contract/covenant_builder.js +512 -0
- package/lib/smart_contract/index.js +311 -0
- package/lib/smart_contract/opcode_list.js +30 -0
- package/lib/smart_contract/opcode_map.js +1174 -0
- package/lib/smart_contract/opcodes.md +1173 -0
- package/lib/smart_contract/preimage.js +903 -0
- package/lib/smart_contract/script_tester.js +487 -0
- package/lib/smart_contract/script_utils.js +609 -0
- package/lib/smart_contract/sighash.js +310 -0
- package/lib/smart_contract/smartledger-opcode_review.md +70 -0
- package/lib/smart_contract/test_integration.js +269 -0
- package/lib/smart_contract/utxo_generator.js +367 -0
- package/package.json +43 -10
- package/utilities/blockchain-state.json +20478 -3
package/README.md
CHANGED
|
@@ -1,333 +1,289 @@
|
|
|
1
|
-
# SmartLedger
|
|
2
|
-
|
|
1
|
+
# SmartLedger-BSV
|
|
2
|
+
|
|
3
|
+
**Advanced Bitcoin SV Library with Enterprise Covenant Framework**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@smartledger/bsv)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://bitcoinsv.com/)
|
|
8
|
+
[](#covenant-framework)
|
|
9
|
+
|
|
10
|
+
SmartLedger-BSV is a comprehensive Bitcoin SV library that provides both high-level abstractions and granular control for advanced blockchain development. Built on the foundation of BSV library with enhanced covenant capabilities, custom script framework, and enterprise-grade features.
|
|
11
|
+
|
|
12
|
+
## 🚀 Key Features
|
|
13
|
+
|
|
14
|
+
### Core Library
|
|
15
|
+
- ✅ **Complete BSV API**: Full compatibility with BSV blockchain operations
|
|
16
|
+
- ✅ **Ultra-Low Fees**: 0.01 sats/byte configuration (91% fee reduction)
|
|
17
|
+
- ✅ **UTXO Management**: Advanced state management with change output handling
|
|
18
|
+
- ✅ **CDN Distribution**: Multiple webpack bundles for web development
|
|
19
|
+
- ✅ **NPM Ready**: Published as `smartledger-bsv` and `@smartledger/bsv`
|
|
20
|
+
|
|
21
|
+
### Advanced Covenant Framework
|
|
22
|
+
- 🔒 **BIP143 Compliant**: Complete preimage parsing with field-by-field access
|
|
23
|
+
- 🔒 **PUSHTX Integration**: nChain WP1605 in-script signature generation
|
|
24
|
+
- 🔒 **PELS Support**: Perpetually Enforcing Locking Scripts
|
|
25
|
+
- 🔒 **JavaScript-to-Script**: Write covenant logic in JavaScript, get Bitcoin Script ASM
|
|
26
|
+
- 🔒 **Complete Opcode Mapping**: All 121 Bitcoin Script opcodes with JavaScript equivalents
|
|
27
|
+
- 🔒 **Covenant Builder**: High-level API for rapid covenant development
|
|
28
|
+
- 🔒 **Script Simulation**: Real-time debugging with stack visualization
|
|
29
|
+
- 🔒 **Template Patterns**: Pre-built covenant templates for common use cases
|
|
30
|
+
- 🔒 **Dual-Level API**: High-level abstractions + granular BSV control
|
|
31
|
+
- 🔒 **Production Ready**: Comprehensive validation and error handling
|
|
32
|
+
|
|
33
|
+
### Custom Script Development
|
|
34
|
+
- 🛠️ **Multi-signature Scripts**: Advanced m-of-n signature schemes
|
|
35
|
+
- 🛠️ **Timelock Contracts**: Block height and timestamp constraints
|
|
36
|
+
- 🛠️ **Conditional Logic**: Complex branching and validation rules
|
|
37
|
+
- 🛠️ **Template System**: Pre-built patterns for common use cases
|
|
38
|
+
- 🛠️ **Developer API**: Simplified interface for rapid development
|
|
39
|
+
|
|
40
|
+
## � Table of Contents
|
|
41
|
+
|
|
42
|
+
- [Quick Start](#quick-start)
|
|
43
|
+
- [Installation](#installation)
|
|
44
|
+
- [Basic Usage](#basic-usage)
|
|
45
|
+
- [Covenant Framework](#covenant-framework)
|
|
46
|
+
- [Custom Scripts](#custom-scripts)
|
|
47
|
+
- [Examples](#examples)
|
|
48
|
+
- [Documentation](#documentation)
|
|
49
|
+
- [API Reference](#api-reference)
|
|
50
|
+
- [Contributing](#contributing)
|
|
51
|
+
- [License](#license)
|
|
52
|
+
|
|
53
|
+
## ⚡ Quick Start
|
|
3
54
|
|
|
4
|
-
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[]()
|
|
7
|
-
[]()
|
|
8
|
-
[]()
|
|
9
|
-
|
|
10
|
-
A **complete drop-in replacement** for BSV@1.5.6 with critical security vulnerabilities resolved. This library eliminates npm security warnings while maintaining 100% API compatibility with the original BSV library.
|
|
55
|
+
```
|
|
11
56
|
|
|
12
|
-
##
|
|
57
|
+
## 📦 Installation
|
|
13
58
|
|
|
59
|
+
### NPM Installation
|
|
14
60
|
```bash
|
|
61
|
+
# Main package
|
|
62
|
+
npm install @smartledger/bsv
|
|
63
|
+
|
|
64
|
+
# Alternative package name
|
|
15
65
|
npm install smartledger-bsv
|
|
16
66
|
```
|
|
17
67
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
68
|
+
### CDN Usage
|
|
69
|
+
```html
|
|
70
|
+
<!-- Main library -->
|
|
71
|
+
<script src="https://unpkg.com/@smartledger/bsv@latest/dist/bsv.bundle.js"></script>
|
|
21
72
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const signature = message.sign(privateKey);
|
|
25
|
-
```
|
|
73
|
+
<!-- Minified version -->
|
|
74
|
+
<script src="https://unpkg.com/@smartledger/bsv@latest/dist/bsv.min.js"></script>
|
|
26
75
|
|
|
27
|
-
|
|
76
|
+
<!-- Specialized modules -->
|
|
77
|
+
<script src="https://unpkg.com/@smartledger/bsv@latest/dist/bsv-ecies.min.js"></script>
|
|
78
|
+
<script src="https://unpkg.com/@smartledger/bsv@latest/dist/bsv-message.min.js"></script>
|
|
79
|
+
<script src="https://unpkg.com/@smartledger/bsv@latest/dist/bsv-mnemonic.min.js"></script>
|
|
80
|
+
```
|
|
28
81
|
|
|
29
|
-
|
|
30
|
-
- **Elliptic Curve Vulnerability**: Updated from `elliptic@6.5.4` to `elliptic@6.6.1`
|
|
31
|
-
- **Zero Parameter Attack Protection**: Rejects malicious signatures with r=0 or s=0
|
|
32
|
-
- **Signature Malleability Prevention**: Enforces canonical signatures (s ≤ n/2)
|
|
33
|
-
- **Range Validation**: Validates elliptic curve parameters within proper bounds
|
|
82
|
+
## 🔨 Basic Usage
|
|
34
83
|
|
|
35
|
-
###
|
|
84
|
+
### Creating Transactions
|
|
36
85
|
```javascript
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
86
|
+
const bsv = require('@smartledger/bsv');
|
|
87
|
+
|
|
88
|
+
// Create transaction with optimized fees
|
|
89
|
+
const transaction = new bsv.Transaction()
|
|
90
|
+
.from({
|
|
91
|
+
txId: 'prev_tx_id',
|
|
92
|
+
outputIndex: 0,
|
|
93
|
+
script: 'prev_locking_script',
|
|
94
|
+
satoshis: 100000
|
|
95
|
+
})
|
|
96
|
+
.to('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa', 95000)
|
|
97
|
+
.feePerKb(10) // Ultra-low fee: 0.01 sats/byte
|
|
98
|
+
.sign(privateKey);
|
|
42
99
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
console.log(signature.isCanonical()); // true/false
|
|
46
|
-
console.log(signature.validate()); // comprehensive validation
|
|
100
|
+
console.log('Transaction ID:', transaction.id);
|
|
101
|
+
console.log('Fee rate: 0.01 sats/byte (91% reduction)');
|
|
47
102
|
```
|
|
48
103
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
#### unpkg CDN
|
|
66
|
-
```html
|
|
67
|
-
<!-- Security-hardened BSV library -->
|
|
68
|
-
<script src="https://unpkg.com/smartledger-bsv@3.0.0/bsv.min.js"></script>
|
|
69
|
-
|
|
70
|
-
<!-- Optional modules -->
|
|
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>
|
|
104
|
+
### UTXO Management
|
|
105
|
+
```javascript
|
|
106
|
+
// Advanced UTXO state management
|
|
107
|
+
const utxoManager = {
|
|
108
|
+
createWithChange: (inputs, outputs, changeAddress) => {
|
|
109
|
+
const tx = new bsv.Transaction()
|
|
110
|
+
.from(inputs)
|
|
111
|
+
.to(outputs.address, outputs.amount)
|
|
112
|
+
.change(changeAddress)
|
|
113
|
+
.feePerKb(10);
|
|
114
|
+
|
|
115
|
+
// Automatic change output creation and UTXO state update
|
|
116
|
+
return tx;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
77
119
|
```
|
|
78
120
|
|
|
79
|
-
|
|
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
|
-
```
|
|
121
|
+
## 🔒 Covenant Framework
|
|
85
122
|
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
123
|
+
### JavaScript-to-Bitcoin Script Translation
|
|
124
|
+
```javascript
|
|
125
|
+
const { CovenantBuilder, CovenantTemplates } = require('@smartledger/bsv/lib/smart_contract');
|
|
126
|
+
|
|
127
|
+
// Write covenant logic in JavaScript
|
|
128
|
+
const valueLock = CovenantTemplates.valueLock('50c3000000000000');
|
|
129
|
+
const script = valueLock.build();
|
|
130
|
+
console.log(script.cleanedASM);
|
|
131
|
+
// Output: OP_SIZE 34 OP_SUB OP_SPLIT OP_DROP OP_8 OP_SPLIT OP_DROP 50c3000000000000 OP_EQUALVERIFY OP_1
|
|
132
|
+
|
|
133
|
+
// Custom covenant builder
|
|
134
|
+
const custom = new CovenantBuilder()
|
|
135
|
+
.comment('Validate preimage value field')
|
|
136
|
+
.extractField('value')
|
|
137
|
+
.push('50c3000000000000')
|
|
138
|
+
.equalVerify()
|
|
139
|
+
.push(1);
|
|
94
140
|
```
|
|
95
141
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
### Compatibility Testing ✅
|
|
99
|
-
- **All 41 Original Tests**: Pass with 100% compatibility
|
|
100
|
-
- **Browser Validation**: 14/14 security tests passing
|
|
101
|
-
- **Node.js Validation**: Complete API compatibility verified
|
|
102
|
-
- **Performance Impact**: <1% overhead from security enhancements
|
|
103
|
-
|
|
104
|
-
### Security Validation ✅
|
|
105
|
-
- Zero parameter attack protection active
|
|
106
|
-
- Canonical signature enforcement working
|
|
107
|
-
- Range validation implemented
|
|
108
|
-
- Browser/Node.js cross-compatibility confirmed
|
|
109
|
-
|
|
110
|
-
## 🔄 Migration Guide
|
|
111
|
-
|
|
112
|
-
**Zero changes required** - this is a true drop-in replacement:
|
|
113
|
-
|
|
142
|
+
### Complete Opcode Mapping (121 Opcodes)
|
|
114
143
|
```javascript
|
|
115
|
-
|
|
116
|
-
const bsv = require('bsv');
|
|
144
|
+
const SmartContract = require('@smartledger/bsv/lib/smart_contract');
|
|
117
145
|
|
|
118
|
-
//
|
|
119
|
-
const
|
|
146
|
+
// Simulate script execution in JavaScript
|
|
147
|
+
const result = SmartContract.simulateScript(['OP_1', 'OP_2', 'OP_ADD', 'OP_3', 'OP_EQUAL']);
|
|
148
|
+
console.log(result.finalStack); // ['01'] - TRUE
|
|
120
149
|
|
|
121
|
-
//
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
.to(address, amount)
|
|
125
|
-
.sign(privateKey);
|
|
150
|
+
// Get comprehensive opcode information
|
|
151
|
+
const opcodes = SmartContract.getOpcodeMap();
|
|
152
|
+
console.log(Object.keys(opcodes).length); // 121 opcodes mapped
|
|
126
153
|
```
|
|
127
154
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
155
|
+
### BIP143 Preimage Parsing
|
|
156
|
+
```javascript
|
|
157
|
+
const { CovenantPreimage } = require('@smartledger/bsv/lib/covenant-interface');
|
|
131
158
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
- [TypeScript Definitions](./bsv.d.ts)
|
|
159
|
+
// Enhanced preimage parsing with field-by-field access
|
|
160
|
+
const preimage = new CovenantPreimage(preimageHex);
|
|
135
161
|
|
|
136
|
-
|
|
162
|
+
console.log('Version:', preimage.nVersionValue); // uint32 accessor
|
|
163
|
+
console.log('Amount:', preimage.amountValue); // BigInt accessor
|
|
164
|
+
console.log('Valid structure:', preimage.isValid); // Boolean validation
|
|
165
|
+
```
|
|
137
166
|
|
|
167
|
+
### PUSHTX Covenants (nChain WP1605)
|
|
138
168
|
```javascript
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
169
|
+
const { CovenantInterface } = require('@smartledger/bsv/lib/covenant-interface');
|
|
170
|
+
const covenant = new CovenantInterface();
|
|
171
|
+
|
|
172
|
+
// Create PUSHTX covenant with in-script signature generation
|
|
173
|
+
const pushtxCovenant = covenant.createAdvancedCovenant('pushtx', {
|
|
174
|
+
publicKey: '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
|
|
175
|
+
enforceOutputs: true,
|
|
176
|
+
sighashType: 0x41
|
|
177
|
+
});
|
|
178
|
+
```
|
|
146
179
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
180
|
+
### Perpetually Enforcing Locking Scripts (PELS)
|
|
181
|
+
```javascript
|
|
182
|
+
// Create perpetual covenant that enforces rules across all future transactions
|
|
183
|
+
const pels = covenant.createAdvancedCovenant('perpetual', {
|
|
184
|
+
publicKeyHash: '751e76e8199196d454941c45d1b3a323f1433bd6',
|
|
185
|
+
feeDeduction: 512,
|
|
186
|
+
enforceScript: true,
|
|
187
|
+
enforceValue: true
|
|
188
|
+
});
|
|
150
189
|
```
|
|
151
190
|
|
|
152
|
-
##
|
|
191
|
+
## 🛠️ Custom Scripts
|
|
153
192
|
|
|
154
|
-
|
|
193
|
+
### Multi-signature Scripts
|
|
194
|
+
```javascript
|
|
195
|
+
const { CustomScriptHelper } = require('@smartledger/bsv/lib/custom-script-helper');
|
|
196
|
+
const helper = new CustomScriptHelper();
|
|
155
197
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<!-- Using unpkg CDN -->
|
|
161
|
-
<script src="https://unpkg.com/smartledger-bsv@3.0.0/bsv.min.js"></script>
|
|
162
|
-
</head>
|
|
163
|
-
<body>
|
|
164
|
-
<script>
|
|
165
|
-
// Works in all modern browsers
|
|
166
|
-
const privateKey = new bsv.PrivateKey();
|
|
167
|
-
const address = privateKey.toAddress().toString();
|
|
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);
|
|
173
|
-
</script>
|
|
174
|
-
</body>
|
|
175
|
-
</html>
|
|
198
|
+
// Create 2-of-3 multisig script
|
|
199
|
+
const multisigScript = helper.createMultisigScript([
|
|
200
|
+
publicKey1, publicKey2, publicKey3
|
|
201
|
+
], 2);
|
|
176
202
|
```
|
|
177
203
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
# Build all minified files
|
|
188
|
-
NODE_OPTIONS="--openssl-legacy-provider" npm run build-bsv
|
|
189
|
-
NODE_OPTIONS="--openssl-legacy-provider" npm run build-message
|
|
190
|
-
NODE_OPTIONS="--openssl-legacy-provider" npm run build-mnemonic
|
|
191
|
-
NODE_OPTIONS="--openssl-legacy-provider" npm run build-ecies
|
|
204
|
+
### Timelock Contracts
|
|
205
|
+
```javascript
|
|
206
|
+
// Create timelock script (block height)
|
|
207
|
+
const timelockScript = helper.createTimelockScript(
|
|
208
|
+
publicKey,
|
|
209
|
+
750000, // block height
|
|
210
|
+
'block'
|
|
211
|
+
);
|
|
192
212
|
```
|
|
193
213
|
|
|
194
|
-
|
|
214
|
+
## � Examples
|
|
195
215
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
216
|
+
### Basic Examples
|
|
217
|
+
- **[Advanced Covenant Demo](advanced_covenant_demo.js)**: Complete covenant showcase
|
|
218
|
+
- **[Custom Script Tests](test/custom_script_signature_test.js)**: Script development examples
|
|
219
|
+
- **[Covenant Resolution](covenant_manual_signature_resolved.js)**: Working covenant patterns
|
|
199
220
|
|
|
200
|
-
|
|
201
|
-
|
|
221
|
+
### Documentation
|
|
222
|
+
- **[Advanced Covenant Development](ADVANCED_COVENANT_DEVELOPMENT.md)**: Complete BIP143 + PUSHTX guide
|
|
223
|
+
- **[Custom Script Development](CUSTOM_SCRIPT_DEVELOPMENT.md)**: Script creation patterns
|
|
224
|
+
- **[Covenant Development Resolved](COVENANT_DEVELOPMENT_RESOLVED.md)**: Problem solutions
|
|
202
225
|
|
|
203
|
-
|
|
204
|
-
npm run coverage
|
|
205
|
-
```
|
|
226
|
+
## 🔧 CDN Bundles
|
|
206
227
|
|
|
207
|
-
|
|
228
|
+
| Bundle | Size | Description |
|
|
229
|
+
|--------|------|-------------|
|
|
230
|
+
| `bsv.bundle.js` | 684KB | Complete library with all features |
|
|
231
|
+
| `bsv.min.js` | 364KB | Minified production version |
|
|
232
|
+
| `bsv-ecies.min.js` | 145KB | ECIES encryption only |
|
|
233
|
+
| `bsv-message.min.js` | 120KB | Message signing only |
|
|
234
|
+
| `bsv-mnemonic.min.js` | 98KB | Mnemonic handling only |
|
|
208
235
|
|
|
209
|
-
|
|
210
|
-
- **Before**: 1 critical, 2 high severity npm audit issues
|
|
211
|
-
- **After**: 0 vulnerabilities, clean security audit
|
|
212
|
-
- **Elliptic**: Updated to patched version 6.6.1
|
|
213
|
-
- **Dependencies**: All dependencies security-reviewed
|
|
236
|
+
## 🔐 Security
|
|
214
237
|
|
|
215
|
-
### Security Features
|
|
216
|
-
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
-
|
|
220
|
-
|
|
238
|
+
### Enhanced Security Features
|
|
239
|
+
- **Elliptic Curve Fix**: Updated to secure elliptic@6.6.1
|
|
240
|
+
- **Parameter Fixing**: Public key, ephemeral key, sighash flag validation
|
|
241
|
+
- **DER Canonicalization**: Transaction malleability prevention
|
|
242
|
+
- **Preimage Validation**: Complete BIP143 structure verification
|
|
243
|
+
|
|
244
|
+
## 📝 Changelog
|
|
245
|
+
|
|
246
|
+
### v3.2.0 - JavaScript-to-Bitcoin Script Framework
|
|
247
|
+
- ✅ Complete JavaScript-to-Bitcoin Script translation system
|
|
248
|
+
- ✅ 121 Bitcoin Script opcodes mapped to JavaScript functions
|
|
249
|
+
- ✅ High-level CovenantBuilder API for rapid development
|
|
250
|
+
- ✅ Real-time script simulation and debugging capabilities
|
|
251
|
+
- ✅ Template-based covenant patterns library
|
|
252
|
+
- ✅ Automatic ASM generation from JavaScript operations
|
|
253
|
+
- ✅ Enhanced documentation and comprehensive examples
|
|
254
|
+
|
|
255
|
+
### v3.1.1 - Advanced Covenant Framework
|
|
256
|
+
- ✅ Enhanced covenant interface with BIP143 + PUSHTX support
|
|
257
|
+
- ✅ Perpetually Enforcing Locking Scripts (PELS) implementation
|
|
258
|
+
- ✅ Transaction introspection with preimage analysis
|
|
259
|
+
- ✅ Comprehensive documentation and examples
|
|
260
|
+
|
|
261
|
+
### v3.0.2 - Custom Script Framework
|
|
262
|
+
- ✅ Complete custom script development API
|
|
263
|
+
- ✅ Multi-signature, timelock, and conditional script support
|
|
264
|
+
- ✅ Transaction signature API gap resolution
|
|
265
|
+
|
|
266
|
+
### v3.0.1 - Ultra-Low Fee System
|
|
267
|
+
- ✅ 0.01 sats/byte fee configuration (91% reduction)
|
|
268
|
+
- ✅ Advanced UTXO state management
|
|
269
|
+
- ✅ Change output optimization
|
|
221
270
|
|
|
222
271
|
## 📄 License
|
|
223
272
|
|
|
224
|
-
MIT License - see [LICENSE](
|
|
273
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
225
274
|
|
|
226
275
|
## 🤝 Contributing
|
|
227
276
|
|
|
228
|
-
|
|
277
|
+
We welcome contributions to SmartLedger-BSV! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
229
278
|
|
|
230
|
-
##
|
|
279
|
+
## 🏢 Enterprise Support
|
|
231
280
|
|
|
232
|
-
|
|
281
|
+
- **GitHub**: [github.com/codenlighten/smartledger-bsv](https://github.com/codenlighten/smartledger-bsv)
|
|
282
|
+
- **NPM**: [@smartledger/bsv](https://www.npmjs.com/package/@smartledger/bsv)
|
|
283
|
+
- **Issues**: [GitHub Issues](https://github.com/codenlighten/smartledger-bsv/issues)
|
|
233
284
|
|
|
234
285
|
---
|
|
235
286
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
[SmartLedger Technology](https://smartledger.technology) is committed to providing secure, professional-grade blockchain libraries. This BSV implementation represents our dedication to eliminating security vulnerabilities while maintaining complete compatibility with existing Bitcoin SV applications.
|
|
239
|
-
|
|
240
|
-
**Trusted by developers worldwide for secure Bitcoin SV applications.**
|
|
241
|
-
|
|
242
|
-
Visit us at [smartledger.technology](https://smartledger.technology)
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
## Original BSV Documentation
|
|
247
|
-
|
|
248
|
-
Javascript Bitcoin SV library.
|
|
249
|
-
|
|
250
|
-
Documentation is available on the [Money Button Documentation Page](https://docs.moneybutton.com/docs/bsv-overview.html).
|
|
251
|
-
|
|
252
|
-
Changelog
|
|
253
|
-
---------
|
|
254
|
-
**1.5.0**
|
|
255
|
-
* Add build files into repo.
|
|
256
|
-
|
|
257
|
-
**1.4.0**
|
|
258
|
-
* Change default fee to 0.5 sat/byte
|
|
259
|
-
|
|
260
|
-
**1.3.0**
|
|
261
|
-
* Remove limit on OP_RETURN size
|
|
262
|
-
|
|
263
|
-
**1.1.0**
|
|
264
|
-
* Refactor code related to buffers and get rid of bufferUtil
|
|
265
|
-
* Deprecate p2sh
|
|
266
|
-
* Add .Mnemonic to bsv object
|
|
267
|
-
|
|
268
|
-
**1.0.0**
|
|
269
|
-
* Bump to 1.0 release as per the suggestion of @mathiasrw
|
|
270
|
-
|
|
271
|
-
**0.30.2**
|
|
272
|
-
* Added addSafeData to Transaction.
|
|
273
|
-
|
|
274
|
-
**0.30.1**
|
|
275
|
-
* Enforce buffer check for Electrum ECIES decryption.
|
|
276
|
-
* Clean up script folder (no API breaking changes).
|
|
277
|
-
* Documentation improvements.
|
|
278
|
-
|
|
279
|
-
**0.30.0**
|
|
280
|
-
* Fix transaction size calculation.
|
|
281
|
-
|
|
282
|
-
**0.29.2**
|
|
283
|
-
* Throw error on invalid hex strings in script
|
|
284
|
-
|
|
285
|
-
**0.29.1**
|
|
286
|
-
* Add support for new OP_RETURN style: buildSafeDataOut and isSafeDataOut (and getData)
|
|
287
|
-
|
|
288
|
-
**0.27.2**
|
|
289
|
-
* Add support for Stress Test Network (STN).
|
|
290
|
-
|
|
291
|
-
**v0.27.1**
|
|
292
|
-
* Replace lodash methods with inline pure javascript methods.
|
|
293
|
-
|
|
294
|
-
**v0.27.0**
|
|
295
|
-
* Remove version guard. This should fix the "two versions of bsv" error that
|
|
296
|
-
people often get. Note that it is poor practice to use incompatible versions
|
|
297
|
-
of bsv. To send objects from one version of the library to another, always
|
|
298
|
-
serialize to a string or buffer first. Do not send objects from one version to
|
|
299
|
-
another. This due to frequent use of "instanceof" inside the library.
|
|
300
|
-
|
|
301
|
-
**v0.26.5**
|
|
302
|
-
* lodash optimization and overall size optimization of bsv.min.js
|
|
303
|
-
* fix isFinal
|
|
304
|
-
* fix non-dust amount example
|
|
305
|
-
* minor ECIES API issue
|
|
306
|
-
|
|
307
|
-
**v0.26.4**
|
|
308
|
-
* Use ECDSA.signWithCalcI(...) convenience method inside Message.
|
|
309
|
-
|
|
310
|
-
**v0.26.3**
|
|
311
|
-
* Add ECDSA.signWithCalcI(...) convenience method.
|
|
312
|
-
|
|
313
|
-
**v0.26.2**
|
|
314
|
-
* Add Mnemonic.fromString(string).
|
|
315
|
-
* Add convenience method for ECDSA.signRandomK (mostly for demo purposes).
|
|
316
|
-
* Add convenience methods Message.sign and message.verify.
|
|
317
|
-
* Move large portions of the documentation to [docs.moneybutton.com](https://docs.moneybutton.com).
|
|
318
|
-
|
|
319
|
-
**v0.26.1**
|
|
320
|
-
* Add .fromRandom() method for Mnemonic.
|
|
321
|
-
|
|
322
|
-
**v0.26.0**
|
|
323
|
-
* Remove the (already deprecated) .derive() method from HDPrivateKey and HDPublicKey. If you rely on this, please switch to .deriveNonCompliantChild(). If you do not already rely on this, you should use .deriveChild() instead.
|
|
324
|
-
* Move large portions of the documentation to [docs.moneybutton.com](https://docs.moneybutton.com).
|
|
325
|
-
* HDPrivateKey / HDPublicKey toHex() and fromHex()
|
|
326
|
-
* HDPrivateKey.fromRandom()
|
|
327
|
-
* Remove Base32 (this was only used for cashaddr and is now obsolete).
|
|
287
|
+
**SmartLedger-BSV v3.1.1** - *Advanced Bitcoin SV Library with Enterprise Covenant Framework*
|
|
328
288
|
|
|
329
|
-
|
|
330
|
-
* Remove support for cashaddr completely. This saves size in the bundle.
|
|
331
|
-
* Private key .toString() method now returns WIF, which makes it compatible with the corresponding .fromString(wif) method.
|
|
332
|
-
* Private key and public key classes now have toHex() and fromHex(hex) methods.
|
|
333
|
-
* Move large portions of the documentation to [docs.moneybutton.com](https://docs.moneybutton.com).
|
|
289
|
+
Built with ❤️ for the Bitcoin SV ecosystem
|