Skip to content

Commit a2d5897

Browse files
Update Staking Documentation (#76)
1 parent d6ca423 commit a2d5897

2 files changed

Lines changed: 63 additions & 13 deletions

File tree

docs/staking/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[PHPCoin Docs](../) > Staking
22

3-
43
---
54

65
# Staking
76

8-
This section explains how to stake your PHPCoin holdings.
7+
This section explains how to stake your PHPCoin holdings to earn rewards and support the network.
98

10-
* [How to Stake](./how-to-stake.md)
9+
* [How to Stake](./how-to-stake.md) - A guide on how to start staking your PHPCoin, including technical details about the Proof-of-Stake algorithm, rewards, and requirements.

docs/staking/how-to-stake.md

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,76 @@
11
[PHPCoin Docs](../) > [Staking](./) > How to Stake
22

3-
43
---
54

65
# How to Stake
76

8-
Staking is the process of holding PHPcoin in a wallet to support the operations of the blockchain network. In return for staking, you receive rewards in the form of new PHPcoin.
7+
## Introduction
8+
9+
Staking is the process of holding PHPCoin in your wallet to support the blockchain network. In return for holding coins, you receive rewards in the form of new PHPCoin.
910

1011
## How Staking Works
1112

12-
PHPcoin uses a Proof-of-Stake (PoS) consensus algorithm, which means that anyone who holds PHPcoin can participate in the process of creating new blocks and validating transactions.
13+
PHPcoin uses a Proof-of-Stake (PoS) system to reward coin holders. Unlike miners or block generators, **stakers do not create or validate blocks**. Instead, for each block created, the network automatically chooses a "stake winner" from all eligible participants to receive a reward.
1314

14-
To be eligible for staking rewards, you need to meet the following requirements:
15+
To be eligible for staking rewards, you must meet the network's minimum balance and coin maturity requirements.
1516

16-
* **Minimum Balance:** You must have a minimum balance of PHPcoin in your wallet. You can check the current minimum balance by calling the `/api.php?q=nodeInfo` API endpoint.
17-
* **Maturity:** Your coins must have reached a certain maturity, which means they must have been held in your wallet for a certain number of blocks. You can check the current maturity requirement by calling the `/api.php?q=nodeInfo` API endpoint.
17+
## How to Start Staking
1818

19-
If you meet these requirements, your wallet will automatically be entered into a lottery to create the next block. If your wallet is chosen, you will receive a reward in the form of new PHPcoin.
19+
To become eligible for staking rewards, you must first send a special "stake" transaction. This is a one-time action that flags your address as a staking participant.
2020

21-
## How to Start Staking
21+
1. **Open a terminal or command prompt.**
22+
2. **Navigate to the directory where your PHPcoin wallet is located.**
23+
3. **Run the following command:**
24+
25+
```bash
26+
php cli/wallet.php send <your-address> 0 "stake"
27+
```
28+
29+
Replace `<your-address>` with your own wallet address. The `0` is the amount to send (this special transaction is free), and `"stake"` is the message that activates your address for staking.
30+
31+
## Staking Requirements
32+
33+
### Current Requirements (Block 1,000,001+)
34+
35+
For the current mainnet (at over 1,250,000 blocks), the requirements are simple and fixed:
36+
37+
* **Coin Maturity:** **60 blocks**. Your coins must be held for at least 60 blocks before they are eligible.
38+
* **Minimum Balance:** **160,000 PHPCoin**. You must hold at least this amount to be eligible.
39+
40+
### Historical Requirements
41+
42+
The staking requirements have changed during the blockchain's history.
43+
44+
* **Before block 290,000:**
45+
* Coin Maturity: 600 blocks
46+
* Minimum Balance: 100 PHPCoin
47+
* **Block 290,001 - 1,000,000:**
48+
* Coin Maturity: 60 blocks
49+
* Minimum Balance: Increased in stages, from 30,000 to 140,000 PHPCoin.
50+
51+
---
52+
53+
## Technical Details
54+
55+
### 1. Activating an Address for Staking
56+
57+
An address is recognized as a staking address after it has been the destination of a transaction with the message `"stake"`.
58+
59+
* **Code Reference:** The `getAddressTypes` function in `include/class/Block.php`.
60+
61+
### 2. Code References for Requirements
62+
63+
* **Maturity:** The `getStakingMaturity()` function in `include/class/Blockchain.php` controls this value. The change from 600 to 60 blocks is triggered by the `UPDATE_11_STAKING_MATURITY_REDUCE` constant (value: `290000`) in `include/coinspec.inc.php`.
64+
* **Minimum Balance:** The `getStakingMinBalance()` function in `include/class/Blockchain.php` controls this value. The change from a fixed 100 PHPCoin to a dynamic value is triggered by the `UPDATE_12_STAKING_DYNAMIC_THRESHOLD` constant (value: `290000`) in `include/coinspec.inc.php`. The specific amounts are derived from the `REWARD_SCHEME` constant in `include/rewards.inc.php`.
65+
66+
### 3. Stake Winner Selection
67+
68+
For each block, a single stake winner is selected from all eligible accounts based on a `weight`.
69+
70+
* **Code Reference:** The `getStakeWinner` function in `include/class/Account.php` calculates this `weight` using the formula: `(current_block_height - last_transaction_height) * account_balance`. The account with the highest weight wins.
71+
72+
### 4. Staking Rewards
2273
23-
To start staking, you simply need to hold PHPcoin in your wallet. There is no need to perform any special actions or run any special software.
74+
The reward amount is determined by the block height.
2475
25-
As long as your wallet is running and connected to the network, you will be eligible to receive staking rewards.
76+
* **Code Reference:** The `reward` function in `include/class/Block.php` reads the reward structure from the `REWARD_SCHEME` constant in `include/rewards.inc.php`.

0 commit comments

Comments
 (0)