~zinigor/cardano-node/trunk

« back to all changes in this revision

Viewing changes to doc/stake-pool-operations/withdraw-rewards.md

  • Committer: Igor Zinovyev
  • Date: 2021-08-13 19:12:27 UTC
  • Revision ID: zinigor@gmail.com-20210813191227-stlnsj3mc5ypwn0c
Tags: upstream-1.27.0
ImportĀ upstreamĀ versionĀ 1.27.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## Withdrawing rewards
 
2
 
 
3
 
 
4
### Check the balance of the rewards address:
 
5
 
 
6
    cardano-cli query stake-address-info \
 
7
    --mainnet \
 
8
    --address $(cat stake.addr)
 
9
 
 
10
    [
 
11
        {
 
12
            "address": "stake_test1urxx5h9mhey1234566ek6uxqgtlkpvteqjqgaleddevpggfggxw",
 
13
            "delegation": "pool1ljq292q5xwz8t3ehmaw3c5p9xpr123456dnrxd40004ns6dy8v0",
 
14
            "rewardAccountBalance": 550000000
 
15
        }
 
16
    ]
 
17
 
 
18
 
 
19
### Query the payment address balance
 
20
 
 
21
You'll withdraw rewards into a payment.addr wich will pay for the transaction fees.
 
22
 
 
23
    cardano-cli query utxo --mainnet --address $(cat payment.addr)
 
24
 
 
25
                               TxHash                                 TxIx         Amount
 
26
    ----------------------------------------------------------------------------------------
 
27
    a82f8d2a85cde39118a894306ad7a85ba40af221406064a56bdd9b3c61153527     1         194054070 lovelace
 
28
 
 
29
### Draft the withdraw transaction to transfer the rewards to a payment.addr
 
30
 
 
31
    cardano-cli transaction build-raw \
 
32
    --tx-in a82f8d2a85cde39118a894306ad7a85ba40af221406064a56bdd9b3c61153527#1 \
 
33
    --tx-out $(cat payment.addr)+0 \
 
34
    --withdrawal $(cat stake.addr)+0 \
 
35
    --invalid-hereafter 0 \
 
36
    --fee 0 \
 
37
    --out-file withdraw_rewards.draft
 
38
 
 
39
### Calculate transaction fees
 
40
 
 
41
    cardano-cli transaction calculate-min-fee \
 
42
    --tx-body-file withdraw_rewards.draft  \
 
43
    --tx-in-count 1 \
 
44
    --tx-out-count 1 \
 
45
    --witness-count 2 \
 
46
    --byron-witness-count 0 \
 
47
    --mainnet \
 
48
    --protocol-params-file protocol.json
 
49
 
 
50
   > 171089
 
51
 
 
52
### Build the raw transaction.
 
53
 
 
54
    expr 194054070 - 171089 + 550000000
 
55
    743882981
 
56
 
 
57
    cardano-cli transaction build-raw \
 
58
    --tx-in a82f8d2a85cde39118a894306ad7a85ba40af221406064a56bdd9b3c61153527#1 \
 
59
    --tx-out $(cat payment.addr)+743882981 \
 
60
    --withdrawal $(cat stake.addr)+550000000 \
 
61
    --invalid-hereafter 12345678 \
 
62
    --fee 171089 \
 
63
    --out-file withdraw_rewards.raw
 
64
 
 
65
### Sign and submit the transactions
 
66
 
 
67
    cardano-cli transaction sign \
 
68
    --tx-body-file withdraw_rewards.raw  \
 
69
    --signing-key-file payment.skey \
 
70
    --signing-key-file stake.skey \
 
71
    --mainnet \
 
72
    --out-file withdraw_rewards.signed
 
73
 
 
74
    cardano-cli transaction submit \
 
75
    --tx-file withdraw_rewards.signed \
 
76
    --mainnet