@bsv/sdk 1.9.2 → 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.
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/kvstore/GlobalKVStore.js +116 -98
- package/dist/cjs/src/kvstore/GlobalKVStore.js.map +1 -1
- package/dist/cjs/src/kvstore/types.js.map +1 -1
- package/dist/cjs/src/overlay-tools/index.js +1 -0
- package/dist/cjs/src/overlay-tools/index.js.map +1 -1
- package/dist/cjs/src/overlay-tools/withDoubleSpendRetry.js +55 -0
- package/dist/cjs/src/overlay-tools/withDoubleSpendRetry.js.map +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/kvstore/GlobalKVStore.js +117 -99
- package/dist/esm/src/kvstore/GlobalKVStore.js.map +1 -1
- package/dist/esm/src/kvstore/types.js.map +1 -1
- package/dist/esm/src/overlay-tools/index.js +1 -0
- package/dist/esm/src/overlay-tools/index.js.map +1 -1
- package/dist/esm/src/overlay-tools/withDoubleSpendRetry.js +48 -0
- package/dist/esm/src/overlay-tools/withDoubleSpendRetry.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/kvstore/GlobalKVStore.d.ts.map +1 -1
- package/dist/types/src/kvstore/types.d.ts +2 -0
- package/dist/types/src/kvstore/types.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/index.d.ts +1 -0
- package/dist/types/src/overlay-tools/index.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/withDoubleSpendRetry.d.ts +14 -0
- package/dist/types/src/overlay-tools/withDoubleSpendRetry.d.ts.map +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +2 -2
- package/dist/umd/bundle.js.map +1 -1
- package/docs/fast-docs.png +0 -0
- package/docs/index.md +49 -44
- package/docs/reference/kvstore.md +9 -0
- package/docs/reference/overlay-tools.md +32 -0
- package/docs/swagger.png +0 -0
- package/package.json +1 -1
- package/src/kvstore/GlobalKVStore.ts +134 -114
- package/src/kvstore/__tests/GlobalKVStore.test.ts +11 -1
- package/src/kvstore/types.ts +2 -0
- package/src/overlay-tools/index.ts +1 -0
- package/src/overlay-tools/withDoubleSpendRetry.ts +71 -0
- package/docs/MARKDOWN_VALIDATION_GUIDE.md +0 -175
- package/docs/concepts/beef.md +0 -92
- package/docs/concepts/chain-tracking.md +0 -134
- package/docs/concepts/decentralized-identity.md +0 -221
- package/docs/concepts/fees.md +0 -249
- package/docs/concepts/identity-certificates.md +0 -307
- package/docs/concepts/index.md +0 -77
- package/docs/concepts/key-management.md +0 -185
- package/docs/concepts/script-templates.md +0 -176
- package/docs/concepts/sdk-philosophy.md +0 -80
- package/docs/concepts/signatures.md +0 -194
- package/docs/concepts/spv-verification.md +0 -118
- package/docs/concepts/transaction-encoding.md +0 -167
- package/docs/concepts/transaction-structure.md +0 -67
- package/docs/concepts/trust-model.md +0 -139
- package/docs/concepts/verification.md +0 -250
- package/docs/concepts/wallet-integration.md +0 -101
- package/docs/guides/development-wallet-setup.md +0 -374
- package/docs/guides/direct-transaction-creation.md +0 -147
- package/docs/guides/http-client-configuration.md +0 -488
- package/docs/guides/index.md +0 -138
- package/docs/guides/large-transactions.md +0 -448
- package/docs/guides/multisig-transactions.md +0 -792
- package/docs/guides/security-best-practices.md +0 -494
- package/docs/guides/transaction-batching.md +0 -132
- package/docs/guides/transaction-signing-methods.md +0 -419
- package/docs/reference/arc-config.md +0 -698
- package/docs/reference/brc-100.md +0 -33
- package/docs/reference/configuration.md +0 -835
- package/docs/reference/debugging.md +0 -705
- package/docs/reference/errors.md +0 -597
- package/docs/reference/index.md +0 -111
- package/docs/reference/network-config.md +0 -914
- package/docs/reference/op-codes.md +0 -325
- package/docs/reference/transaction-signatures.md +0 -95
- package/docs/tutorials/advanced-transaction.md +0 -572
- package/docs/tutorials/aes-encryption.md +0 -949
- package/docs/tutorials/authfetch-tutorial.md +0 -986
- package/docs/tutorials/ecdh-key-exchange.md +0 -549
- package/docs/tutorials/elliptic-curve-fundamentals.md +0 -606
- package/docs/tutorials/error-handling.md +0 -1216
- package/docs/tutorials/first-transaction-low-level.md +0 -205
- package/docs/tutorials/first-transaction.md +0 -275
- package/docs/tutorials/hashes-and-hmacs.md +0 -788
- package/docs/tutorials/identity-management.md +0 -729
- package/docs/tutorials/index.md +0 -219
- package/docs/tutorials/key-management.md +0 -538
- package/docs/tutorials/protowallet-development.md +0 -743
- package/docs/tutorials/script-construction.md +0 -690
- package/docs/tutorials/spv-merkle-proofs.md +0 -685
- package/docs/tutorials/testnet-transactions-low-level.md +0 -359
- package/docs/tutorials/transaction-broadcasting.md +0 -538
- package/docs/tutorials/transaction-types.md +0 -420
- package/docs/tutorials/type-42.md +0 -568
- package/docs/tutorials/uhrp-storage.md +0 -599
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# Markdown Validation Guide for Teranode Documentation
|
|
2
|
-
|
|
3
|
-
This guide provides comprehensive solutions to prevent and catch markdown formatting issues that cause problems in Material MkDocs rendering.
|
|
4
|
-
|
|
5
|
-
## 🛠️ Available Validation Tools
|
|
6
|
-
|
|
7
|
-
### 1. Pre-commit Hooks (Automatic)
|
|
8
|
-
|
|
9
|
-
**Setup**: Already configured in `.pre-commit-config.yaml`
|
|
10
|
-
|
|
11
|
-
- **markdownlint**: Catches formatting issues before commits
|
|
12
|
-
- **Configuration**: `.markdownlint.yml` with rules tailored for Material MkDocs
|
|
13
|
-
|
|
14
|
-
**Usage**:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# Install pre-commit hooks
|
|
18
|
-
pre-commit install
|
|
19
|
-
|
|
20
|
-
# Run manually on all files
|
|
21
|
-
pre-commit run markdownlint --all-files
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### 2. Custom Validation Script
|
|
25
|
-
|
|
26
|
-
**Location**: `scripts/validate-markdown.py`
|
|
27
|
-
|
|
28
|
-
**Features**:
|
|
29
|
-
|
|
30
|
-
- Detects missing blank lines before lists
|
|
31
|
-
- Finds inconsistent nested bullet indentation
|
|
32
|
-
- Identifies configuration parameters missing Type/Default/Impact details
|
|
33
|
-
- Can automatically fix issues with `--fix` flag
|
|
34
|
-
|
|
35
|
-
**Usage**:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
# Validate all documentation
|
|
39
|
-
python3 scripts/validate-markdown.py docs/
|
|
40
|
-
|
|
41
|
-
# Validate and auto-fix issues
|
|
42
|
-
python3 scripts/validate-markdown.py docs/ --fix
|
|
43
|
-
|
|
44
|
-
# Validate single file
|
|
45
|
-
python3 scripts/validate-markdown.py docs/topics/services/alert.md
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### 3. VS Code Extensions (Real-time)
|
|
49
|
-
|
|
50
|
-
**Recommended Extensions**:
|
|
51
|
-
|
|
52
|
-
- **markdownlint**: Real-time linting in editor
|
|
53
|
-
- **Markdown All in One**: Preview and formatting
|
|
54
|
-
- **Material Theme**: Better syntax highlighting
|
|
55
|
-
|
|
56
|
-
**Setup**:
|
|
57
|
-
|
|
58
|
-
1. Install extensions
|
|
59
|
-
2. Add to VS Code settings.json:
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"markdownlint.config": {
|
|
64
|
-
"MD007": { "indent": 4 },
|
|
65
|
-
"MD032": true,
|
|
66
|
-
"MD013": false
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## 🎯 Common Issues & Prevention
|
|
72
|
-
|
|
73
|
-
### Issue 1: Missing Blank Lines Before Lists
|
|
74
|
-
|
|
75
|
-
**Problem**: Lists render inline instead of as proper lists
|
|
76
|
-
**Solution**: Always add blank line before lists
|
|
77
|
-
|
|
78
|
-
```markdown
|
|
79
|
-
❌ Wrong:
|
|
80
|
-
Configuration options:
|
|
81
|
-
|
|
82
|
-
- Option 1
|
|
83
|
-
- Option 2
|
|
84
|
-
|
|
85
|
-
✅ Correct:
|
|
86
|
-
Configuration options:
|
|
87
|
-
|
|
88
|
-
- Option 1
|
|
89
|
-
- Option 2
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Issue 2: Inconsistent Nested Indentation
|
|
93
|
-
|
|
94
|
-
**Problem**: Nested items don't render as nested
|
|
95
|
-
**Solution**: Use exactly 4 spaces for nested items
|
|
96
|
-
|
|
97
|
-
```markdown
|
|
98
|
-
❌ Wrong:
|
|
99
|
-
|
|
100
|
-
- Main item
|
|
101
|
-
- Nested item (2 spaces)
|
|
102
|
-
|
|
103
|
-
✅ Correct:
|
|
104
|
-
|
|
105
|
-
- Main item
|
|
106
|
-
- Nested item (4 spaces)
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Issue 3: Configuration Parameter Formatting
|
|
110
|
-
|
|
111
|
-
**Problem**: Inconsistent parameter documentation
|
|
112
|
-
**Solution**: Use standard format for all parameters
|
|
113
|
-
|
|
114
|
-
```markdown
|
|
115
|
-
✅ Standard Format:
|
|
116
|
-
1. **`parameter_name`**: Brief description.
|
|
117
|
-
- Type: string
|
|
118
|
-
- Default: "value"
|
|
119
|
-
- Impact: Detailed explanation of what this controls.
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## 🚀 Workflow Integration
|
|
123
|
-
|
|
124
|
-
### Daily Development
|
|
125
|
-
|
|
126
|
-
1. **VS Code Extensions**: Real-time feedback while editing
|
|
127
|
-
2. **Pre-commit Hooks**: Automatic validation before commits
|
|
128
|
-
3. **Custom Script**: Bulk validation and fixes
|
|
129
|
-
|
|
130
|
-
### CI/CD Pipeline
|
|
131
|
-
|
|
132
|
-
1. **GitHub Actions**: Validate all PRs
|
|
133
|
-
2. **Deployment**: Only deploy if validation passes
|
|
134
|
-
|
|
135
|
-
### Periodic Maintenance
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Weekly validation run
|
|
139
|
-
python3 scripts/validate-markdown.py docs/ --fix
|
|
140
|
-
git add -A
|
|
141
|
-
git commit -m "docs: fix markdown formatting issues"
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## 📋 Validation Checklist
|
|
145
|
-
|
|
146
|
-
Before committing documentation changes:
|
|
147
|
-
|
|
148
|
-
- [ ] Run custom validation script
|
|
149
|
-
- [ ] Check pre-commit hooks pass
|
|
150
|
-
- [ ] Preview in Material MkDocs locally
|
|
151
|
-
- [ ] Verify nested lists render correctly
|
|
152
|
-
- [ ] Confirm configuration parameters follow standard format
|
|
153
|
-
|
|
154
|
-
## 🔧 Quick Fixes
|
|
155
|
-
|
|
156
|
-
**Fix all formatting issues in docs**:
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
python3 scripts/validate-markdown.py docs/ --fix
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
**Run markdownlint**:
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
markdownlint docs/ --config .markdownlint.yml --fix
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
**Preview locally**:
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
mkdocs serve
|
|
172
|
-
# Open http://localhost:8000
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
This multi-layered approach ensures high-quality, consistently formatted documentation that renders perfectly in Material MkDocs.
|
package/docs/concepts/beef.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# BEEF Format
|
|
2
|
-
|
|
3
|
-
Bitcoin Extras Extension Format (BEEF) - an efficient way to package Bitcoin transactions with their verification data.
|
|
4
|
-
|
|
5
|
-
## What is BEEF?
|
|
6
|
-
|
|
7
|
-
BEEF is a standardized format that combines:
|
|
8
|
-
|
|
9
|
-
- **Transaction Data**: The actual Bitcoin transaction
|
|
10
|
-
- **Merkle Proofs**: SPV verification data
|
|
11
|
-
- **Block Headers**: Chain validation information
|
|
12
|
-
- **Metadata**: Additional context and references
|
|
13
|
-
|
|
14
|
-
## BEEF in the SDK
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
import { Transaction } from '@bsv/sdk'
|
|
18
|
-
|
|
19
|
-
// Create transaction with BEEF data
|
|
20
|
-
const tx = Transaction.fromHexBEEF(beefHex)
|
|
21
|
-
|
|
22
|
-
// Serialize transaction to BEEF
|
|
23
|
-
const beefData = transaction.toBEEF()
|
|
24
|
-
|
|
25
|
-
// Verify transaction using included proofs
|
|
26
|
-
const isValid = await tx.verify(chainTracker)
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Key Benefits
|
|
30
|
-
|
|
31
|
-
### Efficiency
|
|
32
|
-
|
|
33
|
-
- **Compact**: Includes only necessary verification data
|
|
34
|
-
- **Self-Contained**: No external lookups required
|
|
35
|
-
- **Batch Processing**: Multiple transactions in one package
|
|
36
|
-
|
|
37
|
-
### SPV Integration
|
|
38
|
-
|
|
39
|
-
- **Merkle Proofs**: Verify transaction inclusion
|
|
40
|
-
- **Block Headers**: Validate proof of work
|
|
41
|
-
- **Chain Context**: Understand transaction position
|
|
42
|
-
|
|
43
|
-
### Interoperability
|
|
44
|
-
|
|
45
|
-
- **Standardized**: Consistent format across applications
|
|
46
|
-
- **Portable**: Easy to transmit and store
|
|
47
|
-
- **Compatible**: Works with SPV clients
|
|
48
|
-
|
|
49
|
-
## Use Cases
|
|
50
|
-
|
|
51
|
-
### Transaction Broadcasting
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
// Broadcast transaction with proof
|
|
55
|
-
const beefTx = Transaction.fromHexBEEF(beefData)
|
|
56
|
-
await beefTx.broadcast(arcConfig)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Data Exchange
|
|
60
|
-
|
|
61
|
-
- Share transactions between applications
|
|
62
|
-
- Provide verification data to SPV clients
|
|
63
|
-
- Archive transactions with proofs
|
|
64
|
-
|
|
65
|
-
### Wallet Integration
|
|
66
|
-
|
|
67
|
-
- Import transactions with full context
|
|
68
|
-
- Verify historical transactions
|
|
69
|
-
- Synchronize between devices
|
|
70
|
-
|
|
71
|
-
## BEEF Structure
|
|
72
|
-
|
|
73
|
-
The format includes:
|
|
74
|
-
|
|
75
|
-
1. **Version**: BEEF format version
|
|
76
|
-
2. **Transactions**: One or more Bitcoin transactions
|
|
77
|
-
3. **Proofs**: Merkle proofs for each transaction
|
|
78
|
-
4. **Headers**: Relevant block headers
|
|
79
|
-
5. **Metadata**: Additional application data
|
|
80
|
-
|
|
81
|
-
## Best Practices
|
|
82
|
-
|
|
83
|
-
- Use BEEF for transactions that need verification
|
|
84
|
-
- Include minimal necessary proof data
|
|
85
|
-
- Validate BEEF structure before processing
|
|
86
|
-
- Cache parsed BEEF data for performance
|
|
87
|
-
|
|
88
|
-
## Next Steps
|
|
89
|
-
|
|
90
|
-
- Learn about [SPV Verification](./spv-verification.md) concepts
|
|
91
|
-
- Understand [Transaction Encoding](./transaction-encoding.md) formats
|
|
92
|
-
- Explore [Chain Tracking](./chain-tracking.md) integration
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# Chain Tracking
|
|
2
|
-
|
|
3
|
-
How the BSV TypeScript SDK interacts with the Bitcoin network to retrieve transaction and blockchain data.
|
|
4
|
-
|
|
5
|
-
## Chain Tracker Concept
|
|
6
|
-
|
|
7
|
-
A chain tracker provides access to Bitcoin blockchain data without running a full node:
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
import { WhatsOnChain } from '@bsv/sdk'
|
|
11
|
-
|
|
12
|
-
// Create a chain tracker
|
|
13
|
-
const chainTracker = new WhatsOnChain('mainnet')
|
|
14
|
-
|
|
15
|
-
// Get transaction data
|
|
16
|
-
const txData = await chainTracker.getTransaction('txid')
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Key Functions
|
|
20
|
-
|
|
21
|
-
### Transaction Lookup
|
|
22
|
-
|
|
23
|
-
- Retrieve transaction details by ID
|
|
24
|
-
- Get transaction status and confirmations
|
|
25
|
-
- Access transaction inputs and outputs
|
|
26
|
-
|
|
27
|
-
### UTXO Queries
|
|
28
|
-
|
|
29
|
-
- Find unspent transaction outputs
|
|
30
|
-
- Check UTXO availability and value
|
|
31
|
-
- Retrieve UTXO locking scripts
|
|
32
|
-
|
|
33
|
-
### Block Information
|
|
34
|
-
|
|
35
|
-
- Get block headers and merkle proofs
|
|
36
|
-
- Verify transaction inclusion in blocks
|
|
37
|
-
- Access block timestamps and difficulty
|
|
38
|
-
|
|
39
|
-
### Network Status
|
|
40
|
-
|
|
41
|
-
- Check network connectivity
|
|
42
|
-
- Monitor chain tip and height
|
|
43
|
-
- Get fee rate recommendations
|
|
44
|
-
|
|
45
|
-
## SPV Integration
|
|
46
|
-
|
|
47
|
-
Chain trackers enable SPV (Simplified Payment Verification):
|
|
48
|
-
|
|
49
|
-
- **Merkle Proofs**: Verify transaction inclusion without full blocks
|
|
50
|
-
- **Header Chain**: Maintain block headers for proof verification
|
|
51
|
-
- **Lightweight**: Minimal data requirements compared to full nodes
|
|
52
|
-
|
|
53
|
-
## Multiple Providers
|
|
54
|
-
|
|
55
|
-
The SDK supports multiple chain tracking services:
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
// Primary and fallback providers
|
|
59
|
-
const config = {
|
|
60
|
-
chainTracker: {
|
|
61
|
-
provider: 'WhatsOnChain',
|
|
62
|
-
network: 'mainnet',
|
|
63
|
-
fallbacks: ['GorillaPool', 'TAAL']
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Benefits
|
|
69
|
-
|
|
70
|
-
### Scalability
|
|
71
|
-
|
|
72
|
-
- No need to store the entire blockchain
|
|
73
|
-
- Fast startup and synchronization
|
|
74
|
-
- Minimal storage requirements
|
|
75
|
-
|
|
76
|
-
### Reliability
|
|
77
|
-
|
|
78
|
-
- Multiple provider support
|
|
79
|
-
- Automatic failover capabilities
|
|
80
|
-
- Redundant data sources
|
|
81
|
-
|
|
82
|
-
### Performance
|
|
83
|
-
|
|
84
|
-
- Targeted data queries
|
|
85
|
-
- Caching of frequently accessed data
|
|
86
|
-
- Optimized for application needs
|
|
87
|
-
|
|
88
|
-
## Common Patterns
|
|
89
|
-
|
|
90
|
-
### Transaction Verification
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
// Verify a transaction exists
|
|
94
|
-
const exists = await chainTracker.getTransaction(txid)
|
|
95
|
-
if (exists) {
|
|
96
|
-
// Transaction is confirmed on-chain
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### UTXO Validation
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
// Check if UTXO is still unspent
|
|
104
|
-
const utxo = await chainTracker.getUTXO(txid, outputIndex)
|
|
105
|
-
if (utxo) {
|
|
106
|
-
// UTXO is available for spending
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Error Handling
|
|
111
|
-
|
|
112
|
-
Chain tracker operations can fail due to:
|
|
113
|
-
|
|
114
|
-
- Network connectivity issues
|
|
115
|
-
- Service provider downtime
|
|
116
|
-
- Invalid transaction IDs
|
|
117
|
-
- Rate limiting
|
|
118
|
-
|
|
119
|
-
The SDK provides automatic retry and failover mechanisms.
|
|
120
|
-
|
|
121
|
-
## Configuration
|
|
122
|
-
|
|
123
|
-
Chain trackers can be configured for:
|
|
124
|
-
|
|
125
|
-
- **Network**: Mainnet, testnet, or regtest
|
|
126
|
-
- **Endpoints**: Custom service URLs
|
|
127
|
-
- **Timeouts**: Request timeout settings
|
|
128
|
-
- **Retry Logic**: Failure handling behavior
|
|
129
|
-
|
|
130
|
-
## Next Steps
|
|
131
|
-
|
|
132
|
-
- Understand [SPV Verification](./spv-verification.md) concepts
|
|
133
|
-
- Learn about [BEEF Format](./beef.md) for efficient data exchange
|
|
134
|
-
- Explore [Trust Model](./trust-model.md) considerations
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
# Decentralized Identity
|
|
2
|
-
|
|
3
|
-
Understanding how decentralized identity works in BSV and why it matters for building trustless applications.
|
|
4
|
-
|
|
5
|
-
## What is Decentralized Identity?
|
|
6
|
-
|
|
7
|
-
Imagine a world where you control your own identity credentials, just like you control your own wallet. Instead of relying on Facebook, Google, or government agencies to verify who you are, you can prove your identity using cryptographic certificates that anyone can independently verify.
|
|
8
|
-
|
|
9
|
-
This is the promise of decentralized identity: **self-sovereign identity** that puts users in control while maintaining security and trust.
|
|
10
|
-
|
|
11
|
-
## Why Decentralized Identity Matters
|
|
12
|
-
|
|
13
|
-
### The Problem with Centralized Identity
|
|
14
|
-
|
|
15
|
-
Traditional identity systems have significant limitations:
|
|
16
|
-
|
|
17
|
-
- **Single Points of Failure**: If the identity provider goes down, you lose access
|
|
18
|
-
- **Privacy Concerns**: Companies collect and monetize your personal data
|
|
19
|
-
- **Vendor Lock-in**: You can't easily move your identity between services
|
|
20
|
-
- **Censorship Risk**: Providers can revoke your identity for any reason
|
|
21
|
-
- **Data Breaches**: Centralized databases are attractive targets for hackers
|
|
22
|
-
|
|
23
|
-
### The Decentralized Solution
|
|
24
|
-
|
|
25
|
-
Decentralized identity addresses these issues by:
|
|
26
|
-
|
|
27
|
-
- **User Control**: You own and manage your identity data
|
|
28
|
-
- **No Central Authority**: No single entity controls the verification process
|
|
29
|
-
- **Interoperability**: Your identity works across different applications
|
|
30
|
-
- **Privacy by Design**: You choose what information to reveal and when
|
|
31
|
-
- **Censorship Resistance**: No one can arbitrarily revoke your identity
|
|
32
|
-
|
|
33
|
-
## How It Works in BSV
|
|
34
|
-
|
|
35
|
-
### Identity Keys vs Transaction Keys
|
|
36
|
-
|
|
37
|
-
BSV uses different types of keys for different purposes:
|
|
38
|
-
|
|
39
|
-
**Identity Keys** are long-term, stable identifiers used for:
|
|
40
|
-
|
|
41
|
-
- Establishing your digital identity
|
|
42
|
-
- Signing identity certificates
|
|
43
|
-
- Resolving your public profile information
|
|
44
|
-
- Authenticating with services
|
|
45
|
-
|
|
46
|
-
**Transaction Keys** are used for:
|
|
47
|
-
|
|
48
|
-
- Signing Bitcoin transactions
|
|
49
|
-
- Managing UTXOs and payments
|
|
50
|
-
- Protocol-specific operations
|
|
51
|
-
|
|
52
|
-
This separation provides both security and privacy benefits.
|
|
53
|
-
|
|
54
|
-
### Identity Resolution
|
|
55
|
-
|
|
56
|
-
Your identity key serves as a unique identifier that can be used to discover:
|
|
57
|
-
|
|
58
|
-
- Your chosen display name and profile information
|
|
59
|
-
- Verification badges and trust indicators
|
|
60
|
-
- Public certificates and credentials
|
|
61
|
-
- Contact preferences and communication methods
|
|
62
|
-
|
|
63
|
-
Think of it like a decentralized phone book where your identity key is your number, but instead of just finding your phone number, people can discover rich identity information that you've chosen to make public.
|
|
64
|
-
|
|
65
|
-
### Certificate-Based Trust
|
|
66
|
-
|
|
67
|
-
Instead of trusting a central authority, decentralized identity relies on a web of cryptographic certificates. These certificates are like digital testimonials that others can independently verify:
|
|
68
|
-
|
|
69
|
-
- **Self-Signed Certificates**: Claims you make about yourself
|
|
70
|
-
- **Peer Certificates**: Verifications from other users
|
|
71
|
-
- **Institutional Certificates**: Credentials from recognized organizations
|
|
72
|
-
- **Service Certificates**: Verifications from specialized services
|
|
73
|
-
|
|
74
|
-
## Trust and Verification Models
|
|
75
|
-
|
|
76
|
-
### Web of Trust
|
|
77
|
-
|
|
78
|
-
In a web of trust model, users verify each other's identities, creating networks of trusted relationships. This is similar to how you might trust a friend's recommendation about a restaurant - the more trusted connections someone has, the more credible they become.
|
|
79
|
-
|
|
80
|
-
### Institutional Trust
|
|
81
|
-
|
|
82
|
-
Some applications require higher assurance levels, so they rely on certificates from recognized institutions like universities, professional licensing boards, or government agencies. These certificates carry more weight because the issuers have established reputations and verification processes.
|
|
83
|
-
|
|
84
|
-
### Hybrid Approaches
|
|
85
|
-
|
|
86
|
-
Most real-world applications use a combination of trust models, adjusting requirements based on context. For example:
|
|
87
|
-
|
|
88
|
-
- **Low-risk interactions** might accept self-signed certificates
|
|
89
|
-
- **Financial transactions** might require institutional verification
|
|
90
|
-
- **Professional networking** might emphasize peer verification within industry groups
|
|
91
|
-
|
|
92
|
-
## Privacy and Selective Disclosure
|
|
93
|
-
|
|
94
|
-
### Controlling Your Information
|
|
95
|
-
|
|
96
|
-
One of the key benefits of decentralized identity is granular control over your personal information. You can:
|
|
97
|
-
|
|
98
|
-
- Choose which attributes to make publicly discoverable
|
|
99
|
-
- Reveal different information to different parties
|
|
100
|
-
- Prove claims without revealing underlying data
|
|
101
|
-
- Revoke access to previously shared information
|
|
102
|
-
|
|
103
|
-
### Zero-Knowledge Proofs
|
|
104
|
-
|
|
105
|
-
Advanced cryptographic techniques allow you to prove things about yourself without revealing the underlying information. For example, you could prove you're over 21 without revealing your exact age or birthdate.
|
|
106
|
-
|
|
107
|
-
### Progressive Disclosure
|
|
108
|
-
|
|
109
|
-
As trust builds between parties, you might choose to reveal more information. This allows relationships to develop naturally while maintaining privacy protection.
|
|
110
|
-
|
|
111
|
-
## Identity Lifecycle
|
|
112
|
-
|
|
113
|
-
### Getting Started
|
|
114
|
-
|
|
115
|
-
Creating a decentralized identity involves:
|
|
116
|
-
|
|
117
|
-
1. **Generating an identity key pair** (handled by your wallet)
|
|
118
|
-
2. **Creating basic profile information** (name, avatar, contact preferences)
|
|
119
|
-
3. **Obtaining initial certificates** to establish credibility
|
|
120
|
-
4. **Making your identity discoverable** through resolution networks
|
|
121
|
-
|
|
122
|
-
### Building Trust
|
|
123
|
-
|
|
124
|
-
Over time, you accumulate certificates and verifications that build your reputation:
|
|
125
|
-
|
|
126
|
-
- Verify your email address and social media accounts
|
|
127
|
-
- Get endorsements from colleagues and friends
|
|
128
|
-
- Obtain professional certifications and credentials
|
|
129
|
-
- Participate in community verification programs
|
|
130
|
-
|
|
131
|
-
### Maintaining Privacy
|
|
132
|
-
|
|
133
|
-
As your identity grows, you maintain control by:
|
|
134
|
-
|
|
135
|
-
- Regularly reviewing what information is public
|
|
136
|
-
- Updating privacy preferences as needs change
|
|
137
|
-
- Revoking outdated or unwanted certificates
|
|
138
|
-
- Managing consent for data sharing
|
|
139
|
-
|
|
140
|
-
## Real-World Applications
|
|
141
|
-
|
|
142
|
-
### Passwordless Authentication
|
|
143
|
-
|
|
144
|
-
Instead of remembering dozens of passwords, you can authenticate using your identity certificates. This is more secure than passwords and eliminates the need for password managers.
|
|
145
|
-
|
|
146
|
-
### Professional Networking
|
|
147
|
-
|
|
148
|
-
Verify professional credentials, work history, and skills through cryptographic certificates rather than relying on self-reported information on traditional platforms.
|
|
149
|
-
|
|
150
|
-
### Age and Identity Verification
|
|
151
|
-
|
|
152
|
-
Prove your age for restricted services without revealing your exact birthdate, or verify your identity for account creation without sharing unnecessary personal information.
|
|
153
|
-
|
|
154
|
-
### Reputation Systems
|
|
155
|
-
|
|
156
|
-
Build portable reputation that follows you across different platforms and applications, creating incentives for good behavior and reducing fraud.
|
|
157
|
-
|
|
158
|
-
### Decentralized Social Networks
|
|
159
|
-
|
|
160
|
-
Participate in social networks where your identity and connections are owned by you, not the platform, enabling true social media portability.
|
|
161
|
-
|
|
162
|
-
## Benefits for Developers
|
|
163
|
-
|
|
164
|
-
### Simplified User Onboarding
|
|
165
|
-
|
|
166
|
-
Instead of building complex registration and verification systems, applications can rely on existing identity infrastructure and certificates.
|
|
167
|
-
|
|
168
|
-
### Enhanced Security
|
|
169
|
-
|
|
170
|
-
Cryptographic identity verification is more secure than traditional username/password systems and reduces the risk of account takeovers.
|
|
171
|
-
|
|
172
|
-
### Regulatory Compliance
|
|
173
|
-
|
|
174
|
-
Decentralized identity can help meet KYC (Know Your Customer) and AML (Anti-Money Laundering) requirements while preserving user privacy.
|
|
175
|
-
|
|
176
|
-
### Interoperability
|
|
177
|
-
|
|
178
|
-
Users can bring their identity and reputation from other applications, reducing friction and improving user experience.
|
|
179
|
-
|
|
180
|
-
## Challenges and Considerations
|
|
181
|
-
|
|
182
|
-
### User Experience
|
|
183
|
-
|
|
184
|
-
Decentralized identity requires users to understand new concepts like key management and certificate verification. Good wallet software and user interfaces are essential for adoption.
|
|
185
|
-
|
|
186
|
-
### Recovery and Backup
|
|
187
|
-
|
|
188
|
-
Unlike centralized systems where you can reset your password, losing access to your identity keys can be permanent. Robust backup and recovery mechanisms are crucial.
|
|
189
|
-
|
|
190
|
-
### Network Effects
|
|
191
|
-
|
|
192
|
-
The value of decentralized identity increases as more people and organizations participate. Early adoption requires overcoming the "chicken and egg" problem.
|
|
193
|
-
|
|
194
|
-
### Scalability
|
|
195
|
-
|
|
196
|
-
As identity networks grow, efficient resolution and verification mechanisms become increasingly important to maintain performance.
|
|
197
|
-
|
|
198
|
-
## The Future of Identity
|
|
199
|
-
|
|
200
|
-
Decentralized identity represents a fundamental shift toward user sovereignty and privacy. As the technology matures and adoption grows, we can expect to see:
|
|
201
|
-
|
|
202
|
-
- **Seamless Integration** with everyday applications and services
|
|
203
|
-
- **Enhanced Privacy Protection** through advanced cryptographic techniques
|
|
204
|
-
- **Global Interoperability** across different identity systems and networks
|
|
205
|
-
- **Reduced Identity Fraud** through cryptographic verification
|
|
206
|
-
- **New Business Models** that respect user privacy and data ownership
|
|
207
|
-
|
|
208
|
-
By understanding these concepts, developers can build applications that respect user privacy, enhance security, and contribute to a more open and decentralized internet.
|
|
209
|
-
|
|
210
|
-
## Related Concepts
|
|
211
|
-
|
|
212
|
-
- [Identity Certificates](./identity-certificates.md) - How cryptographic certificates enable trust
|
|
213
|
-
- [Digital Signatures](./signatures.md) - Cryptographic foundations of identity verification
|
|
214
|
-
- [Trust Model](./trust-model.md) - Security assumptions in decentralized systems
|
|
215
|
-
- [Key Management](./key-management.md) - Managing cryptographic keys securely
|
|
216
|
-
|
|
217
|
-
## Further Reading
|
|
218
|
-
|
|
219
|
-
- [Identity Management Tutorial](../tutorials/identity-management.md) - Hands-on implementation guide
|
|
220
|
-
- [AuthFetch Tutorial](../tutorials/authfetch-tutorial.md) - Authenticated communication using identity
|
|
221
|
-
- [Security Best Practices](../guides/security-best-practices.md) - Secure identity implementation patterns
|