File tree Expand file tree Collapse file tree 3 files changed +58
-3
lines changed
jcli/src/jcli_app/certificate Expand file tree Collapse file tree 3 files changed +58
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## how to create the delegation certificate
4
4
5
- Stake is concentrated in accounts, and you will need your account public key to
6
- delegate its associated stake.
5
+ Stake is concentrated in accounts, and you will need account public key to delegate its associated stake.
7
6
8
- You will need your:
7
+ ### for own account
8
+
9
+ You will need:
10
+
11
+ * the Stake Pool ID: an hexadecimal string identifying the stake pool you want
12
+ to delegate your stake to.
13
+
14
+ ``` sh
15
+ jcli certificate new owned-stake-delegation STAKE_POOL_ID > stake_delegation.cert
16
+ ```
17
+
18
+ Note that the certificate is in blaco, there's no account key used for its creation.
19
+ In order for delegation to work it must be submitted to a node inside a very specific transaction:
20
+
21
+ * Transaction must have exactly 1 input
22
+ * The input must be from account
23
+ * The input value must be strictly equal to fee of the transaction
24
+ * Transaction must have 0 outputs
25
+
26
+ The account used for input will have its stake delegated to the stake pool
27
+
28
+ ### for any account
29
+
30
+ You will need:
9
31
10
32
* account public key: a bech32 string of a public key
11
33
* the Stake Pool ID: an hexadecimal string identifying the stake pool you want
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use std::path::{Path, PathBuf};
7
7
use structopt:: StructOpt ;
8
8
9
9
mod get_stake_pool_id;
10
+ mod new_owner_stake_delegation;
10
11
mod new_stake_delegation;
11
12
mod new_stake_pool_registration;
12
13
mod sign;
@@ -74,6 +75,8 @@ pub enum NewArgs {
74
75
StakePoolRegistration ( new_stake_pool_registration:: StakePoolRegistration ) ,
75
76
/// build a stake delegation certificate
76
77
StakeDelegation ( new_stake_delegation:: StakeDelegation ) ,
78
+ /// build an owner stake delegation certificate
79
+ OwnerStakeDelegation ( new_owner_stake_delegation:: OwnerStakeDelegation ) ,
77
80
}
78
81
79
82
#[ derive( StructOpt ) ]
@@ -99,6 +102,7 @@ impl NewArgs {
99
102
match self {
100
103
NewArgs :: StakePoolRegistration ( args) => args. exec ( ) ?,
101
104
NewArgs :: StakeDelegation ( args) => args. exec ( ) ?,
105
+ NewArgs :: OwnerStakeDelegation ( args) => args. exec ( ) ?,
102
106
}
103
107
Ok ( ( ) )
104
108
}
Original file line number Diff line number Diff line change
1
+ use crate :: jcli_app:: certificate:: { weighted_pool_ids:: WeightedPoolIds , write_cert, Error } ;
2
+ use chain_impl_mockchain:: certificate:: { Certificate , OwnerStakeDelegation as Delegation } ;
3
+ use jormungandr_lib:: interfaces:: Certificate as CertificateType ;
4
+ use std:: convert:: TryInto ;
5
+ use std:: ops:: Deref ;
6
+ use std:: path:: PathBuf ;
7
+ use structopt:: StructOpt ;
8
+
9
+ #[ derive( StructOpt ) ]
10
+ pub struct OwnerStakeDelegation {
11
+ #[ structopt( flatten) ]
12
+ pool_ids : WeightedPoolIds ,
13
+
14
+ /// write the output to the given file or print it to the standard output if not defined
15
+ #[ structopt( short = "o" , long = "output" ) ]
16
+ output : Option < PathBuf > ,
17
+ }
18
+
19
+ impl OwnerStakeDelegation {
20
+ pub fn exec ( self ) -> Result < ( ) , Error > {
21
+ let cert = Certificate :: OwnerStakeDelegation ( Delegation {
22
+ delegation : ( & self . pool_ids ) . try_into ( ) ?,
23
+ } ) ;
24
+ write_cert (
25
+ self . output . as_ref ( ) . map ( |x| x. deref ( ) ) ,
26
+ CertificateType ( cert) ,
27
+ )
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments