Skip to content

Commit 77f787b

Browse files
authored
Merge pull request #88 from casper-network/dev
PR to merge the changes from `dev` to `main`
2 parents 1deb770 + f941c50 commit 77f787b

File tree

6 files changed

+268
-120
lines changed

6 files changed

+268
-120
lines changed

docs/concepts/accounts-and-keys.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ The Casper blockchain uses an on-chain [account-based model](./design/casper-des
99
By default, a transactional interaction with the blockchain takes the form of a `Transaction` cryptographically signed by the key-pair corresponding to the `PublicKey` used to create the account.
1010

1111
The Casper platform supports two types of keys for creating accounts and signing transactions:
12-
- [Ed25519](#eddsa-keys) keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA) and are 66 bytes long
13-
- [Secp256k1](#ecdsa-keys) keys, which use the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve; they are 68 bytes long and are also found on the Ethereum blockchain
12+
- [Ed25519](#eddsa-keys) keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA) and are 66 characters / 33 bytes long and comprising of;
13+
- `01` - 1 byte prefix (indicates `Ed25519` key type in Casper)
14+
- 32 bytes of actual `Ed25519` public key data
15+
- Example: [`01a0d23e084a95cdee9c2fb226d54033d645873a7c7c9739de2158725c7dfe672f`](https://cspr.live/account/01a0d23e084a95cdee9c2fb226d54033d645873a7c7c9739de2158725c7dfe672f)
16+
17+
- [Secp256k1](#ecdsa-keys) keys, which use the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve; they are 68 characters / 34 bytes long and are also found on the Ethereum blockchain. It comprises of;
18+
- `02` - 1 byte prefix (indicates `Secp266k1` key type in Casper)
19+
- 33 bytes of actual `Secp256k1` compressed public key data
20+
- Example: [`02038baa714f1f45aaacb4443df31bf27a8990369c2f9d585f904ec5c5b85aeb231f`](https://cspr.live/account/0203f3f44c9e80e2cedc1a2909631a3adea8866ee32187f74d0912387359b0ff36a2)
1421

1522
You can generate keys using both formats, and it is also possible to [work with existing Ethereum keys](#working-with-existing-ethereum-keys).
1623

@@ -55,7 +62,7 @@ Here are some details about the files generated:
5562
2. `public_key_hex` is a hexadecimal-encoded string of the public key
5663
3. `secret_key.pem` is the *PEM*-encoded secret key
5764

58-
The public-key-hex for `Ed25519` keys starts with 01 and is 66 bytes long:
65+
The public-key-hex for `Ed25519` keys starts with 01 and is 66 characters / 33 bytes long:
5966

6067
```bash
6168
cat ed25519-keys/public_key_hex
@@ -82,7 +89,7 @@ secp256k1-keys/
8289
0 directories, 3 files
8390
```
8491

85-
The public-key-hex for `Secp256k1` keys starts with 02 and is 68 bytes long:
92+
The public-key-hex for `Secp256k1` keys starts with 02 and is 68 characters / 34 bytes long:
8693

8794
```bash
8895
cat secp256k1-keys/public_key_hex
@@ -238,35 +245,37 @@ casper-client get-account-info \
238245
--public-key <FORMATTED STRING or PATH>
239246
```
240247

241-
1. `node-address` - An IP address of a peer on the network. The default port of nodes' JSON-RPC servers on Mainnet and Testnet is 7777
248+
1. `node-address` - An IP address of a peer on the network. The default port for JSON-RPC server, which is now served by Casper Sidecar from Casper 2.0 onwards on Mainnet and Testnet, is 7777. (Refer to [RPC Changes in Casper 2.0](../../condor/rpc-changes.md) for details)
249+
242250
2. `public-key` - This must be a properly formatted public key. The public key may instead be read in from a file, in which case, enter the path to the file as the argument. The file should be one of the two public key files generated via the `keygen` subcommand; "public_key_hex" or "public_key.pem"
243251

244252
<details>
245253
<summary>Sample command and output</summary>
246254

247255
```bash
248256
casper-client get-account-info --node-address http://65.21.75.254:7777 --public-key 0202ceafc0aa35f5a7bdda22f65c046b9b30b858459e18d3670f035839ad887fe5db
257+
249258
{
250-
"id": -2018234245556346849,
251259
"jsonrpc": "2.0",
260+
"id": -4442861421270275102,
252261
"result": {
262+
"api_version": "2.0.0",
253263
"account": {
254264
"account_hash": "account-hash-0ea7998b2822afe5b62b08a21d54c941ad791279b089f3f7ede0d72b477eca34",
255-
"action_thresholds": {
256-
"deployment": 1,
257-
"key_management": 1
258-
},
265+
"named_keys": [],
266+
"main_purse": "uref-974019c976b5f26412ce486158d2431967af35d91387dae8cbcd43c20fce6452-007",
259267
"associated_keys": [
260268
{
261269
"account_hash": "account-hash-0ea7998b2822afe5b62b08a21d54c941ad791279b089f3f7ede0d72b477eca34",
262270
"weight": 1
263271
}
264272
],
265-
"main_purse": "uref-974019c976b5f26412ce486158d2431967af35d91387dae8cbcd43c20fce6452-007",
266-
"named_keys": []
273+
"action_thresholds": {
274+
"deployment": 1,
275+
"key_management": 1
276+
}
267277
},
268-
"api_version": "1.4.15",
269-
"merkle_proof": "[29712 hex chars]"
278+
"merkle_proof": "[32920 hex chars]"
270279
}
271280
}
272281

282 KB
Loading

docs/users/delegating.md

Lines changed: 111 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,145 @@
11
# Delegating Tokens
22

3-
A feature of Proof-of-Stake protocols is that token holders can actively participate in the protocol through a mechanism known as **delegating** or **staking** with a validator. CSPR holders can stake their tokens with any validator on a Casper network. Alternatively, it is possible to stake tokens via an exchange or custody provider.
3+
Casper is a proof-of-stake blockchain, which means CSPR holders can earn rewards by staking their tokens with validators. This process is called delegation, a form of staking, and allows you to participate in securing the network without running a validator node yourself.
44

5-
Node operators stake their tokens to earn eligibility to propose and approve blocks on the network. They also run and maintain servers connected to the network. If they win a validator slot, they become validators and help enable the Proof-of-Stake aspect of the network, a process different from mining tokens. Validators thus earn rewards for participating and for securing the network.
5+
You maintain custody of your tokens. The validator never controls your funds. Instead, you delegate your stake to a validator of your choice, and you earn a share of their rewards.
6+
7+
68

7-
Anyone can participate in the protocol to earn rewards without maintaining a Casper node (a server that stores a copy of the blockchain). One can delegate or allocate CSPR tokens to a chosen validator on the network. Validators retain a percentage of the rewards generated from staked tokens. Participating in the protocol this way, the community can help improve the network's decentralization and security and earn rewards in return. Block explorers connected to the network usually post the base annual reward rate.
9+
## Selecting a Node for Delegating
810

9-
Casper does not treat validator stake differently than delegator stake for security reasons.
11+
1012

11-
## Delegation Cost
13+
It is essential to select a validating node that you can trust.
1214

13-
This section provides a detailed explanation of the delegation cost mechanism, how the gas cost relates to delegations, and where to find more details. Please note that the cost amounts are likely to change over time, and you may have to check the latest release details to get the most up-to-date and accurate delegation cost.
15+
1416

15-
The delegation cost is defined in the chainspec.toml file of a Casper network. In this [example chainspec](https://github.com/casper-network/casper-node/blob/release-2.0.0-rc1/resources/production/chainspec.toml), the delegation is set to cost 2.5 CSPR. However, `when you perform the delegation, you see that it costs a little more` than what is specified in the chainspec. Let's discuss why this happens.
17+
Block explorers such as [CSPR.live](https://cspr.live/) provide [validator performance statistics](https://cspr.live/validators), including a performance score, total stake, number of delegators, and fees. Please do your due diligence before staking tokens with a validator.
1618

17-
When you delegate, the system automatically charges some gas to set up related data in the global state of the network to track your delegation. This cost is added to the delegation cost defined in the chainspec file. Ensure you have extra CSPR in your account's main purse apart from the amount you are delegating; otherwise, the transaction will fail. For example, if you want to delegate 1000 CSPR, you need to have at least 1003 CSPR in your account's main purse.
19+
![CSPR.live Validators table](./_delegating/01-CSPR-live-Validators-list.png)
1820

19-
For example, the chainspec file in release 2.0.0 contains the following information. Notice the delegation cost specified with `delegate`.
21+
## What’s New with Delegation in Casper 2.0
2022

21-
```toml
22-
[system_costs.auction_costs]
23-
...
24-
delegate = 2_500_000_000
25-
undelegate = 2_500_000_000
26-
...
27-
```
23+
Casper 2.0 introduced Zug Consensus, a major upgrade that changed how validator rewards (and therefore delegator rewards) are calculated.
2824

29-
Delegation fees may change over time, so it is essential to stay current. To do so, select the latest release in [Github](https://github.com/casper-network/casper-node) and navigate to the `resources/production/chainspec.toml` file.
25+
Under the previous consensus model (Highway), rewards were distributed based on network-wide participation. If even one large validator underperformed, it could lower the rewards of every other validator and their delegators.
3026

31-
For further questions, please join the [Discord channel](https://discord.gg/caspernetwork).
27+
Under Zug, this is no longer the case. Now validator rewards are now individualized per block. Each validator earns rewards based on their own actions, specifically:
3228

33-
## Delegation Limits
29+
• Block proposals
3430

35-
The chainspec specifies delegation limits, such as the minimum and maximum amount allowed to be delegated. Also, each validator can have a maximum number of delegators.
31+
• Finality signature creation
3632

37-
```toml
38-
# Minimum allowed delegation amount in motes
39-
minimum_delegation_amount = 500_000_000_000
40-
# Maximum allowed delegation amount in motes
41-
maximum_delegation_amount = 1_000_000_000_000_000_000
42-
# The maximum amount of delegators per validator.
43-
max_delegators_per_validator = 1200
44-
```
33+
• Finality signature publication
4534

46-
## Selecting a Node for Delegating {#selecting-a-node-for-delegating}
35+
Poor performance affects only that validator. If a validator misses blocks or doesn’t publish signatures, they simply earn less. It does not impact others. Delegators are rewarded proportionally to their validator’s performance.
4736

48-
As a prospective delegator, it is essential to select a validating node that you can trust. Block explorers such as [cspr.live](https://cspr.live) provide [validator performance statistics](https://cspr.live/validators), including a performance score, total stake, number of delegators, and fees. Please do your due diligence before staking tokens with a validator.
37+
If you’re seeing lower rewards, it no longer means the whole network is underperforming, it likely means your validator didn’t reach full participation in that era (an era equals 2 hours).
4938

50-
![Validators](./_delegating/1.validators.png)
39+
**Rewards now fluctuate by design.**
5140

52-
## First-time Delegation
41+
Under Highway, rewards were stable. Delegators received the same amount per era. Under Zug, rewards can vary up to ~20% per era on mid to large size validators, depending on validator activity. The fluctuations in rewards may be higher on lower-weight validators.
5342

54-
If you perform a delegation for the first time, the system charges some motes to create a purse to hold the delegated tokens. We recommend that you try out delegations on the [Casper Testnet](https://testnet.cspr.live/) before making transactions on the [Casper Mainnet](https://cspr.live/). This will help you understand the costs involved in delegating tokens.
43+
Note that this variability is intentional. It creates stronger incentives for validators to consistently participate and boosts the network’s long-term security.
5544

56-
**Example:** The system can charge 0.5 CSPR in addition to the base delegation fee of 2.5 CSPR, resulting in a delegation cost of 3 CSPR on [Mainnet](https://cspr.live/).
45+
Over time, as validator behavior stabilizes, these fluctuations are expected to narrow.
5746

58-
When you set up a delegation transaction, it is essential to have enough funds in your account's main purse. Otherwise, the transaction will fail, and you will lose the delegation cost. For example, if you have 200 CSPR in your purse, delegate at most 197 CSPR and leave at least 3 CSPR for the delegation cost. Another option is to delegate 195 CSPR and leave some additional buffer.
47+
For a deeper explanation of how the Casper 2.0 reward system works, read: [Validator Rewards in Casper 2.0](https://docs.casper.network/condor/validator-rewards)
5948

60-
As a result, when performing a [delegation using the command line](../developers/cli/delegate.md), we recommend you specify a little more than the base transaction payment to ensure that the transaction will go through without failure.
49+
You can always check live validator performance and estimated rewards at [CSPR.live](https://cspr.live). The explorer has been updated to reflect Casper 2.0’s reward logic.
6150

62-
![**Figure 2** : On Testnet or Mainnet, the transaction fee for a delegation is a little bit higher than 2.5 CSPR.](./_delegating/economic-delegationDetails.png)
63-
<p align="center">
64-
**Figure 2** : On Testnet or Mainnet, the transaction fee for a delegation is a little bit higher than 2.5 CSPR.
65-
</p>
51+
## Why You Should Delegate Your CSPR & Things to Consider Before Choosing a Validator
6652

67-
:::note
53+
Casper is a Proof-of-Stake blockchain, meaning the network is secured, governed, and maintained by validators, and the delegators who support them.
6854

69-
Transaction costs depend on each Casper network and the cost tables defined in the chainspec. Most of these examples are from the Casper Mainnet or Testnet.
55+
When you delegate your CSPR tokens to a validator, you are not only earning rewards, but you are also actively participating in the security and governance of the Casper blockchain.
7056

71-
:::
57+
Validators participate in on-chain governance votes, and by delegating to them, you are indirectly expressing your voice on network decisions.
7258

73-
## Monitoring Rewards {#monitoring-rewards}
59+
### What to Look for When Choosing a Validator
7460

75-
It's recommended that you check in on how your stake is performing from time to time. If the validator you staked with decides to unbond, your stake will also be unbonded and you will not earn rewards. Ensure that the validator you selected performs as per your expectations.
61+
Before delegating your tokens via [CSPR.live](https://cspr.live), here are the key metrics you should pay attention to:
7662

77-
Validators have to win a staking auction by competing for a validator slot with prospective and current validators. This process is permissionless, meaning validators can join and leave the auction without restrictions, except for the unbonding wait period, which lasts 14 hours.
63+
1. Validator Performance
64+
65+
Check their performance score. This score shows how consistently the validator participates in block production and finality, which directly affects your staking rewards.
66+
67+
The performance indicator is based on on-chain metrics and conveys each validator’s success at consensus participation, as measured over the last 360 eras, which is approximately equal to a 30-day time frame. A validator that performed perfectly the last 360 eras, will have a 100% score. (Please note that it is very hard to achieve 100% due to the nature of distributed systems, and a performance value over 99% is considered excellent.)
68+
69+
2. Commission Fee
70+
71+
Each validator sets a commission rate — a percentage deducted from the staking rewards earned by delegators. This fee helps cover the validator’s operational costs and incentivizes their continued participation in securing the network. Reasonable commission rates are essential to maintaining a reliable, decentralized, and sustainable validator ecosystem.
72+
73+
3. Total Stake and Decentralization
74+
75+
Avoid delegating only to the top validators with very large stakes. Decentralization matters.
76+
77+
Supporting smaller but high-performing validators helps keep the network healthy and decentralized.
78+
79+
4. Validator’s Governance Participation
80+
81+
Validators vote on-chain on protocol-level decisions. Delegating to a validator means you trust them to represent your interests on the network. If you care about how the network evolves, this matters.
82+
83+
5. Validator Minimum Stake Requirements
84+
85+
Some validators set a custom minimum delegation amount (e.g., 1,000 CSPR). Make sure to check this before delegating.
86+
87+
6. Support Channels
88+
89+
It’s recommended to choose a validator that will be available for questions or support when needed.
90+
91+
----------
92+
93+
## Monitoring Your Stake
94+
95+
With Zug, rewards are now more directly tied to validator output. Check periodically to make sure your validator is still active and performing well.
96+
97+
If your validator stops producing blocks or unbonds, your rewards will stop, and you may need to redelegate once the unbonding period is over.
98+
99+
You can monitor your staking performance via [CSPR.live](https://cspr.live) or any updated block explorer.
100+
101+
## Minimum Stake Amounts and Enforcement
102+
103+
Casper 2.0 enforces a protocol-level minimum delegation amount of 500 CSPR. Any delegation below this amount will be rejected. This change aims to prevent inactive or negligible delegations from occupying validator slots, which are limited to 1,200 per validator.
104+
105+
Additionally, validators can now define their own minimum acceptable delegation amount. A validator may choose to only accept delegations of 1,000 CSPR or more.
106+
107+
If you attempt to delegate below a validator’s custom minimum, the transaction will not succeed.
108+
109+
The entire delegation will be automatically undelegated if the remaining delegated amount drops below the validator's minimum stake threshold, which can be 500 CSPR or above, based on the validator's config.
110+
111+
Note: Always leave enough staked to stay above the minimum enforcement level. If you’re unsure what the validator’s minimum is, check their listing on [CSPR.live](https://cspr.live/validators).
112+
113+
114+
## FAQ
115+
116+
### How often do I get staking rewards?
117+
118+
You get staking rewards every 2 hours. This is called an "Era". After you stake your tokens, your first reward may take up to 4 hours (2 Eras) to show up.
119+
120+
### I’ve staked my tokens but don’t see any rewards. What’s wrong?
121+
122+
That’s normal at first. Rewards don’t go directly to your wallet. They’re added to your existing stake with the validator. You can see them under the Rewards tab on [CSPR.live](https://cspr.live). It may take up to 6 hours (3 Eras) for the first rewards to appear.
123+
124+
### Is there a lock-up period after I stake my tokens?
125+
126+
No, your tokens aren’t locked when you stake. You can undelegate them anytime. But after undelegating, you’ll need to wait about 14 hours (7 Eras) for your tokens to become available again.
127+
128+
### Can I lose my tokens while staking?
129+
130+
Currently, no, slashing is not enabled on the Casper Mainnet, and there are no plans to enable it in the near future. If a validator behaves poorly on the network, they may be evicted from the auction, and you will not earn rewards during the period that the validator is evicted. If slashing is ever enabled in the future—which would require approval through a governance vote—tokens could be removed as a penalty for poor or malicious behavior on the network. In that case, you could lose tokens delegated to that validator.
131+
132+
### How much does it cost to stake and unstake?
133+
134+
To stake, you need 2.5 extra CSPR in your wallet (for network fees). To unstake, the cost is 2.5 CSPR as well.
135+
136+
### How much can I earn from staking?
137+
138+
Right now, the average yearly return is around 15%. This can change over time as more people stake. The base reward rate is 8% of the total token supply, but since not everyone stakes, those who do earn a higher percentage.
139+
140+
### What does a 100% commission rate mean for a validator?
141+
142+
It means the validator keeps all the rewards. If you stake with them, you will earn nothing. These validators usually don’t want to offer staking services or are not allowed to.
78143

79144
## Tutorials
80145

0 commit comments

Comments
 (0)