# Staking-Only Wallet Lock

### Staking and Wallet Security

Lynx uses a Proof-of-Stake (PoS) consensus mechanism, which means users can help secure the network and earn rewards by staking their coins. This guide explains how to stake safely using the command line interface.

### Understanding Proof of Stake

In Proof of Stake, you "stake" your coins to validate transactions and secure the network. Your staking power is proportional to the number of coins you hold. When your wallet successfully validates a block, you earn staking rewards.

### Staking Requirements

To stake your coins and earn rewards, your wallet must be:

1. Synchronized - Fully synced with the respective blockchain
2. Online - Running and connected to the network 24/7 (or as much as possible)
3. Holding mature coins - Your coins must have at least 30 confirmations
4. Unlocked for staking - Your (optionally) encrypted wallet must be unlocked specifically for staking

### Encrypting Your Wallet

{% hint style="warning" %}
**CRITICAL: Always encrypt and backup your wallet before staking.**
{% endhint %}

Wallet encryption protects your private keys with a password. This is essential for staking wallets that must remain online continuously.

Create a strong passphrase:

* Use at least 12 characters
* Include uppercase, lowercase, numbers, and symbols
* Example: `7hG!xPq2@nM9wLz4#vK8`

Encrypt your wallet:

```bash
[daemon]-cli encryptwallet "your-strong-passphrase-here"
```

**Example for Lynx:** lynx-cli encryptwallet "your-strong-passphrase-here"

{% hint style="danger" %}
**WARNING: If you lose your passphrase, you will permanently lose access to your coins.**
{% endhint %}

### Unlocking for Staking Only

The key security feature is the ability to unlock *for staking only*. This allows your wallet to stake while preventing unauthorized transactions.

#### Staking-Only vs Full Unlock

* Staking-Only Unlock: Wallet can stake and earn rewards, but CANNOT send coins
* Full Unlock: Wallet can stake AND send transactions (use only when you need to send coins)

### Unlock Commands

Unlock for staking only (recommended):

```bash
[daemon]-cli walletpassphrase "your-strong-passphrase-here" 0 true
```

**Example for Lynx:** lynx-cli walletpassphrase "your-strong-passphrase-here" 0 true

Unlock fully for 5 minutes (only when sending coins):

```bash
[daemon]-cli walletpassphrase "your-strong-passphrase-here" 300 false
```

**Example for Lynx:** lynx-cli walletpassphrase "your-strong-passphrase-here" 300 false

Parameters explained:

* `"your-passphrase"` - Your wallet encryption password (in quotes)
* `0` - Timeout in seconds (0 = indefinite, or use specific seconds like `600` for 10 minutes)
* `true` - Staking-only mode / `false` - Full unlock

### Lock Your Wallet

When you need to lock your wallet (for security or before sending coins):

```bash
lynx-cli walletlock
```

After locking, unlock again for staking:

```bash
lynx-cli walletpassphrase "your-strong-passphrase-here" 0 true
```

### Protecting Your Passphrase in Command History

{% hint style="info" %}
When you unlock your wallet, your passphrase is saved in your terminal history. You should clear it.
{% endhint %}

#### Recommended Method

Remove last command from history:

```bash
history -d $((HISTCMD-1))
```

Remove complete command from history:

```bash
history -c
```

Temporarily disable history:

```bash
set +o history
lynx-cli walletpassphrase "your-strong-passphrase-here" 0 true
set -o history
```
