sol-safekey 0.1.5

A powerful command-line tool for secure Solana key management with Triple-Factor 2FA
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
<div align="center">
    <h1>๐Ÿ“– Sol-SafeKey ไบคไบ’ๅผ่œๅ•ๅฎŒๆ•ดๆ•™็จ‹</h1>
    <h3><em>Step-by-step guide for all interactive menu operations</em></h3>
</div>

---

## ๐Ÿ“‘ Table of Contents

- [๐ŸŽฏ Getting Started]#-getting-started
- [๐Ÿ“š Feature-by-Feature Guide]#-feature-by-feature-guide
  - [1. Create Plaintext Key]#1-create-plaintext-key
  - [2. Create Encrypted Key]#2-create-encrypted-key
  - [3. Decrypt Key]#3-decrypt-key
  - [U. Unlock Wallet]#u-unlock-wallet
  - [4. Setup 2FA Authentication]#4-setup-2fa-authentication
  - [5. Generate Triple-Factor Wallet]#5-generate-triple-factor-wallet
  - [6. Unlock Triple-Factor Wallet]#6-unlock-triple-factor-wallet
  - [7. Check SOL Balance]#7-check-sol-balance
  - [8. Transfer SOL]#8-transfer-sol
  - [9. Create WSOL ATA]#9-create-wsol-ata
  - [10. Wrap SOL โ†’ WSOL]#10-wrap-sol--wsol
  - [11. Unwrap WSOL โ†’ SOL]#11-unwrap-wsol--sol
  - [12. Close WSOL ATA]#12-close-wsol-ata
  - [13. Transfer SPL Token]#13-transfer-spl-token
  - [14. Create Nonce Account]#14-create-nonce-account
  - [15. Pump.fun Sell Token]#15-pumpfun-sell-token
  - [16. PumpSwap Sell Token]#16-pumpswap-sell-token
  - [17. Pump.fun Cashback]#17-pumpfun-cashback
  - [18. PumpSwap Cashback]#18-pumpswap-cashback

---

### ๐Ÿ“‹ Quick Operation Index

Quick access to all 18 interactive menu operations:

#### ๐Ÿ”‘ Core Functions (Options 1-3)
- **[1. Create Plaintext Key]#1-create-plaintext-key** - Generate and save unencrypted Solana keypair
- **[2. Create Encrypted Key (bot)]#2-create-encrypted-key** - Encrypt existing private key and save to keystore
- **[3. Decrypt Key]#3-decrypt-key** - Decrypt keystore and reveal private key

#### ๐Ÿ”’ Wallet Management (Option U)
- **[U. Unlock Wallet]#u-unlock-wallet** - Unlock wallet for Solana operations

#### ๐Ÿ›ก๏ธ Advanced Security Features (Options 4-6)
- **[4. Setup 2FA Authentication]#4-setup-2fa-authentication** - Configure two-factor authentication
- **[5. Generate Triple-Factor Wallet]#5-generate-triple-factor-wallet** - Create wallet with 3FA (hardware + password + security question + 2FA)
- **[6. Unlock Triple-Factor Wallet]#6-unlock-triple-factor-wallet** - Decrypt 3FA encrypted wallet

#### ๐Ÿ’ฐ Solana On-Chain Operations (Options 7-18)
- **[7. Check SOL Balance]#7-check-sol-balance** - Query wallet SOL balance
- **[8. Transfer SOL]#8-transfer-sol** - Send SOL to another address
- **[9. Create WSOL ATA]#9-create-wsol-ata** - Create Wrapped SOL Associated Token Account
- **[10. Wrap SOL โ†’ WSOL]#10-wrap-sol--wsol** - Convert SOL to Wrapped SOL
- **[11. Unwrap WSOL โ†’ SOL]#11-unwrap-wsol--sol** - Convert Wrapped SOL back to SOL
- **[12. Close WSOL ATA]#12-close-wsol-ata** - Close WSOL ATA and convert remaining WSOL to SOL
- **[13. Transfer SPL Token]#13-transfer-spl-token** - Send SPL tokens to another address
- **[14. Create Nonce Account]#14-create-nonce-account** - Create durable nonce for transaction replay protection
- **[15. Pump.fun Sell Token]#15-pumpfun-sell-token** - Sell tokens on Pump.fun DEX (internal market)
- **[16. PumpSwap Sell Token]#16-pumpswap-sell-token** - Sell tokens on PumpSwap DEX
- **[17. Pump.fun Cashback (View & Claim)]#17-pumpfun-cashback-view--claim** - View and claim pump.fun cashback (native SOL)
- **[18. PumpSwap Cashback (View & Claim)]#18-pumpswap-cashback-view--claim** - View and claim PumpSwap cashback (WSOL)

---

## ๐ŸŽฏ Getting Started

#### Step 1: Launch Interactive Menu

```bash
sol-safekey start
```

You will see the language selection screen. Choose your preferred language:

**English**: Enter `2`
**ไธญๆ–‡**: Enter `1`

#### Step 2: Select an Operation

After selecting language, you'll see the main menu shown above. Enter the number corresponding to your desired operation.

**Important**: If you haven't created a wallet yet, you need to:
- **Unlock an existing wallet** (Option `U`)
- **Create a new wallet** (Options `1` or `2`)

---

### ๐Ÿ“š Feature-by-Feature Guide

#### 1. Create Plaintext Key (Option 1)

**Purpose**: Generate a new Solana keypair and save it to a file (unencrypted)

**Use Cases**:
- Development and testing
- When you need to share the key with team members
- Quick wallet generation for testing

**Steps**:
1. Select `1` from the main menu
2. Choose a filename for saving (default: `keypair.json`)
3. System generates a new Solana keypair
4. Private key is saved to the file (unencrypted)

**Example Output**:
```
๐Ÿ”“ Create Plaintext Key

Enter filename [keypair.json]: my_keypair.json

Generating new Solana keypair...
โœ… Key generation successful!

Public Key: 7xKm...9xW3

๐Ÿ“ Important Notes:
   โ€ข This file contains your private key in plaintext
   โ€ข Only use for development and testing
   โ€ข Do NOT share this file with anyone
   โ€ข For production, use encrypted options (Option 2)
```

---

#### 2. Create Encrypted Key (Option 2)

**Purpose**: Encrypt an existing private key and save it to a secure keystore file

**Use Cases**:
- Production wallet storage
- Secure backup of existing keys
- Preparing wallet for bot integration

**Steps**:
1. Select `2` from the main menu
2. Paste or enter your private key (base58 format)
3. Enter a password (10-20 characters, must include at least 3 of: uppercase, lowercase, digit, special character)
4. Confirm password by entering it again
5. Choose a filename (default: `keystore.json`)
6. System encrypts and saves to the file

**Password Requirements**:
- Length: 10-20 characters
- Must include at least 3 of: uppercase, lowercase, digit, special character
- Examples: `MySecureP@ssw0rd!`, `StrongKey#2025`, `abc123XYZ!`

**Example Output**:
```
๐Ÿ” Create Encrypted Key

Enter or paste your private key (base58): <paste-your-key-here>

Please set a password (10-20 characters, must include at least 3 of: uppercase, lowercase, digit, special character):
Enter password: ********
Confirm password: ********

Enter filename to save [keystore.json]: my_keystore.json

Encrypting and saving...
โœ… Keystore encrypted and saved to: my_keystore.json

๐Ÿ“ Important:
   โ€ข Password required for decryption - never lose it!
   โ€ข keystore.json contains AES-256 encrypted private key
   โ€ข Recommended to backup keystore.json to multiple secure locations
```

---

#### 3. Decrypt Key (Option 3)

**Purpose**: Load an encrypted keystore file and decrypt to reveal the private key

**Use Cases**:
- View your private key when needed
- Export wallet to different formats
- Verify wallet contents

**Steps**:
1. Select `3` from the main menu
2. Enter keystore filename (default: `keystore.json`)
3. Enter your password
4. System decrypts and displays the private key

**Example Output**:
```
๐Ÿ”“ Decrypt Key

Enter keystore filename [keystore.json]: my_keystore.json

Enter password: ********

โœ… Decryption successful!

Public Key: 7xKm...9xW3
Private Key: <base58-encoded-key>

โš ๏ธ  Security Warning:
   โ€ข Private key is now displayed in plaintext
   โ€ข Keep this screen away from prying eyes
   โ€ข Consider using decrypted key only when necessary
```

---

### ๐Ÿ”’ Wallet Management

#### U. Unlock Wallet

**Purpose**: Unlock a wallet for use in Solana operations (Options 7-18)

**Steps**:
1. Select `U` from the main menu
2. Enter keystore filename (default: `keystore.json`)
3. Enter your password
4. Wallet status changes to "Unlocked" and wallet is stored in session

**Wallet Status Indicator**:

The wallet status indicator shows:
- **Unlocked**: Wallet is ready for operations
- **Locked**: No wallet loaded in session

**Example Output**:
```
๐Ÿ”“ Unlock Wallet

Enter keystore filename [keystore.json]:

Enter password: ********

โœ… Wallet unlocked successfully!

๐Ÿ“ Current Wallet: 7xKm...9xW3
๐Ÿ”’ Wallet Status: Unlocked

You can now perform Solana operations (Options 7-18)
```

---

### ๐Ÿ› ๏ธ Solana On-Chain Operations

All Solana operations (Options 7-18) require an **unlocked wallet**. Make sure to unlock your wallet first!

#### 7. Check SOL Balance

**Purpose**: Query the SOL balance of your wallet

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `7` from the main menu
3. Enter RPC URL (press Enter for default: mainnet-beta)
4. System queries and displays your balance

**Example Output**:
```
๐Ÿ’ฐ Check SOL Balance

Enter RPC URL [https://api.mainnet-beta.solana.com]:

Querying balance...
โœ… Balance query successful!

๐Ÿ“ Wallet Address: 7xKm...9xW3
๐Ÿ’ฐ SOL Balance: 1.234567890 SOL (1,234,567,890 lamports)

Explorer: https://solscan.io/address/7xKm...9xW3
```

---

#### 8. Transfer SOL

**Purpose**: Send SOL to another Solana address

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `8` from the main menu
3. Enter recipient address
4. Enter amount in SOL
5. Enter RPC URL (press Enter for default)
6. Review and confirm transaction
7. System sends the transaction

**Example Output**:
```
๐Ÿ’ธ Transfer SOL

Enter recipient address: 5xKm...2xW3

Enter amount in SOL: 0.1

Enter RPC URL [https://api.mainnet-beta.solana.com]:

Confirm transaction? (yes/no): yes

Sending transaction...
โœ… Transaction sent successfully!

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

#### 9. Create WSOL ATA

**Purpose**: Create a Wrapped SOL (WSOL) Associated Token Account

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `9` from the main menu
3. Enter RPC URL (press Enter for default)
4. System creates WSOL ATA account

**Example Output**:
```
๐Ÿ“ Create WSOL ATA

Enter RPC URL [https://api.mainnet-beta.solana.com]:

Creating WSOL ATA...
โœ… WSOL ATA created successfully!

๐Ÿ“ ATA Address: 7xKm...9xW3
๐Ÿ“Š Token Mint: So11111111111111111111111111111111111111111112

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

#### 10. Wrap SOL โ†’ WSOL

**Purpose**: Convert SOL to WSOL (Wrapped SOL)

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `10` from the main menu
3. Enter amount in SOL to wrap
4. Enter RPC URL (press Enter for default)
5. Review and confirm transaction
6. System wraps SOL to WSOL

**Example Output**:
```
๐Ÿ“ฆ Wrap SOL โ†’ WSOL

Enter amount in SOL: 0.5

Enter RPC URL [https://api.mainnet-beta.solana.com]:

Confirm transaction? (yes/no): yes

Wrapping SOL to WSOL...
โœ… Wrap successful!

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3

โœ… WSOL Balance updated: 0.5 WSOL
```

---

#### 11. Unwrap WSOL โ†’ SOL

**Purpose**: Convert WSOL back to SOL

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `11` from the main menu
3. Enter amount in WSOL to unwrap
4. Enter RPC URL (press Enter for default)
5. Review and confirm transaction
6. System unwraps WSOL to SOL

**Example Output**:
```
๐Ÿ“ค Unwrap WSOL โ†’ SOL

Enter amount in WSOL: 0.5

Enter RPC URL [https://api.mainnet-beta.solana.com]:

Confirm transaction? (yes/no): yes

Unwrapping WSOL to SOL...
โœ… Unwrap successful!

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3

โœ… SOL Balance updated!
```

---

#### 12. Close WSOL ATA

**Purpose**: Close WSOL ATA account (convert remaining WSOL to SOL)

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `12` from the main menu
3. Enter RPC URL (press Enter for default)
4. System closes ATA account

**Example Output**:
```
๐Ÿ—‘๏ธ Close WSOL ATA

Enter RPC URL [https://api.mainnet-beta.solana.com]:

Closing WSOL ATA...
โœ… WSOL ATA closed successfully!

Remaining WSOL: 0.5 WSOL โ†’ 0.5 SOL
Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

#### 13. Transfer SPL Token

**Purpose**: Send SPL tokens to another Solana address

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `13` from the main menu
3. Enter token mint address
4. Enter recipient address
5. Enter amount
6. Enter RPC URL (press Enter for default)
7. Review and confirm transaction
8. System sends the transaction

**Example Output**:
```
๐Ÿ’Ž Transfer SPL Token

Enter token mint address: <token-mint-address>

Enter recipient address: 5xKm...2xW3

Enter amount: 100

Enter RPC URL [https://api.mainnet-beta.solana.com]:

Confirm transaction? (yes/no): yes

Sending SPL token...
โœ… Token transfer successful!

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

#### 14. Create Nonce Account

**Purpose**: Create a durable nonce account for transaction replay protection

**Use Cases**:
- Batch transaction processing
- Preventing transaction replay attacks
- Ensuring transaction ordering

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `14` from the main menu
3. Enter RPC URL (press Enter for default)
4. System creates nonce account

**Example Output**:
```
๐Ÿ”‘ Create Nonce Account

Enter RPC URL [https://api.mainnet-beta.solana.com]:

Creating nonce account...
โœ… Nonce account created and initialized successfully!

๐Ÿ“ Nonce Address: 5xKm...7xW3

๐Ÿ’ก Save this nonce account address for future use!
Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

### ๐Ÿช Token Operations

#### 15. Pump.fun Sell Token

**Purpose**: Sell tokens on Pump.fun DEX

**Use Cases**:
- Trading tokens on Pump.fun platform
- Automated selling strategies
- Quick liquidity exit

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `15` from the main menu
3. Enter token mint address
4. Configure sell options:
   - Slippage (basis points, default: 9900)
   - Seed optimization (default: yes)
   - Use seed-optimized ATA (optional, same as PumpSwap)
5. Confirm transaction
6. System sells all token balance

**Example Output**:
```
๐ŸŽช Pump.fun Sell Token

Enter token mint address: <token-mint-address>

Enter slippage (basis points, default 9900): [Enter]

Use seed optimization? (yes/no, default yes) [Enter]

Use seed-optimized ATA? (yes/no, default yes) [Enter]

Selling all tokens...
โœ… Sell successful!

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

#### 16. PumpSwap Sell Token

**Purpose**: Sell tokens on PumpSwap DEX

**Use Cases**:
- Trading tokens on PumpSwap platform
- Access to multiple liquidity pools
- Advanced trading features

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `16` from the main menu
3. Enter token mint address
4. Configure sell options
5. Confirm transaction
6. System sells tokens

**Example Output**:
```
๐Ÿ”„ PumpSwap Sell Token

Enter token mint address: <token-mint-address>

Enter slippage (basis points, default 9900): [Enter]

Selling tokens...
โœ… Sell successful!

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

#### 17. Pump.fun Cashback (View & Claim)

**Purpose**: View and claim pump.fun cashback (native SOL)

**Use Cases**:
- Check available cashback balance
- Claim earned cashback

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `17` from the main menu
3. System queries and claims available cashback

**Example Output**:
```
๐Ÿ’ฐ Pump.fun Cashback

Querying cashback status...
โœ… Cashback available: 0.123 SOL

Claiming cashback...
โœ… Cashback claimed successfully!

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

#### 18. PumpSwap Cashback (View & Claim)

**Purpose**: View and claim PumpSwap cashback (WSOL)

**Use Cases**:
- Check available WSOL cashback balance
- Claim earned WSOL cashback

**Steps**:
1. Make sure wallet is unlocked (Status: Unlocked)
2. Select `18` from the main menu
3. System queries and claims available cashback

**Example Output**:
```
๐Ÿ’ฐ PumpSwap Cashback

Querying cashback status...
โœ… Cashback available: 0.05 WSOL

Claiming cashback...
โœ… Cashback claimed successfully!

Signature: 5xKm...9xW3
Explorer: https://solscan.io/tx/5xKm...9xW3
```

---

### ๐Ÿ” Advanced Security Features

#### 4. Setup 2FA Authentication

**Purpose**: Configure two-factor authentication for enhanced security

**Use Cases**:
- Adding an extra security layer to your wallet
- Protecting against unauthorized access
- Required for triple-factor wallets

**Steps**:
1. Select `4` from the main menu
2. System collects hardware fingerprint
3. Set master password
4. Set security question
5. Configure TOTP (Time-based One-Time Password)

**Requirements**:
- Hardware fingerprint collection (device-dependent)
- TOTP authenticator app (Google Authenticator, Authy, etc.)
- Master password (10-20 characters, 3+ character types)
- Security question (choose from predefined options)

**Output**:
- โœ… Hardware fingerprint (device binding)
- โœ… Master password encryption
- โœ… Security question verification
- โœ… TOTP configuration (6-digit codes, 30-second rotation)

---

#### 5. Generate Triple-Factor Wallet

**Purpose**: Generate a wallet with three-factor authentication (hardware + password + security question + 2FA)

**Security Features**:
- โœ… Hardware fingerprint (device binding)
- โœ… Master password encryption
- โœ… Security question verification
- โœ… TOTP dynamic codes (6-digit, 30-second rotation)
- โœ… Durable nonce account support

**Use Cases**:
- Maximum security for production wallets
- Multi-device support with TOTP
- Recovery with multiple authentication factors

**Steps**:
1. Select `5` from the main menu
2. System collects hardware fingerprint
3. Set master password
4. Answer security question
5. Configure TOTP authenticator
6. System generates encrypted wallet file

**Output**:
- Encrypted wallet file (triple-factor)
- Cross-device keystore backup
- Recovery instructions

---

#### 6. Unlock Triple-Factor Wallet

**Purpose**: Decrypt a triple-factor encrypted wallet

**Requirements**:
- Original device (for hardware fingerprint)
- Master password
- Security question answer
- Current TOTP code (6 digits, changes every 30 seconds)

**Steps**:
1. Select `6` from the main menu
2. Enter wallet file path (generated from Option 5)
3. Enter master password
4. Answer security question
5. Enter current TOTP code
6. System decrypts and displays wallet

**Security**: All three factors must be correct to unlock.

---