Skip to content

Commit a163880

Browse files
authored
Merge pull request #1347 from rinor/docs_20191212
Docs: jcli/transaction + stake_pool/delegating_stake - fix
2 parents a804e4b + 53bc747 commit a163880

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

doc/jcli/transaction.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,32 @@ status: finalizing
189189
190190
### Make witness
191191
192-
For signing the transaction, you need the private key associated with the input address (the one that's in the utxos) and the hash of the genesis block of the network you are connected to.
192+
For signing the transaction, you need:
193+
194+
- the hash of the genesis block of the network you are connected to.
195+
- the private key associated with the input address (the one that's in the utxos).
196+
- the hash of the transaction, that can be retrieved in two ways:
197+
1. `sign_data_hash` value from `jcli transaction info --staging tx` or
198+
2. `jcli transaction data-for-witness --staging tx`
193199

194200
The genesis' hash is needed for ensuring that the transaction cannot be re-used in another blockchain and for security concerns on offline transaction signing, as we are signing the transaction for the specific blockchain started by this block0 hash.
195201

202+
First we need to get the hash of the transaction we are going to sign.
203+
204+
```sh
205+
jcli transaction data-for-witness --staging tx
206+
```
207+
208+
You should see something like this (the value may be different since it depends on the input/output data)
209+
210+
```sh
211+
0df39a87d3f18a188b40ba8c203f85f37af665df229fb4821e477f6998864273
212+
```
213+
196214
The following command takes the private key in the *key.prv* file and creates a witness in a file named *witness* in the current directory.
197215

198216
```sh
199-
jcli transaction make-witness --genesis-block-hash abcdef987654321... --type utxo txid witness key.prv
217+
jcli transaction make-witness --genesis-block-hash abcdef987654321... --type utxo 0df39a87d3f18a188b40ba8c203f85f37af665df229fb4821e477f6998864273 witness key.prv
200218
```
201219

202220
---
@@ -208,7 +226,7 @@ When using an account as input, the command takes `account` as the type and an a
208226
e.g.
209227

210228
```sh
211-
jcli transaction make-witness --genesis-block-hash abcdef987654321... --type account --account-spending-counter 0 witness key.prv
229+
jcli transaction make-witness --genesis-block-hash abcdef987654321... --type account --account-spending-counter 0 0df39a87d3f18a188b40ba8c203f85f37af665df229fb4821e477f6998864273 witness key.prv
212230
```
213231

214232
### Add witness
@@ -233,6 +251,12 @@ Send it using the rest api
233251
jcli rest v0 message post -f txmsg --host http://127.0.0.1:8443/api
234252
```
235253

254+
You should get some data back referring to the TransactionID (also known as FragmentID)
255+
256+
```sh
257+
d6ef0b2148a51ed64531efc17978a527fd2d2584da1e344a35ad12bf5460a7e2
258+
```
259+
236260
## Checking if the transaction was accepted
237261

238262
You can check if the transaction was accepted by checking the node logs, for example, if the transaction is accepted

doc/stake_pool/delegating_stake.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You will need:
1212
to delegate your stake to.
1313

1414
```sh
15-
jcli certificate new owned-stake-delegation STAKE_POOL_ID > stake_delegation.cert
15+
jcli certificate new owner-stake-delegation STAKE_POOL_ID > stake_delegation.cert
1616
```
1717

1818
Note that the certificate is in blaco, there's no account key used for its creation.
@@ -34,7 +34,7 @@ You will need:
3434
to delegate your stake to.
3535

3636
```sh
37-
jcli certificate new stake-delegation ACCOUNT_PUBLIC_KEY STAKE_POOL_ID > stake_delegation.cert
37+
jcli certificate new stake-delegation ACCOUNT_PUBLIC_KEY STAKE_POOL_ID --output stake_delegation.cert
3838
```
3939

4040
## submitting to a node
@@ -72,8 +72,13 @@ delegation to happens, and for that we need a cryptographic signature.
7272
We will need the account secret key to create a signature
7373

7474
```sh
75-
cat stake_delegation.cert | jcli certificate sign account_key.prv | tee stake_delegation.signedcert
76-
signedcert1q9uxkxptz3zx7akmugk...7764rq
75+
jcli certificate sign --certificate stake_delegation.cert --key account_key.prv --output stake_delegation.signedcert
7776
```
7877

79-
The output can now be added in the `genesis config` file
78+
The content of `stake_delegation.signedcert` will be something like:
79+
80+
```sh
81+
signedcert1q9uxkxptz3zx7akmugkmt4ecjjd3nmzween2qfr5enhzkt37tdt4uqt0j0039z5048mu9ayv3ujep5sl28q2cpdnx9fkvpq30lmjrrgtmqqctzczvu6e3v65m40n40c3y2pnu4vhd888dygkrtnfm0ts92fe50jy0h0ugh6wlvgy4xvr3lz4uuqzg2xgu6vv8tr24jrwhg0l09klp5wvwzl5
82+
```
83+
84+
and can now be added in the `genesis config` file.

0 commit comments

Comments
 (0)