Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet docs describing how to view account #570

Merged
merged 2 commits into from
Feb 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 88 additions & 15 deletions doc/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,59 @@ customized with additional accounts, objects, code, etc. as described


The network configuration is stored in `network.conf` and
can be used subsequently to start the network. A `wallet.conf` will
also be generated to be used by the `wallet` binary to manage the
can be used subsequently to start the network. A `wallet.conf` is
also created to be used by the sui wallet to manage the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize Sui throughout the plain text for consistency with other docs.

newly created accounts.

### View created accounts
The genesis process creates a configuration file `wallet.conf` for the sui wallet,
the config file contains information of the accounts and the sui network,
sui wallet uses the network information to communicate with the siu network authorities
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace "siu" with "Sui"

and create transactions using the key pairs reside in the config file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

residing


Below is an example of `wallet.conf` showing the accounts and key pairs in the wallet configuration.
```json
{
"accounts": [
{
"address": "a4c0a493ce9879ea06bac93461810cf947823bb3",
"key_pair": "MTpXG/yJq0OLOknghzYRCS6D/Rz+97gpR7hZhUCUNT5pMCy49v7hZkCSHm38e+cp+sdxLgTrSAuCbDxqkF1MTg=="
},
...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a placeholder for omitted values. If it's indeed the case, then it may make sense to mention this explicitly to remove temptation to copy test this configuration verbatim.

],
"authorities": [
{
"name": "d72e7bd8f435fa56af47c8d0a0b8738c48f446762d620863ac328605325692f7",
"host": "127.0.0.1",
"base_port": 10000
},
...
],
"send_timeout": {
"secs": 4,
"nanos": 0
},
"recv_timeout": {
"secs": 4,
"nanos": 0
},
"buffer_size": 65507,
"db_folder_path": "./client_db"
}
```
The `accounts` variable contains all the account's address and key pairs, this will be used by the wallet to sign transactions.
`authorities` contains Sui network authorities' name, host and port information, it is used to establish connections to the Sui network.

`send_timeout`, `recv_timeout` and `buffer_size` are the network parameters.
`db_folder_path` is the path to the account's client state database, which will be storing
all the transaction data, certificates and object data belongs to the account.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

belonging


#### Key management
As you might have noticed, the key pairs are stored as plain text in `wellet.conf`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wallet.conf

which is not secure and shouldn't be used in production environment, we have plans to
implement more secure key management and support hardware signing in future release.

:warning: **Do not use in production**: Keys are stored in plain text!

### Starting the network

Expand Down Expand Up @@ -77,15 +126,16 @@ The wallet config file path is defaulted to `./wallet.conf` if not specified.

The following commands are supported by the interactive wallet:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to specify when any of these commands take arguments, such as object - does it require an object value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add the list of arg for each command in next PR


addresses Obtain the Account Addresses managed by the wallet
call Call Move
addresses Obtain the Addresses managed by the wallet
call Call Move function
gas Obtain all gas objects owned by the address
help Prints this message or the help of the given subcommand(s)
new-address Generate new address and keypair
object Get obj info
objects Obtain all objects owned by the account address
objects Obtain all objects owned by the address
publish Publish Move modules
sync Synchronize client state with authorities
transfer Transfer funds
transfer Transfer an object

Use `help <command>` to see more information on each command.

Expand All @@ -112,12 +162,36 @@ you verbatim**.

```shell
Showing 5 results.
0523fc67f30e3922147877ca56ce36a41ba122623fee86043f5c9a05d2b3bde4
5986f0651a5329b90d1d76acd992021377684509909b23a9bbf79c4416afd9cf
ce3c1f3f3cbb5abf7cb492c31a162b58089d03a2e6057b88fd8228435c9d44e7
d346982dd3a61084c6f7f5af0f1b559cdf2921a3e76f403e85925b3dcf1d991d
dc3e8f72f84422ce3b332756520d7730e7a44b6720b0cd91eaf21bf65d56de3e
054FDE3B99A88D8A176CF2E795A18EDC19B32D21
19A6D4720C1C7D16583A9FB3FB537EF31E169DE6
20007C278237AA4BED5FF6094AA05A7FEC90F932
594E3CD1445281FF1BB7D1892534F0235FF810BA
A4C0A493CE9879EA06BAC93461810CF947823BB3
```

## Adding accounts to the wallet
Sui's genesis process will create 5 accounts by default, if that's not enough, there are 2 ways to add accounts to the Sui wallet if needed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

five accounts... two ways

#### 1. use `new-address` command to generate new account
To create a new account, execute the `new-address` command in Sui interactive console:
``` shell
sui>-$ new-address
```
The console should return a confirmation after the account has been created.
```
Created new keypair for address : 3F8962C87474F8FB8BFB99151D5F83E677062078
```

#### 2. Add existing accounts to `wallet.conf` manually.
If you have existing key pair from an old wallet config, you can copy the account data manually to the new `wallet.conf`'s accounts section.

The account data looks like this:
```json
{
"address": "a4c0a493ce9879ea06bac93461810cf947823bb3",
"key_pair": "MTpXG/yJq0OLOknghzYRCS6D/Rz+97gpR7hZhUCUNT5pMCy49v7hZkCSHm38e+cp+sdxLgTrSAuCbDxqkF1MTg=="
}
```
Restart the Sui wallet after the modification, the new accounts will appear in the wallet if you query the addresses.

## Calling Move code

Expand All @@ -141,7 +215,7 @@ accomplished using the following command:


``` shell
./wallet --no-shell objects --address 0523fc67f30e3922147877ca56ce36a41ba122623fee86043f5c9a05d2b3bde4
./wallet --no-shell objects --address 054FDE3B99A88D8A176CF2E795A18EDC19B32D21
```

When looking at the output, let's focus on the first column which
Expand Down Expand Up @@ -174,7 +248,6 @@ the GAS module using the following Sui Wallet command:
--pure-args x\"5986f0651a5329b90d1d76acd992021377684509909b23a9bbf79c4416afd9cf\" \
--gas 1FD8DA0C56694229761E9A3DCE50C49AF2EA5DB1 \
--gas-budget 1000 \
--sender 0523fc67f30e3922147877ca56ce36a41ba122623fee86043f5c9a05d2b3bde4
```

This a pretty complicated command so let's explain all its parameters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty

Expand Down Expand Up @@ -233,7 +306,7 @@ of the `transfer` function) but querying objects that are now owned by
the sender (abbreviated output):

``` shell
./wallet --no-shell objects --address 0523fc67f30e3922147877ca56ce36a41ba122623fee86043f5c9a05d2b3bde4
./wallet --no-shell objects --address 054FDE3B99A88D8A176CF2E795A18EDC19B32D21
Showing 4 results.
1FD8DA0C56694229761E9A3DCE50C49AF2EA5DB1: ...
363D5BCAC9D5855122202B6B832B321D4256F22E: ...
Expand All @@ -246,7 +319,7 @@ starts with `B800`. On the other hand, the recipient now owns 6
objects including the transferred one (in the fourth position):

``` shell
./wallet --no-shell objects --address 5986f0651a5329b90d1d76acd992021377684509909b23a9bbf79c4416afd9cf
./wallet --no-shell objects --address 054FDE3B99A88D8A176CF2E795A18EDC19B32D21
Showing 6 results.
348B607E5C8B80524D6BF8275FB7F35267A7814E: ...
5852529FE26D138D7B6B9281ADBF29645D93543A: ...
Expand Down