@bsv/sdk 1.9.3 → 1.9.4

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.
Files changed (60) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/docs/fast-docs.png +0 -0
  3. package/docs/index.md +49 -44
  4. package/docs/swagger.png +0 -0
  5. package/package.json +1 -1
  6. package/docs/MARKDOWN_VALIDATION_GUIDE.md +0 -175
  7. package/docs/concepts/beef.md +0 -92
  8. package/docs/concepts/chain-tracking.md +0 -134
  9. package/docs/concepts/decentralized-identity.md +0 -221
  10. package/docs/concepts/fees.md +0 -249
  11. package/docs/concepts/identity-certificates.md +0 -307
  12. package/docs/concepts/index.md +0 -77
  13. package/docs/concepts/key-management.md +0 -185
  14. package/docs/concepts/script-templates.md +0 -176
  15. package/docs/concepts/sdk-philosophy.md +0 -80
  16. package/docs/concepts/signatures.md +0 -194
  17. package/docs/concepts/spv-verification.md +0 -118
  18. package/docs/concepts/transaction-encoding.md +0 -167
  19. package/docs/concepts/transaction-structure.md +0 -67
  20. package/docs/concepts/trust-model.md +0 -139
  21. package/docs/concepts/verification.md +0 -250
  22. package/docs/concepts/wallet-integration.md +0 -101
  23. package/docs/guides/development-wallet-setup.md +0 -374
  24. package/docs/guides/direct-transaction-creation.md +0 -147
  25. package/docs/guides/http-client-configuration.md +0 -488
  26. package/docs/guides/index.md +0 -138
  27. package/docs/guides/large-transactions.md +0 -448
  28. package/docs/guides/multisig-transactions.md +0 -792
  29. package/docs/guides/security-best-practices.md +0 -494
  30. package/docs/guides/transaction-batching.md +0 -132
  31. package/docs/guides/transaction-signing-methods.md +0 -419
  32. package/docs/reference/arc-config.md +0 -698
  33. package/docs/reference/brc-100.md +0 -33
  34. package/docs/reference/configuration.md +0 -835
  35. package/docs/reference/debugging.md +0 -705
  36. package/docs/reference/errors.md +0 -597
  37. package/docs/reference/index.md +0 -111
  38. package/docs/reference/network-config.md +0 -914
  39. package/docs/reference/op-codes.md +0 -325
  40. package/docs/reference/transaction-signatures.md +0 -95
  41. package/docs/tutorials/advanced-transaction.md +0 -572
  42. package/docs/tutorials/aes-encryption.md +0 -949
  43. package/docs/tutorials/authfetch-tutorial.md +0 -986
  44. package/docs/tutorials/ecdh-key-exchange.md +0 -549
  45. package/docs/tutorials/elliptic-curve-fundamentals.md +0 -606
  46. package/docs/tutorials/error-handling.md +0 -1216
  47. package/docs/tutorials/first-transaction-low-level.md +0 -205
  48. package/docs/tutorials/first-transaction.md +0 -275
  49. package/docs/tutorials/hashes-and-hmacs.md +0 -788
  50. package/docs/tutorials/identity-management.md +0 -729
  51. package/docs/tutorials/index.md +0 -219
  52. package/docs/tutorials/key-management.md +0 -538
  53. package/docs/tutorials/protowallet-development.md +0 -743
  54. package/docs/tutorials/script-construction.md +0 -690
  55. package/docs/tutorials/spv-merkle-proofs.md +0 -685
  56. package/docs/tutorials/testnet-transactions-low-level.md +0 -359
  57. package/docs/tutorials/transaction-broadcasting.md +0 -538
  58. package/docs/tutorials/transaction-types.md +0 -420
  59. package/docs/tutorials/type-42.md +0 -568
  60. package/docs/tutorials/uhrp-storage.md +0 -599
@@ -1,538 +0,0 @@
1
- # Key Management and Cryptography
2
-
3
- **Duration**: 45 minutes
4
- **Prerequisites**: Completed "Your First BSV Transaction" tutorial, Node.js, basic TypeScript knowledge
5
-
6
- ## Learning Goals
7
-
8
- - Generate and manage private/public keys
9
- - Understand ECDSA signatures
10
- - Create and verify digital signatures
11
- - Apply secure key management practices
12
- - Use `WalletClient` for advanced key operations
13
-
14
- > **📚 Related Concepts**: Review [Key Management](../concepts/key-management.md), [Digital Signatures](../concepts/signatures.md), and [Trust Model](../concepts/trust-model.md) for essential background.
15
-
16
- ## Introduction
17
-
18
- Bitcoin is built on cryptographic principles, with keys and signatures forming the foundation of its security model. In this tutorial, you'll learn how to generate, manage, and use cryptographic keys with the BSV TypeScript SDK. You'll also learn how to create and verify digital signatures, which are essential for authorizing transactions and proving ownership.
19
-
20
- > **💡 Try It Interactive**: Experiment with key generation and cryptographic operations in our [Interactive BSV Coding Environment](https://fast.brc.dev/) - perfect for testing the concepts covered in this tutorial!
21
-
22
- ## Step 1: Setting Up Your Environment
23
-
24
- First, let's create a project for our key management exercises:
25
-
26
- ```bash
27
- # Create a new directory for the project
28
- mkdir bsv-key-management
29
- cd bsv-key-management
30
-
31
- # Initialize a new Node.js project
32
- npm init -y
33
-
34
- # Install TypeScript and ts-node
35
- npm install typescript ts-node @types/node --save-dev
36
-
37
- # Install the BSV SDK
38
- npm install @bsv/sdk
39
- ```
40
-
41
- Create a basic TypeScript configuration file (`tsconfig.json`):
42
-
43
- ```json
44
- {
45
- "compilerOptions": {
46
- "target": "es2022",
47
- "module": "commonjs",
48
- "esModuleInterop": true,
49
- "strict": true,
50
- "outDir": "./dist"
51
- }
52
- }
53
- ```
54
-
55
- ## Step 2: Understanding Bitcoin Keys
56
-
57
- Before diving into code, let's understand the key concepts:
58
-
59
- ### Key Hierarchy
60
-
61
- Bitcoin uses a hierarchical key system:
62
-
63
- - **Private Key**: A randomly generated number that must be kept secret
64
- - **Public Key**: Derived from the private key, can be shared safely
65
- - **Bitcoin Address**: Derived from the public key, used to receive funds
66
-
67
- ### Key Formats
68
-
69
- Private keys can be represented in several formats:
70
-
71
- - **Raw**: A 32-byte number
72
- - **WIF (Wallet Import Format)**: A Base58Check encoded string, making keys easier to handle
73
- - **Extended Keys**: Used in HD wallets (covered in advanced tutorials)
74
-
75
- Public keys can be represented as:
76
-
77
- - **Compressed**: 33 bytes (more efficient, preferred format)
78
- - **Uncompressed**: 65 bytes (legacy format)
79
-
80
- Addresses can be in various formats:
81
-
82
- - **P2PKH**: Standard "Pay to Public Key Hash" addresses
83
- - **P2SH**: "Pay to Script Hash" addresses for more complex scripts
84
- - **Others**: Various formats exist for specific use cases
85
-
86
- ## Step 3: Generating and Managing Keys
87
-
88
- Let's create a file called `key-management.ts` to experiment with key generation and management:
89
-
90
- ```typescript
91
- import { PrivateKey, PublicKey } from '@bsv/sdk'
92
-
93
- // Generate a new random private key
94
- function generateNewKey() {
95
- const privateKey = PrivateKey.fromRandom()
96
- const publicKey = privateKey.toPublicKey()
97
- const address = privateKey.toAddress()
98
-
99
- console.log('\n=== Newly Generated Key ===')
100
- console.log(`Private Key (WIF): ${privateKey.toWif()}`)
101
- console.log(`Public Key (DER Hex): ${publicKey.toDER('hex')}`)
102
- console.log(`Bitcoin Address: ${address.toString()}`)
103
-
104
- return privateKey
105
- }
106
-
107
- // Import an existing private key from WIF format
108
- function importFromWIF(wifString: string) {
109
- try {
110
- const privateKey = PrivateKey.fromWif(wifString)
111
- const publicKey = privateKey.toPublicKey()
112
- const address = privateKey.toAddress()
113
-
114
- console.log('\n=== Imported Key ===')
115
- console.log(`Private Key (WIF): ${privateKey.toWif()}`)
116
- console.log(`Public Key (DER Hex): ${publicKey.toDER('hex')}`)
117
- console.log(`Bitcoin Address: ${address.toString()}`)
118
-
119
- return privateKey
120
- } catch (error) {
121
- console.error('Error importing key:', error)
122
- return null
123
- }
124
- }
125
-
126
- // Derive different address types from a private key
127
- function deriveAddressTypes(privateKey: PrivateKey) {
128
- // Standard P2PKH mainnet address (prefix 0x00)
129
- const mainnetAddress = privateKey.toAddress()
130
-
131
- console.log('\n=== Bitcoin Address Types ===')
132
- console.log(`Mainnet Address: ${mainnetAddress.toString()}`)
133
-
134
- // Get the public key and hash it to show the process
135
- const publicKey = privateKey.toPublicKey()
136
- // For P2PKH addresses, we use HASH160 (RIPEMD160(SHA256(pubKey)))
137
- const pubKeyHash = publicKey.toHash()
138
- console.log(`Public Key Hash: ${Buffer.from(pubKeyHash).toString('hex')}`)
139
-
140
- return mainnetAddress
141
- }
142
-
143
- // Advanced: Check if a public key corresponds to a private key
144
- function verifyKeyPair(privateKey: PrivateKey, publicKeyHex: string) {
145
- // Convert the provided public key hex to a PublicKey object
146
- // The toDER('hex') method provides a hex string that can be parsed by fromString
147
- const providedPubKey = PublicKey.fromString(publicKeyHex)
148
-
149
- // Derive the public key from the private key
150
- const derivedPubKey = privateKey.toPublicKey()
151
-
152
- // Compare the hex representations
153
- // Make sure we cast to string to ensure proper comparison
154
- const isMatch = (providedPubKey.toDER('hex') as string) === (derivedPubKey.toDER('hex') as string)
155
-
156
- console.log('\n=== Key Pair Verification ===')
157
- console.log(`Public keys match: ${isMatch}`)
158
-
159
- return isMatch
160
- }
161
-
162
- // Execute our key management examples
163
- async function runKeyManagementExamples() {
164
- // Generate a new key
165
- const newKey = generateNewKey()
166
-
167
- // Derive different address types from the key
168
- deriveAddressTypes(newKey)
169
-
170
- // Import a key from WIF (using the one we just generated as an example)
171
- const wif = newKey.toWif()
172
- const importedKey = importFromWIF(wif)
173
-
174
- if (importedKey) {
175
- // Verify the key pair
176
- // Make sure we're using a string type for the public key hex
177
- const pubKeyHex = newKey.toPublicKey().toDER('hex') as string
178
- verifyKeyPair(importedKey, pubKeyHex)
179
- }
180
-
181
- console.log('\n=== Key Management Demo Complete ===')
182
- }
183
-
184
- // Run our examples
185
- runKeyManagementExamples().catch(console.error)
186
- ```
187
-
188
- Run the script with:
189
-
190
- ```bash
191
- npx ts-node key-management.ts
192
- ```
193
-
194
- You should see output showing the generated keys, addresses, and verification results.
195
-
196
- ## Step 4: Creating and Verifying Digital Signatures
197
-
198
- Digital signatures are fundamental to Bitcoin. They prove that the owner of a private key has authorized a specific action, like spending coins in a transaction.
199
-
200
- ### Approach 1: Using `WalletClient`
201
-
202
- `WalletClient` is the recommended interface for these actions, providing enhanced security as private keys remain isolated within the wallet environment. Let's create a file called `signatures-wallet.ts`:
203
-
204
- ```typescript
205
- import { WalletClient } from '@bsv/sdk'
206
-
207
- async function signatureWalletExamples() {
208
- // Initialize a WalletClient with default settings
209
- const wallet = new WalletClient('auto', 'localhost')
210
-
211
- console.log('\n=== WalletClient Signature Example ===')
212
-
213
- try {
214
- // Connect to the wallet substrate
215
- await wallet.connectToSubstrate()
216
-
217
- // 1. Define protocol and key identifiers for wallet operations
218
- // In a real app, these would be specific to your application
219
- // Using 1 to represent medium security level
220
- // Using 'any' type to bypass type checking since we don't have access to the SecurityLevel enum values
221
- const protocolID = [1, 'bsv tutorial'] as any
222
- const keyID = 'tutorial signing key'
223
-
224
- // 2. Get a public key from the wallet for verification (for demo purposes)
225
- const keyResult = await wallet.getPublicKey({
226
- protocolID,
227
- keyID,
228
- counterparty: 'self' // Get our own public key
229
- })
230
-
231
- console.log(`Public Key from Wallet: ${keyResult.publicKey}`)
232
-
233
- // 3. Create a message to sign
234
- const message = 'Hello, Bitcoin SV!'
235
- console.log(`\nMessage to sign: "${message}"`)
236
- const messageBytes = new TextEncoder().encode(message)
237
-
238
- // 4. Create a signature using WalletClient
239
- console.log('\nCreating signature with parameters:')
240
- console.log('- Protocol ID:', JSON.stringify(protocolID))
241
- console.log('- Key ID:', keyID)
242
- console.log('- Message bytes:', JSON.stringify(Array.from(messageBytes)))
243
-
244
- // When creating signatures with counterparty='self', we must explicitly set it
245
- // This ensures we can verify the signature with the default parameters
246
- const sigResult = await wallet.createSignature({
247
- data: Array.from(messageBytes),
248
- protocolID,
249
- keyID,
250
- counterparty: 'self' // Explicitly use 'self' as counterparty, as the default counterparty is 'anyone' (implicit)
251
- })
252
-
253
- console.log(`\nSignature created with WalletClient: ${Buffer.from(sigResult.signature).toString('hex').substring(0, 64)}...`)
254
-
255
- // 5. Verify the signature using WalletClient
256
- // Note: WalletClient throws an error when verification fails
257
- try {
258
- console.log('\nVerifying signature with parameters:')
259
- console.log('- Protocol ID:', JSON.stringify(protocolID))
260
- console.log('- Key ID:', keyID)
261
- console.log('- Message bytes:', JSON.stringify(Array.from(messageBytes)))
262
-
263
- // When verifying signatures, the default counterparty is 'self'
264
- // Since we created the signature with counterparty='self', we can use the default
265
- const verifyResult = await wallet.verifySignature({
266
- data: Array.from(messageBytes),
267
- signature: sigResult.signature,
268
- protocolID,
269
- keyID
270
- // Using default counterparty: 'self' (implicit)
271
- // counterparty: ourPublicKey
272
- })
273
-
274
- console.log(`\nSignature verification result: ${verifyResult.valid ? 'Valid ✓' : 'Invalid ✗'}`)
275
- } catch (error) {
276
- // The wallet throws an error when verification fails instead of returning { valid: false }
277
- console.log('\nSignature verification result: Invalid ✗')
278
- console.log(`Verification error: ${error instanceof Error ? error.message : 'Unknown error'}`)
279
- }
280
-
281
- // 6. Try verifying with tampered data
282
- const tamperedMessage = 'Hello, Bitcoin SV! [tampered]'
283
- const tamperedBytes = new TextEncoder().encode(tamperedMessage)
284
-
285
- try {
286
- // For tampered message verification, we use the same parameters
287
- const tamperedVerifyResult = await wallet.verifySignature({
288
- data: Array.from(tamperedBytes),
289
- signature: sigResult.signature,
290
- protocolID,
291
- keyID
292
- // Using default counterparty: 'self' (implicit)
293
- // counterparty: ourPublicKey
294
- })
295
-
296
- console.log(`\nTampered message verification: ${tamperedVerifyResult.valid ? 'Valid ✓' : 'Invalid ✗'}`)
297
- } catch (error) {
298
- // Expected behavior: verification should fail with tampered data
299
- console.log('\nTampered message verification: Invalid ✗')
300
- console.log('This is the expected behavior - tampered data should fail verification')
301
- }
302
-
303
- } catch (error) {
304
- console.error('\nError during WalletClient operations:', error)
305
- console.log('Note: To use WalletClient, you need a compatible wallet connection.')
306
- }
307
- }
308
-
309
- // Run our wallet signature examples
310
- signatureWalletExamples().catch(console.error)
311
- ```
312
-
313
- Run the example:
314
-
315
- ```bash
316
- npx ts-node signatures-wallet.ts
317
- ```
318
-
319
- ### Approach 2: Using Low-level Cryptography APIs
320
-
321
- Alternatively, you could perform the same using direct cryptography APIs. Let's create a file called `signatures-low-level.ts`:
322
-
323
- ```typescript
324
- import { PrivateKey, PublicKey, Signature } from '@bsv/sdk'
325
-
326
- async function signatureLowLevelExamples() {
327
- // Generate a key to use for signing
328
- const privateKey = PrivateKey.fromRandom()
329
- const publicKey = privateKey.toPublicKey()
330
-
331
- console.log('\n=== Key for Signing (Low-level API) ===')
332
- console.log(`Private Key (WIF): ${privateKey.toWif()}`)
333
- console.log(`Public Key (DER Hex): ${publicKey.toDER('hex')}`)
334
-
335
- // 1. Create a message to sign
336
- const message = 'Hello, Bitcoin SV!'
337
- console.log(`\nMessage to sign: "${message}"`)
338
-
339
- // 2. Sign the message - using the message string directly
340
- const signature = await privateKey.sign(message)
341
-
342
- // Get the signature in DER format (hex string)
343
- const derSignatureHex = signature.toDER('hex') as string
344
- console.log(`\nSignature (DER format): ${derSignatureHex}`)
345
-
346
- // 3. Verify the signature using the public key
347
- const isValid = await publicKey.verify(message, signature)
348
- console.log(`\nSignature verification result: ${isValid ? 'Valid ✓' : 'Invalid ✗'}`)
349
-
350
- // 4. Try verifying with a modified message (should fail)
351
- const tamperedMessage = message + ' [tampered]'
352
- const isTamperedValid = await publicKey.verify(tamperedMessage, signature)
353
- console.log(`\nTampered message verification: ${isTamperedValid ? 'Valid ✓' : 'Invalid ✗'}`)
354
-
355
- // 5. Try verifying with a different public key (should fail)
356
- const differentKey = PrivateKey.fromRandom().toPublicKey()
357
- const isDifferentKeyValid = await differentKey.verify(message, signature)
358
- console.log(`\nWrong key verification: ${isDifferentKeyValid ? 'Valid ✓' : 'Invalid ✗'}`)
359
-
360
- // 6. Importing a signature from DER format (as number array)
361
- const derSignature = signature.toDER() as number[]
362
- const importedSignature = Signature.fromDER(derSignature)
363
- const isImportedValid = await publicKey.verify(message, importedSignature)
364
- console.log(`\nImported signature verification: ${isImportedValid ? 'Valid ✓' : 'Invalid ✗'}`)
365
- }
366
-
367
- // Run our signature examples
368
- signatureLowLevelExamples().catch(console.error)
369
- ```
370
-
371
- Run the script:
372
-
373
- ```bash
374
- npx ts-node signatures-low-level.ts
375
- ```
376
-
377
- ### Key Benefits of `WalletClient` for Signatures
378
-
379
- 1. **Enhanced Security**: Private keys never leave the wallet environment
380
- 2. **Key Management**: No need to handle raw private keys in your code
381
- 3. **Standardized API**: Consistent interface for all cryptographic operations
382
- 4. **Protocol-based**: Keys are managed within specific protocol contexts
383
-
384
- ## Step 5: Practical Application: Signing Transactions with `WalletClient`
385
-
386
- Let's put our knowledge to practical use by creating and signing a Bitcoin transaction using the `WalletClient`.
387
-
388
- Create a file called `wallet-transaction-signing.ts`:
389
-
390
- ```typescript
391
- import { WalletClient, Transaction } from '@bsv/sdk'
392
-
393
- async function walletTransactionDemo() {
394
- console.log('\n=== Transaction Signing with WalletClient ===')
395
-
396
- try {
397
- // 1. WalletClient Key Management
398
- // Note: This tutorial requires a BSV wallet to be installed and available
399
- // If you get connection errors, you may need to install a compatible BSV wallet
400
- const wallet = new WalletClient('auto', 'localhost')
401
-
402
- console.log('\n1. WalletClient Key Management')
403
-
404
- // Define protocol and key identifiers for wallet operations
405
- // Use 1 to represent medium security level
406
- // Cast it to any to bypass strict type checking since we don't have the SecurityLevel enum
407
- const protocolID = [1, 'example'] as any
408
- const keyID = 'transaction-signing-key'
409
-
410
- console.log(`Protocol ID: ${protocolID[0]}-${protocolID[1]}`)
411
- console.log(`Key ID: ${keyID}`)
412
-
413
- // Get a public key from the wallet
414
- // In a real application, this would be a key securely managed by the wallet
415
- const publicKeyResult = await wallet.getPublicKey({ protocolID, keyID })
416
- const publicKeyHex = publicKeyResult.publicKey
417
- console.log(`Public Key: ${publicKeyHex}`)
418
-
419
- // 2. Creating a transaction with WalletClient
420
- console.log('\n2. Creating a transaction with WalletClient')
421
-
422
- // Set up payment details
423
- const recipientAddress = '1DBz6V6CmvjZTvfjvJpfnrBk9Lf8fJ8dW8' // Example recipient
424
- const amountSatoshis = 100
425
-
426
- // Create a payment action using WalletClient
427
- // This builds a complete transaction structure internally
428
- const actionResult = await wallet.createAction({
429
- description: `Payment to ${recipientAddress}`,
430
- // Define outputs for the transaction
431
- outputs: [
432
- {
433
- // In a real application, you would create a proper P2PKH script for the recipient
434
- lockingScript: '76a914eb0bd5edba389198e73f8efabddfc61666969ff788ac', // Example P2PKH script
435
- satoshis: amountSatoshis,
436
- outputDescription: `Payment to ${recipientAddress}`
437
- }
438
- ],
439
- // Set options to ensure we get a signable transaction
440
- options: {
441
- signAndProcess: false // This ensures we get a signable transaction back
442
- }
443
- })
444
-
445
- console.log('Payment action created:')
446
- if (actionResult.signableTransaction) {
447
- console.log(`- Action Reference: ${actionResult.signableTransaction.reference}`)
448
- console.log(`- Transaction available: ${!!actionResult.signableTransaction.tx}`)
449
- } else {
450
- console.log('No signable transaction returned - check wallet configuration')
451
- return
452
- }
453
- console.log(`- Description: Payment to ${recipientAddress}`)
454
- console.log(`- Amount: ${amountSatoshis} satoshis`)
455
-
456
- // 3. Sign the transaction with WalletClient
457
- console.log('\n3. Signing transaction with WalletClient')
458
-
459
- // Request wallet to sign the action/transaction
460
- const signResult = await wallet.signAction({
461
- // Use the reference from the createAction result
462
- reference: actionResult.signableTransaction.reference,
463
- // For wallet-managed transactions, we can let the wallet handle unlocking scripts
464
- spends: {},
465
- // Add options to ensure proper handling
466
- options: {
467
- acceptDelayedBroadcast: true,
468
- returnTXIDOnly: false,
469
- noSend: true // Don't broadcast automatically for this tutorial
470
- }
471
- })
472
-
473
- console.log('Transaction signed successfully!')
474
- if (signResult.txid) {
475
- console.log(`Transaction ID: ${signResult.txid}`)
476
- }
477
-
478
- // 4. Examine the transaction
479
- console.log('\n4. Examining the transaction')
480
-
481
- // Check if we have a transaction ID from the sign result
482
- if (signResult.txid) {
483
- console.log(`Transaction ID: ${signResult.txid}`)
484
- console.log('Transaction was successfully signed!')
485
- } else {
486
- console.log('No transaction ID available - transaction may not have been completed')
487
- }
488
-
489
- } catch (error) {
490
- console.error('Error during wallet transaction operations:', error)
491
- }
492
- }
493
-
494
- // Run the demo
495
- walletTransactionDemo().catch(console.error)
496
- ```
497
-
498
- Run the script:
499
-
500
- ```bash
501
- npx ts-node wallet-transaction-signing.ts
502
- ```
503
-
504
- This example demonstrates:
505
-
506
- 1. Creating a transaction with inputs and outputs
507
- 2. Getting the transaction hash that needs to be signed
508
- 3. How the `WalletClient` would sign this hash securely
509
- 4. Verifying the transaction signature
510
- 5. The complete `WalletClient` workflow for real applications
511
-
512
- For a detailed comparison between `WalletClient` transaction signing and low-level transaction signing approaches, see the [Transaction Signing Methods guide](../guides/transaction-signing-methods.md).
513
-
514
- ### Advanced Transaction Signing
515
-
516
- For more advanced transaction signing techniques like using different SIGHASH flags, manual signature creation, and multi-signature transactions, please refer to the [Advanced Transaction Signing guide](../guides/advanced-transaction-signing.md).
517
-
518
- ## Conclusion
519
-
520
- Congratulations! You've learned the fundamentals of key management and cryptography with the BSV TypeScript SDK. In this tutorial, you've:
521
-
522
- - Generated and managed private/public keys
523
- - Created and verified digital signatures using both direct cryptography APIs and `WalletClient`
524
- - Applied signatures in a Bitcoin transaction context using `WalletClient`
525
- - Learned best practices for secure key management
526
-
527
- These cryptographic concepts form the foundation of Bitcoin and blockchain technology. By understanding how keys and signatures work, you're well-equipped to build secure and robust applications using the BSV TypeScript SDK.
528
-
529
- For more advanced techniques like different signature hash types (SIGHASH flags), manual signature creation, and multi-signature transactions, refer to the following documents:
530
-
531
- - [Advanced Transaction Signing](../guides/advanced-transaction-signing.md) (How-To Guide)
532
- - [Transaction Signatures Reference](../reference/transaction-signatures.md) (Technical Reference)
533
-
534
- ## Next Steps
535
-
536
- - Learn about [Transaction Broadcasting and ARC](./transaction-broadcasting.md)
537
- - Explore [Advanced Transaction Construction](./advanced-transaction.md)
538
- - Dive deeper into [Script Construction and Custom Logic](./script-construction.md)