Skip to content

Commit

Permalink
Merge pull request #136 from anoma/bengt/testnet-13
Browse files Browse the repository at this point in the history
gas and fees included
  • Loading branch information
bengtlofgren authored Sep 11, 2023
2 parents 7bafcf8 + 076cf2a commit c214045
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 14 deletions.
8 changes: 4 additions & 4 deletions packages/docs/pages/networks/testnets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ For more context read:
[Announcing Namada Public Testnets](https://blog.namada.net/announcing-namada-public-testnets/)

## Latest Testnet
- Namada public testnet 12 (offline):
- From date: 17th of August 2023 17.00 UTC
- Namada protocol version: `v0.21.1`
- Namada public testnet 13:
- From date: 12th of September 2023 17:00 UTC
- Namada protocol version: `v0.22.0`
- Cometbft version: `0.37.2`
- CHAIN_ID: `public-testnet-12.fedec12f3428`
- CHAIN_ID: `TBD`

The history of all testnets can be found [here](./testnets/testnet-history.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Make sure you are using the correct CometBFT version
- `cometbft version` should output `0.37.2`
- Make sure you are using the correct Namada version
- `namada --version` should output `Namada v0.21.1`
- `namada --version` should output `Namada v0.22.0`

</Steps>
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ rm -rf $BASE_DIR/*

### Check that namada and cometbft binaries are correct.

`namada --version` should yield `v0.15.3` and `cometbft version` should output `0.37.2`
`namada --version` should yield `v0.22.0` and `cometbft version` should output `0.37.2`



Expand Down
12 changes: 9 additions & 3 deletions packages/docs/pages/networks/testnets/testnet-history.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ TBD

## Latest Testnet

***17/08/2023*** `public-testnet-12` (offline)
***17/08/2023*** `public-testnet-13`

The testnet launched on 17/08/2023 at 17:00 UTC with the genesis validators from `public-testnet-12`. It launched with [version v0.21.1](https://github.com/anoma/namada/releases/tag/v0.21.1) and chain-id `public-testnet-12.fedec12f3428`.
If your genesis transaction is contained in [this folder](https://github.com/anoma/namada-testnets/tree/main/namada-public-testnet-12), you are one of the genesis validators. In order for the testnet to come online, at least 2/3 of those validators need to be online.
The testnet launched on 12/09/2023 at 17:00 UTC with the genesis validators from `public-testnet-13`. It launched with [version v0.22.0](https://github.com/anoma/namada/releases/tag/v0.22.0) and chain-id `TBD`.
If your genesis transaction is contained in [this folder](https://github.com/anoma/namada-testnets/tree/main/namada-public-testnet-13), you are one of the genesis validators. In order for the testnet to come online, at least 2/3 of those validators need to be online.

The installation docs are updated and can be found [here](./environment-setup.md). The running docs for validators/full nodes can be found [here](../../ledger/running-a-full-node.md).

## Testnet History

## Testnet History Timeline

- Namada public testnet 12:
- From date: 17th of August 2023 17.00 UTC
- Namada protocol version: `v0.21.1`
- Cometbft version: `0.37.2`
- CHAIN_ID: `public-testnet-12.fedec12f3428`

- Namada public testnet 11:
- From date: 2nd of August 2023 17.00 UTC
- Namada protocol version: `v0.20.1`
Expand Down
64 changes: 62 additions & 2 deletions packages/docs/pages/users/fees.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Fees on Namada

In order to settle the market for Namada blockspace demand, fees are coupled with transactions. In order for any namada transaction to be considered valid, the correct corresponding fee must be paid. All fees are paid in the native token NAM. The exact fee is set by governance.
In order to settle the market for Namada blockspace demand, fees are coupled with transactions. In order for any namada transaction to be considered valid, the correct corresponding fee must be paid. The exact fee is set by the user, and must be greater than or equal to the minimum `gas-price` set by governance, which is included in the genesis file under `gas_cost`.

## How fees are paid
When explicitly stated, the gas fee is paid by the `--gas-payer` flag. If no `--gas-payer` flag is specified, the gas fee is paid by the first key in the `--signing-keys` flag.

Fees on Namada are paid by the public key corresponding to first key that appears in the list of `--signing-keys` of the transaction. This means that in the transaction
This means that in the transaction
```shell copy
namada client transfer \
--source my-new-acc \
Expand All @@ -31,3 +32,62 @@ namada client transfer \
(Assuming that `keysha2` exists and is in the wallet of the user)

For testnet purposes, we recommend [using the faucet](../networks/testnets/pow.md) to source NAM for transaction fees.

## How fees are calculated
The fee for a transaction is calculated by multiplying `gas-limit` by the gas price.
Both the `--gas-limit` and the `--gas-price` can be specified by the user. If neither is specified, the default gas limit and minimum gas price is used. The default gas limit for any transaction is currently set to `20_000`.

The minimum gas price is set in the genesis file under `gas_cost`.

## How to set the gas price and gas limit

It is recommended to set the `gas-limit` based on the transaction being conducted. In order to estimate the `gas-limit` for a particular transaction, the `--dry-run-wrapper` argument should be provided. This means that the transaction is simulated, but not yet sent to the ledger.

For example, the following command will simulate a transfer transaction, and return the gas used:

```shell copy
namadac transfer \
--source my-new-acc \
--target validator-1 \
--token NAM \
--amount 10 \
--signing-keys keysha \
--gas-payer keysha2 \
--dry-run-wrapper
```

Which will ouptut something along the lines of

```md
Dry-run result: Transaction is valid. Gas used: 1785;
```
This means that we could reasonably make this transfer transaction with a `gas-limit` of 2000.

Hence, when making the transfer, we could specify the `gas-limit` as follows:

```shell copy
namadac transfer \
--source my-new-acc \
--target validator-1 \
--token NAM \
--amount 10 \
--signing-keys keysha \
--gas-payer keysha2 \
--gas-limit 2000
```

If for some reason, we wanted to pay a higher gas fee, we could also specify that as follows:

```shell copy
namadac transfer \
--source my-new-acc \
--target validator-1 \
--token NAM \
--amount 10 \
--signing-keys keysha \
--gas-payer keysha2 \
--gas-limit 2000 \
--gas-price 0.01
```
This will incentivise validators to prioritise this transaction above those with a lower gas price.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Then, send a transaction to initialize your new established account and save its
namada client init-account \
--alias establishment \
--public-keys keysha \
--source keysha
--source keysha \
--threshold 1
```

Once this transaction has been applied, the client will automatically see the new address created by the transaction and add it to your wallet with the chosen alias `establishment`.
Expand All @@ -31,7 +32,8 @@ namada client transfer \
--source establishment \
--target validator-1 \
--token NAM \
--amount 10
--amount 10 \
--signing-keys keysha
```

This command will attempt to find and use the key of the source address to sign the transaction.
Expand All @@ -46,7 +48,7 @@ namada client balance --token NAM --owner my-new-acc

<Callout type="info">
For any client command that submits a transaction (`init-account`, `transfer`, `tx`, `update` and [PoS transactions](../../operators/validators/proof-of-stake.mdx)),
you can use the `--dry-run` flag to simulate the transaction being applied in the block and see what would be the result.
you can use the `--dry-run-wrapper` flag to simulate the transaction being applied in the block and see what would be the result.
</Callout>

### See every known addresses' balance
Expand Down

0 comments on commit c214045

Please sign in to comment.