Skip to content

Commit 5db3997

Browse files
authored
Merge branch 'main' into dependabot/go_modules/examples/developer-hub-go/examples-go-all-e77bb86878
2 parents 3e44c83 + e34dc77 commit 5db3997

File tree

4 files changed

+118
-78
lines changed

4 files changed

+118
-78
lines changed

automations/uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/network/guides/using-flare-stake-tool.mdx

Lines changed: 99 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ keywords: [intermediate, solidity, smart-contract, flare-network]
77
sidebar_position: 9
88
---
99

10+
import Tabs from "@theme/Tabs";
11+
import TabItem from "@theme/TabItem";
12+
1013
Staking works by locking funds for a period of time to support a specific network validator. The guide details out how to stake using the [flare-stake-tool](https://github.com/flare-foundation/flare-stake-tool) CLI.
1114

1215
<details>
@@ -74,7 +77,7 @@ Install the following tools:
7477
| _| | | (_| | | | __/ ___) | || (_| | < __/ | |___| |___ | |
7578
|_| |_|\__,_|_| \___| |____/ \__\__,_|_|\_\___| \____|_____|___|
7679
77-
Version: 3.0.2
80+
Version: 4.1.2
7881
```
7982

8083
3. You can specify the account from which staking will take place in different ways - [using Ledger](#using-ledger-recommended) or [using a private key](#using-private-key).
@@ -220,7 +223,7 @@ It is highly recommended to [use Ledger](#using-ledger-recommended) instead.
220223
### Check validator info
221224

222225
1. Note down the `NodeID` of the validator you want to stake to:
223-
- If you created the validator, retrieve its `NodeID` by running:
226+
- If you created the validator, retrieve its `NodeID`, `publicKey` and `proofOfPossession` by running:
224227

225228
```bash
226229
curl \
@@ -278,6 +281,7 @@ It is highly recommended to [use Ledger](#using-ledger-recommended) instead.
278281
```plaintext
279282
? What do you want to do? Move assets from C-chain to P-chain
280283
? Enter amount (in FLR): 50000
284+
? Enter fees (in FLR): (1)
281285
```
282286

283287
:::warning[Transaction Fees]
@@ -295,19 +299,12 @@ It is highly recommended to [use Ledger](#using-ledger-recommended) instead.
295299
Using network: flare
296300
Fetching account from ledger...
297301
Creating export transaction...
298-
Using fee of 0.00028075 FLR
299-
Please review and sign the transaction on your ledger device...
300-
Sending transaction to the node...
301-
Transaction with id ●●●●●●●● sent to the node
302+
Transaction finalized!
302303
// highlight-next-line
303304
Please approve import transaction
304305
Using network: flare
305306
Fetching account from ledger...
306-
Creating export transaction...
307-
Please review and sign the transaction on your ledger device...
308-
Sending transaction to the node...
309-
Transaction with id ●●●●●●●● sent to the node
310-
Finished execution
307+
Creating import transaction...
311308
```
312309

313310
If you encounter any issues during this process, refer to the [Troubleshooting](#troubleshooting) section.
@@ -324,27 +321,9 @@ If you encounter any issues during this process, refer to the [Troubleshooting](
324321

325322
- If you are going to stake to another node (delegation), select **Delegate to a validator node** (You may need to scroll down to see this option).
326323

327-
:::info[First-time address registration.]
328-
329-
The first time you use the **Add a validator node** or **Delegate to a validator node** options you are asked to sign an additional transaction.
330-
This step is required so that staking rewards accrued on the P-chain can be claimed on the C-chain and participate in the wider ecosystem.
331-
332-
This procedure only needs to be done once per P-chain address:
333-
334-
```plaintext
335-
Checking Address Registration...
336-
No address found for key 0x●●●●●●●●
337-
Note: You need to register your wallet address before you can delegate your funds
338-
// highlight-next-line
339-
Please complete this registration transaction to proceed
340-
Submitting txn to the chain
341-
```
342-
343-
:::
344-
345324
2. You then need to provide the following information:
346325
- **amount**: Amount must be provided in FLR units.
347-
- **NodeID**, **start time** and **end time**: Use the values noted down from the [setup](#setup).
326+
- **NodeID** and **end time**: Use the values noted down from the [setup](#setup).
348327

349328
If you are adding a validator node, you also need to provide the proof of possession **BLS public key** and **BLS signature**.
350329

@@ -381,7 +360,6 @@ If you encounter any issues during this process, refer to the [Troubleshooting](
381360
? What do you want to do? Add a validator node
382361
? Enter amount (in FLR): 50000
383362
? Enter Node NodeId (E.g. NodeID-FQKTLuZHEsjCxPeFTFgsojsucmdyNDsz1): NodeID-●●●●●●●●
384-
? Enter start time(E.g. 1693185095): ●●●●●●●●
385363
? Enter end time(E.g. 1693185095): ●●●●●●●●
386364
? Enter delegation fee(E.g. 10): 10
387365
? Please enter the popBLSPublicKey: 0x●●●●●●●●
@@ -472,28 +450,22 @@ If you encounter any issues, refer to [Troubleshooting](#troubleshooting).
472450
Using network: flare
473451
Fetching account from ledger...
474452
Creating export transaction...
475-
Please review and sign the transaction on your ledger device...
476-
Sending transaction to the node...
477-
Transaction with id ●●●●●●●● sent to the node
453+
? Enter fees (in FLR): (1)
478454
// highlight-next-line
479455
Please approve import transaction
480456
Using network: flare
481457
Fetching account from ledger...
482-
Creating export transaction...
483-
Using fee of 0.00028075 FLR
484-
Please review and sign the transaction on your ledger device...
485-
Sending transaction to the node...
486-
Transaction with id ●●●●●●●● sent to the node
458+
Creating import transaction...
487459
Finished execution
488460
```
489461

490462
If you encounter any issues, refer to [Troubleshooting](#troubleshooting).
491463

492-
## Claiming rewards
464+
## Claiming staking rewards
493465

494466
At the end of every reward epoch, participants are rewarded according to how well their chosen validator performed in that period, but these rewards are not claimable yet. Every 4 reward epochs, rewards are accumulated in a dedicated smart contract and can then be claimed from the Flare Stake CLI tool:
495467

496-
1. Select the **Claim Rewards** option when executing:
468+
1. Select the **Claim staking rewards** option when executing:
497469

498470
```bash
499471
flare-stake-tool interactive
@@ -502,27 +474,77 @@ At the end of every reward epoch, participants are rewarded according to how wel
502474
You are shown the amount of pending rewards (in wei) and are asked how much you want to claim (in FLR):
503475

504476
```plaintext
505-
? What do you want to do? Claim Rewards
506-
Checking your Rewards status...
507-
You have unclaimed rewards worth 1000000000000000000
508-
? Enter amount to claim (in FLR): 1
477+
? What do you want to do? Claim staking rewards
478+
State of rewards for 0x●●●●●●●●:
479+
Total rewards: 2000.0 FLR
480+
Claimed rewards: 1010.0 FLR
481+
Unclaimed rewards: 990.0 FLR
509482
```
510483

511-
2. Select **Receive with another wallet** and enter the C-chain address where you want the rewards to be sent.
512-
This can be the same address from where you are staking.
484+
2. Claim all or a portion of the rewards and optionally choose to wrap them or not:
485+
486+
<Tabs groupId="claim" block>
487+
488+
<TabItem value="all" label="Claim All" default>
489+
490+
```plaintext
491+
? Do you want to claim all unclaimed rewards? (total unclaimed: 990.0 FLR) Yes
492+
? Should claimed rewards be wrapped? Yes
493+
```
494+
495+
</TabItem>
496+
497+
<TabItem value="partial" label="Claim Partial">
513498

514499
```plaintext
515-
? Where do you want to receive your rewards? Receive with another wallet
516-
? Please enter the C-address where you want to receive your rewards: 0x●●●●●●●●
500+
? Do you want to claim all unclaimed rewards? (total unclaimed: 990.0 FLR) No
501+
? Please enter the amount to claim: 100
502+
? Should claimed rewards be wrapped? Yes
503+
```
504+
505+
</TabItem>
506+
507+
</Tabs>
508+
509+
3. Decide the recipient address for the rewards - defaults to the address you used to connect to the Flare Stake Tool.
510+
511+
```plaintext
512+
? Please enter the recipient address (default address is reward owner): 0x●●●●●●●●
517513
```
518514

519515
You are then asked to confirm the staking transaction on your hardware wallet.
520516

521-
```text hl_lines="1"
522-
Please sign the transaction on your ledger
523-
Submitting txn to the chain
524-
Rewards successfully claimed
525-
Finished execution
517+
```plaintext
518+
Using network: flare
519+
Creating claim transaction...
520+
Signing transaction...
521+
// highlight-next-line
522+
Transaction with hash 0x●●●●●●●● built and sent to the network
523+
```
524+
525+
## Transfer P-chain funds to another P-chain address
526+
527+
1. You can transfer P-chain funds to another P-chain address by selecting the **Transfer funds to another P-chain address** option:
528+
529+
```bash
530+
flare-stake-tool interactive
531+
```
532+
533+
```plaintext
534+
? What do you want to do?
535+
❯ Transfer funds to another P-chain address
536+
Claim staking rewards
537+
Quit
538+
```
539+
540+
2. Select the amount to transfer and the destination P-chain address:
541+
542+
```plaintext
543+
? Enter amount (in FLR): 100
544+
? Please enter the destination P-chain address: P-flare●●●●●●●●
545+
Using network: flare
546+
Fetching account from ledger...
547+
Creating transfer transaction...
526548
```
527549

528550
## Troubleshooting
@@ -555,18 +577,38 @@ Try the operation again after a while.
555577
Transfer operations require [an export and an import transaction](#move-funds-to-p-chain).
556578
If the export succeeds, but then the import fails, it looks like the funds have disappeared from both chains, but they are still retrievable.
557579

558-
Repeat the failed import operation manually:
580+
Import the funds using the interactive tool:
559581

560582
- If you are moving funds from the C-chain to the P-chain:
561583

562584
```bash
563-
flare-stake-tool transaction importCP --ledger --blind
585+
flare-stake-tool interactive
586+
```
587+
588+
```plaintext
589+
? What do you want to do?
590+
❯ Import Funds (in case export fails for either P chain or C chain)
591+
```
592+
593+
```plaintext
594+
? Please select the destination chain to which you want to import your funds? (Use arrow keys)
595+
❯ P
564596
```
565597

566598
- If you are moving funds from the P-chain to the C-chain:
567599

568600
```bash
569-
flare-stake-tool transaction importPC --ledger --blind
601+
flare-stake-tool interactive
602+
```
603+
604+
```plaintext
605+
? What do you want to do?
606+
❯ Import Funds (in case export fails for either P chain or C chain)
607+
```
608+
609+
```plaintext
610+
? Please select the destination chain to which you want to import your funds? (Use arrow keys)
611+
❯ C
570612
```
571613

572614
</details>

docs/run-node/2-from-source.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ Make sure to check the [hardware requirements](/run-node/system-requirements) be
132132
# Create a dedicated directory
133133
sudo mkdir -p /opt/flare/staking
134134
# Move your keys
135-
sudo mv ~/.avalanchego/staking/staker.key /opt/flare/staking/
136-
sudo mv ~/.avalanchego/staking/staker.crt /opt/flare/staking/
135+
sudo cp -r ~/.avalanchego/staking/* /opt/flare/staking/
137136
```
138137

139138
</TabItem>
@@ -144,8 +143,7 @@ Make sure to check the [hardware requirements](/run-node/system-requirements) be
144143
# Create a dedicated directory
145144
sudo mkdir -p /opt/coston2/staking
146145
# Move your keys
147-
sudo mv ~/.avalanchego/staking/staker.key /opt/coston2/staking/
148-
sudo mv ~/.avalanchego/staking/staker.crt /opt/coston2/staking/
146+
sudo cp -r ~/.avalanchego/staking/* /opt/coston2/staking
149147
```
150148

151149
</TabItem>
@@ -156,8 +154,7 @@ Make sure to check the [hardware requirements](/run-node/system-requirements) be
156154
# Create a dedicated directory
157155
sudo mkdir -p /opt/songbird/staking
158156
# Move your keys
159-
sudo mv ~/.avalanchego/staking/staker.key /opt/songbird/staking/
160-
sudo mv ~/.avalanchego/staking/staker.crt /opt/songbird/staking/
157+
sudo cp -r ~/.avalanchego/staking/* /opt/songbird/staking
161158
```
162159

163160
</TabItem>
@@ -168,8 +165,7 @@ Make sure to check the [hardware requirements](/run-node/system-requirements) be
168165
# Create a dedicated directory
169166
sudo mkdir -p /opt/coston/staking
170167
# Move your keys
171-
sudo mv ~/.avalanchego/staking/staker.key /opt/coston/staking/
172-
sudo mv ~/.avalanchego/staking/staker.crt /opt/coston/staking/
168+
sudo cp -r ~/.avalanchego/staking/* /opt/coston/staking
173169
```
174170

175171
</TabItem>

docs/run-node/4-register-validator.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Only provide values which differ from the defaults to avoid issues with future u
110110

111111
## Run the node
112112

113-
Now, start your node using command-line flags or environment variables that point to your `staker.key` and `staker.crt` files.
113+
Now, start your node using command-line flags or environment variables that point to your `staker.key`, `staker.crt` and `signer.key` files.
114114
This ensures your node always starts with the correct `Node-ID`.
115115

116116
### From source
@@ -124,12 +124,14 @@ This ensures your node always starts with the correct `Node-ID`.
124124
# Assumes staking keys are in the default location
125125
./build/avalanchego --network-id=flare \
126126
--http-host= \
127-
--bootstrap-ips="$(curl -sX POST --data '{"jsonrpc":"2.0", "id":1, "method":"info.getNodeIP"}' -H 'content-type:application/json;' [https://flare-bootstrap.flare.network/ext/info](https://flare-bootstrap.flare.network/ext/info) | jq -r '.result.ip')" \
128-
--bootstrap-ids="$(curl -sX POST --data '{"jsonrpc":"2.0", "id":1, "method":"info.getNodeID"}' -H 'content-type:application/json;' [https://flare-bootstrap.flare.network/ext/info](https://flare-bootstrap.flare.network/ext/info) | jq -r '.result.nodeID')" \
127+
--bootstrap-ips="$(curl -sX POST --data '{"jsonrpc":"2.0", "id":1, "method":"info.getNodeIP"}' -H 'content-type:application/json;' https://flare-bootstrap.flare.network/ext/info | jq -r '.result.ip')" \
128+
--bootstrap-ids="$(curl -sX POST --data '{"jsonrpc":"2.0", "id":1, "method":"info.getNodeID"}' -H 'content-type:application/json;' https://flare-bootstrap.flare.network/ext/info | jq -r '.result.nodeID')" \
129129
# highlight-next-line
130130
--staking-tls-cert-file="/opt/flare/staking/staker.crt" \
131131
# highlight-next-line
132-
--staking-tls-key-file="/opt/flare/staking/staker.key"
132+
--staking-tls-key-file="/opt/flare/staking/staker.key" \
133+
# highlight-next-line
134+
--staking-signer-key-file="/opt/flare/staking/signer.key"
133135
```
134136

135137
### Using Docker CLI
@@ -155,9 +157,9 @@ This ensures your node always starts with the correct `Node-ID`.
155157
-p 0.0.0.0:9651:9651 \
156158
-e NETWORK_ID="flare" \
157159
-e AUTOCONFIGURE_BOOTSTRAP="1" \
158-
-e AUTOCONFIGURE_BOOTSTRAP_ENDPOINT="[https://flare-bootstrap.flare.network/ext/info](https://flare-bootstrap.flare.network/ext/info)" \
160+
-e AUTOCONFIGURE_BOOTSTRAP_ENDPOINT="https://flare-bootstrap.flare.network/ext/info" \
159161
# highlight-next-line
160-
-e EXTRA_ARGUMENTS=--staking-tls-cert-file=/app/staking/staker.crt --staking-tls-key-file=/app/staking/staker.key \
162+
-e EXTRA_ARGUMENTS=--staking-tls-cert-file=/app/staking/staker.crt --staking-tls-key-file=/app/staking/staker.key --staking-signer-key-file=/app/staking/signer.key \
161163
flarefoundation/go-flare:${LATEST_TAG}
162164
```
163165

@@ -188,9 +190,9 @@ This ensures your node always starts with the correct `Node-ID`.
188190
environment:
189191
- NETWORK_ID=flare
190192
- AUTOCONFIGURE_BOOTSTRAP=1
191-
- AUTOCONFIGURE_BOOTSTRAP_ENDPOINT=[https://flare-bootstrap.flare.network/ext/info](https://flare-bootstrap.flare.network/ext/info)
193+
- AUTOCONFIGURE_BOOTSTRAP_ENDPOINT=https://flare-bootstrap.flare.network/ext/info
192194
# highlight-next-line
193-
- EXTRA_ARGUMENTS=--staking-tls-cert-file=/app/staking/staker.crt --staking-tls-key-file=/app/staking/staker.key
195+
- EXTRA_ARGUMENTS=--staking-tls-cert-file=/app/staking/staker.crt --staking-tls-key-file=/app/staking/staker.key --staking-signer-key-file=/app/staking/signer.key
194196
```
195197
196198
## Stake and verify
@@ -280,7 +282,7 @@ curl --data '{
280282
"method":"info.getNodeID",
281283
"id":1,
282284
"params":{}
283-
}' http://localhost:9650/ext/info | jq -r ".result.nodeID"
285+
}' -H 'content-type:application/json;' http://localhost:9650/ext/info | jq -r ".result.nodeID"
284286
```
285287

286288
Follow the instructions in the guide below to stake FLR to your `Node-ID`.

0 commit comments

Comments
 (0)