Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #79 from oasisprotocol/tjanez/docs-txns
Browse files Browse the repository at this point in the history
doc: Further improvements to Generating and Signing Transactions doc
  • Loading branch information
tjanez authored Oct 16, 2020
2 parents fe03cb8 + 426666e commit e0ce36e
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .changelog/79.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Refresh [Usage] docs

[Usage]: docs/README.md#usage
9 changes: 6 additions & 3 deletions docs/usage/address.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <LEDGER-WALLET-ID>` flag to the
command above, replacing `<LEDGER-WALLET-ID>` 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 <LEDGER-WALLET-ID>` flag
to the command above, replacing `<LEDGER-WALLET-ID>` 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
Expand Down
83 changes: 70 additions & 13 deletions docs/usage/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-TYPE> \
"${TX_FLAGS[@]}" \
--transaction.file tx.json \
--transaction.nonce <NONCE> \
--transaction.fee.gas <GAS-LIMIT> \
--transaction.fee.amount <FEE>
```

where:

- `<TX-TYPE>`: type of transaction, e.g. `transfer`, `escrow`, `reclaim_escrow`,
...
- `<NONCE>`: your account's current nonce,
- `<GAS-LIMIT>`: maximum amount of gas this transaction can spend,
- `<FEE>`: 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_<TX-TYPE> --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 <AMOUNT-TO-TRANSFER> \
--stake.transfer.destination <DESTINATION-ACCOUNT-ADDRESS> \
--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 `<AMOUNT-TO-TRANSFER>` and `<DESTINATION-ACCOUNT-ADDRESS>` 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 %}

<!-- markdownlint-disable line-length -->
[Use Your Tokens' Setup]: https://docs.oasis.dev/general/use-your-tokens/setup
[Oasis Docs]: https://docs.oasis.dev/
Expand All @@ -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
<!-- markdownlint-enable line-length -->

0 comments on commit e0ce36e

Please sign in to comment.