From 426666e9a90e8e27f446803f59c9f754d5f31b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadej=20Jane=C5=BE?= Date: Fri, 16 Oct 2020 11:31:29 +0200 Subject: [PATCH] doc: Further improvements to Generating and Signing Transactions doc --- .changelog/79.doc.md | 3 ++ docs/usage/address.md | 9 +++-- docs/usage/transactions.md | 83 ++++++++++++++++++++++++++++++++------ 3 files changed, 79 insertions(+), 16 deletions(-) create mode 100644 .changelog/79.doc.md diff --git a/.changelog/79.doc.md b/.changelog/79.doc.md new file mode 100644 index 0000000..b4772dc --- /dev/null +++ b/.changelog/79.doc.md @@ -0,0 +1,3 @@ +Refresh [Usage] docs + +[Usage]: docs/README.md#usage diff --git a/docs/usage/address.md b/docs/usage/address.md index 539bd0d..f74c20d 100644 --- a/docs/usage/address.md +++ b/docs/usage/address.md @@ -28,10 +28,13 @@ confirmation. To skip showing your wallet's address on your Ledger's screen, pass the `--skip-device` flag in the command above. -If you have more that one Ledger wallet connected, you'll need specify which -wallet to use by passing the `--wallet_id ` flag to the -command above, replacing `` with the ID of your Ledger wallet. +{% hint style="info" %} +In case you will have more than one Ledger wallet connected, you'll need to +specify which wallet to use by passing the `--wallet_id ` flag +to the command above, replacing `` with the ID of your Ledger +wallet. See [Identifying Wallets] for more details. +{% endhint %} {% hint style="info" %} You can obtain as many staking account addresses as needed for the same Ledger diff --git a/docs/usage/transactions.md b/docs/usage/transactions.md index 43e0ea5..180b910 100644 --- a/docs/usage/transactions.md +++ b/docs/usage/transactions.md @@ -71,35 +71,90 @@ If you need to specify multiple configuration keys in the {% endhint %} -Then, you can generate and sign a transaction, e.g. a transfer transaction, by -running: +Then, you can generate and sign a transaction by running: + +```bash +oasis-node stake account gen_ \ + "${TX_FLAGS[@]}" \ + --transaction.file tx.json \ + --transaction.nonce \ + --transaction.fee.gas \ + --transaction.fee.amount +``` + +where: + +- ``: type of transaction, e.g. `transfer`, `escrow`, `reclaim_escrow`, + ... +- ``: your account's current nonce, +- ``: maximum amount of gas this transaction can spend, +- ``: amount of tokens you will pay as a fee for this transaction. + +Besides these common transaction flags, you will need to specify additional +transaction flags specific to the chosen transaction type. Run +`oasis-node stake account gen_ --help` for more details. + +{% hint style="info" %} +For a more detailed explanation of the common transaction flags, see +[Common Transaction Flags] section of the [Use Your Tokens' Setup] doc. +{% endhint %} + +For example, to generate and sign a transfer transaction of 100 tokens to an +account with address `oasis1qpcgnf84hnvvfvzup542rhc8kjyvqf4aqqlj5kqh`, run: ```bash oasis-node stake account gen_transfer \ "${TX_FLAGS[@]}" \ - --stake.amount \ - --stake.transfer.destination \ - --transaction.file tx_transfer.json \ + --stake.amount 100000000000 \ + --stake.transfer.destination oasis1qpcgnf84hnvvfvzup542rhc8kjyvqf4aqqlj5kqh \ + --transaction.file tx.json \ --transaction.nonce 1 \ - --transaction.fee.gas 1000 \ + --transaction.fee.gas 2000 \ --transaction.fee.amount 2000 ``` -where `` and `` are replaced -with the amount of tokens to transfer and the address of the transfer's -destination account, respectively. - {% hint style="info" %} -For a more detailed explanation of the transaction flags that were set, see -[Common Transaction Flags] section of the [Use Your Tokens' Setup] doc. +The amounts passed via the `--stake.amount` and `--transaction.fee.amount` flags +are specified in nROSE units, i.e. 1 ROSE equals 1,000,000,000 nROSE. {% endhint %} -Next, verify the transaction's fields on your Ledger wallet's screen. +This will output a preview of the generated transaction: + +``` +You are about to sign the following transaction: + Nonce: 1 + Fee: + Amount: ROSE 0.000002 + Gas limit: 2000 + (gas price: ROSE 0.000000001 per gas unit) + Method: staking.Transfer + Body: + To: oasis1qpcgnf84hnvvfvzup542rhc8kjyvqf4aqqlj5kqh + Amount: ROSE 100.0 +Other info: + Genesis document's hash: a245619497e580dd3bc1aa3256c07f68b8dcc13f92da115eadc3b231b083d3c4 +``` + +and ask you to verify the transaction's fields on your Ledger wallet's screen. After you've confirmed the transaction's fields are correct, sign the transaction on your Ledger wallet by double-pressing the _Sign transaction_ screen. +{% hint style="info" %} +The next step after signing a transaction is to submit it to the network via +an online Oasis node by running: + +```bash +oasis-node consensus submit_tx \ + -a $ADDR \ + --transaction.file tx_transfer.json +``` + +For more details, see the [Transfer Tokens] document of the general +[Oasis Docs]. +{% endhint %} + [Use Your Tokens' Setup]: https://docs.oasis.dev/general/use-your-tokens/setup [Oasis Docs]: https://docs.oasis.dev/ @@ -110,4 +165,6 @@ screen. [Setup]: setup.md#remembering-path-to-ledger-signer-plugin [Exporting Public Key to Entity]: entity.md [Identifying Wallets]: wallets.md +[Transfer Tokens]: + https://docs.oasis.dev/general/use-your-tokens/transfer-tokens