Skip to content

Commit

Permalink
update sections on wallet and transparent accounts (#352)
Browse files Browse the repository at this point in the history
* update sections on wallet and transparent accounts

* edit broken links

* edit broken link
  • Loading branch information
iskay authored May 30, 2024
1 parent 0b61668 commit fa84dd4
Show file tree
Hide file tree
Showing 13 changed files with 351 additions and 262 deletions.
3 changes: 2 additions & 1 deletion packages/docs/pages/integrating-with-namada/_meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"sdk" : "Using the SDK",
"light-sdk": "Using the Light SDK",
"indexer": "Using the Indexer"
"indexer": "Using the Indexer",
"interface": "Namada Interface"
}
34 changes: 34 additions & 0 deletions packages/docs/pages/integrating-with-namada/interface.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Namada Interface

## Front end development with Namada
The [namada-interface repository](https://github.com/anoma/namada-interface) is a monorepo which contains the Namada browser extension
and associated Namada-Interface web app. It's a great resource for developers wishing to understand how to incorporate the Namada SDK
into their front-end applications.

### Installing from source (for development and experiment purposes)

#### Connect to a testnet or run a local node
1. Follow the instructions for the [testnets](../networks/testnets.mdx) to connect to a testnet or [set up a local node](../operators/networks/local-network.mdx).
2. Figure out where the base directory is stored and save its location as a variable such as `export BASE_DIR=<path/to/base/dir>`.
You can follow [these docs](../networks/testnets/migrating-testnets.mdx) to save this variable. Go ahead and save the chain id as a variable as well. You can find the chain id by running `cat $BASE_DIR/global-config.toml`. Save this chain-id to the variable `export CHAIN_ID=<CHAIN_ID>`.
3. You will need to edit the CometBFT config in order to allow the web wallet to connect to your node.
The CometBFT config will be located in `$BASE_DIR/$CHAIN_ID/cometbft/config/config.toml`. You will need to change the `cors_allowed_origins` field to `["*"]`. You can do this by running
```shell copy
sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = ["*"]/' \
$BASE_DIR/$CHAIN_ID/cometbft/config/config.toml
```

#### Setting up the extension
1. Clone the [namada-interface repository](https://github.com/anoma/namada-interface).
2. Follow the installation instructions in `README.md`.
3. `cd` into the `namada-interface/apps/extension` directory and run `yarn start:chrome`. This will build the extension and place it in the `namada-interface/apps/extension/build` directory. It also starts the dev server which will watch for changes.
4. `cd` into the `namada-interface/apps/namada-interface` directory and run `yarn dev:local` in order to launch a local instance of the web wallet.
4. Add the extension to the browser. For example, in Chrome, you can go to `chrome://extensions/` and click `Load unpacked` and select the `namada-interface/apps/extension/build/chrome/` folder.

## Receiving tokens
You can show the address of any account by pressing the `Receive` button in the initial view under the "Total Balances" tab. You can copy the address by clicking the copy icon next to the address.
This will also display a QR code that can be scanned by a mobile wallet.

## Sending Transactions

In order to send transactions, you can press the `Send` button in the initial view under the "Total Balances" tab. This will open a modal that will allow you to send tokens to any account, from any account in your wallet that has a positive balance.
10 changes: 7 additions & 3 deletions packages/docs/pages/users.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# User Guide

This guide is tailored towards users who are interested in using Namada to its maximum potential. This guide will include both the most basic operations that a user can execute, as well as the more advanced features that a user can access.
This section covers usage of the Namada software from an end user perspective, including the procedures and commands to create and manage keypairs,
make transparent and shielded transactions, stake tokens, and participate in governance.

## Table of contents

- [Using the Namada wallet](./users/wallet.mdx)
- [Transparent Accounts](./users/transparent-accounts.mdx)
- [The MASP](./users/shielded-accounts.mdx)
- [Fees on Namada](./users/fees.mdx)
- [Delegating on Namada](./users/delegators.mdx)
- [Bonding and Proof-of-stake](./users/delegators.mdx)
- [Governance and Public Goods Funding](./users/governance.mdx)
- [Using the Namada wallet](./users/wallet.mdx)
- [PGF](./users/public-goods-stewards.mdx)
- [IBC transfers](./users/ibc.mdx)
- [Querying the chain](./users/query.mdx)

3 changes: 2 additions & 1 deletion packages/docs/pages/users/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"delegators": "Bonding and Proof-of-stake",
"governance": "Governance and Public Goods Funding",
"public-goods-stewards": "PGF",
"ibc": "IBC transfers"
"ibc": "IBC transfers",
"query": "Querying the chain"
}
104 changes: 11 additions & 93 deletions packages/docs/pages/users/transparent-accounts.mdx
Original file line number Diff line number Diff line change
@@ -1,106 +1,24 @@
import { Callout } from 'nextra-theme-docs'

# An Introduction to Namada Addresses

All accounts in Namada have a unique address, exactly one Validity Predicate and optionally any additional data in its dynamic storage sub-space.

There are currently 3 types of account addresses:
- **Implicit:** An implicit account is derived from your keypair and can be used to authorize certain transactions from the account. Implicit accounts have no code attached to them, and can only have one key controlling it. This differs it from established accounts, which can support multiple keys.
- **Established:** An established account is a associated with one or more cryptographic keys. Each account has the `vp_user` predicate which validate any associated transaction. The main purpose of this code is to ensure that the multisignature threshold is correctly met and stores the keys that verify transactions. All established accounts will be initialized through on-chain transactions, unlike implicit accounts, which exist as soon as the keypair is generated.
- **Internal:** Special internal accounts, such as protocol parameters account, PoS and IBC.
- **Implicit:** An implicit account is the simplest account type. It is derived from a keypair and can be used to authorize certain transactions such as sending and staking tokens, or paying [fees](./fees.mdx).
Implicit accounts have no code attached to them, and can only have one key controlling it. This differs it from established accounts,
which can support multiple keys.
- **Established:** Unlike implicit accounts, which exist as soon as the keypair is generated, an established account must be initialized
with an on-chain transaction. It is associated with one or [more](./transparent-accounts/multisignature.mdx) cryptographic keys. An established account
has the `vp_user` validity predicate which validates any associated transaction to ensure that the multisignature threshold is correctly met.
- **Internal:** These are special internal accounts, such as those for the protocol parameters, proof of stake and IBC modules.

## Manage keypairs
## Managing keypairs

Namada uses [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) keypairs for signing cryptographic operations on the blockchain.

To manage your keys, various sub-commands are available under:

```shell copy
namada wallet --help
```

### Generate a keypair

It is possible to generate keys using the CLI. By doing so, an implicit account address is also derived in the process and added to storage.

<Callout type="info" emoji="🤡">
Note the use of the placeholder `keysha` for the key parameter. This is a completely configurable parameter, and should just refer to the alias of the key signing the transaction (that has a positive nam balance).
</Callout>

```shell copy
KEY_ALIAS="keysha"
namada wallet gen --alias $KEY_ALIAS
```

<Callout type="info">
The derived implicit address shares the same `keysha` alias. The previous command has the same effect as `namada wallet gen --alias keysha`.
</Callout>
The `namadaw` binary is used for key management. Various sub-commands are available under:

By default, the keys are stored encrypted.
The encryption password is _not_ a part of key generation randomness.

Namada wallet supports keypair generation using a [mnemonic code](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) and [HD derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki).
To generate a keypair for a default path use
```shell copy
KEY_ALIAS="keysha"
namada wallet gen --alias $KEY_ALIAS --hd-path default
namadaw --help
```

<Callout type="info">
The default HD path for Namada is `m/44'/877'/0'/0'/0'`.
</Callout>

Optionally, the user may specify an additional passphrase that _is used_ as a part of keypair generation randomness.

<Callout type="error" emoji="🚨">
WARNING: Keep your mnemonic code and passphrase safe.
Loss of any of them would inevitably lead to impossible account recovery.
</Callout>

### Restore the keypair

To recover the keypair from your mnemonic code and passphrase use
```shell copy
namada wallet derive --alias keysha --hd-path default
```

This will ask you to then enter a passphrase (unless you add the `--unsafe-dont-encrypt` flag),
and then will ask you to enter your mnemonic code.

### List all known keys

```shell copy
namada wallet list --keys
```

## Manage addresses


To manage addresses, similar to keys, various sub-commands are available:

```shell copy
namada wallet --help
```

### Generate an implicit address

Let's call the implicit address `accountant`:
```shell copy
namada wallet gen --alias accountant
```

```shell copy
namada wallet gen --alias keysha --hd-path default
```
generates an address using a [mnemonic code](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) and [HD derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki).

### Restore the address

```shell copy
namada wallet derive --alias keysha --hd-path default
```
### List all known addresses

```shell copy
namada wallet list --addr
```
See also: [File system wallet](../users/wallet/file-system-wallet.mdx) for examples and additional info on using `namadaw` to manage your keys.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Callout } from 'nextra-theme-docs'

# Established accounts

Unlike implicit accounts, which exist as soon as the keypair is generated, an established account must be initialized
with an on-chain transaction. It is associated with one or [more](./multisignature.mdx) cryptographic keys.

## Generating an established account

<Callout type="info">
Before submitting the transaction to initialize an established account, you must have created an [implicit](./implicit-accounts.mdx) account and funded it with enough
funds to pay for the transaction [fees](../fees.mdx).
</Callout>

Initializing an established account entails submitting an `init-account` transaction on-chain to associate the account with
one or more public keys. We'll use the aliases `my-implicit` and `my-established` in this example, where the `my-implicit` account is assumed to have been previously been
created and funded.

We can create a new established account `my-established` and associate it with the public key of `my-implicit` with:
```
namadac init-account --alias my-established --public-keys my-implicit --signing-keys my-implicit --threshold 1
```
Note that:
- the implicit account `my-implicit` is required to sign the init-account transaction and pay the associated fees (with the `--signing-keys` argument)
- One public key is being associated with the account, and the signing threshold is 1. Technically, all established accounts are multisignature accounts
and therefore a 'typical' established account can be considered a '1 of 1' multisignature account. See [here](./multisignature.mdx)
for further details on using multisignature accounts with multiple keys.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Callout } from 'nextra-theme-docs'

# Implicit accounts

An implicit account is the simplest account type. It is derived from a keypair and can be used to authorize certain transactions such as sending and staking tokens, or paying [fees](../fees.mdx).
Implicit accounts have no code attached to them, and can only have one key controlling it.

## Generating an implicit account
You can generate a new implicit account using the CLI. The new keypair will be added to your `wallet.toml` under the alias you provide.

<Callout type="info">
The 'alias' of an account simply provides a convenient way of referring to addresses stored in your `wallet.toml` file by name.
It is not intrinsic to the account.
</Callout>

```shell copy
namada wallet gen --alias <choose an alias>
```

You will be prompted to provide a password, as the keys are stored to disk encrypted. Carefully remember this password; you will need it to sign transactions with your key.
The encryption password is _not_ a part of key generation randomness.

After generating the new key, a twenty-four word mnemonic will be displayed, which can be used to recover your account. Write this down immediately and
store it safely offline, as it will not be displayed again.

<Callout type="error" emoji="🚨">
WARNING: Keep your mnemonic code and passphrase safe.
Loss of either can result in you being locked out of your accounts with no chance of recovering your funds.
</Callout>

##### Derivation path

Namada wallet supports keypair generation using a [mnemonic code](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) and [HD derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki).

<Callout type="info">
The default HD path for Namada is `m/44'/877'/0'/0'/0'`.
</Callout>

Optionally, the user may specify an additional passphrase that _is used_ as a part of keypair generation randomness.


Loading

0 comments on commit fa84dd4

Please sign in to comment.