# Manage Wallet

This guide will show you how to create account and worker key, set default account, import keystore file, etc.

The wallet commands are shown in the table below.

Command Description
topio wallet createAccount Create account.
topio wallet importAccount Import account.
topio wallet createKey Create worker key for the account.
topio wallet listAccounts List all accounts in the wallet.
topio wallet setDefaultAccount Set a default account to send transactions.
topio wallet resetKeystorePwd Reset keystore file password.
topio wallet exportAccount Export the private key.

# Create An Account

Create a local account. You can create multiple accounts.

Each account will have a unique pair of public and private keys, called the owner key, which has all the permissions of the account, including but not limited to sending transactions, mining, etc.

WARNING

Please remember your keystore file password. If you lose the password, you will not be able to use the account. And the system does not have the option of "forgot password", only the password can be retrieved through the password prompt.

Do not share your keystore file and file password with others, so as to avoid asset loss!

Request

topio wallet createAccount

Request Parameters

None.

Options

Option Name Default Value Type Description
-p,--password - String Create an account with a password. If you do not add this option, it will create an account without a password.
The password consists of numbers and letters, 8-16 characters.
-f, --pwd_file_path - - Create an account with a password file.
-h, --help - - Check the command's help information.

Response Parameters

Parameter Name Type Description
Account Address String You can share your public key and account address with anyone. Others need them to interact with you.
The address created here is a normal user account address, beginning with a "T80000" identifier.
Owner public-key String Account public key and private key always come in pairs, the private key is stored in the owner keystore file, about the keystore file, please see the Account Protocol.
Public key which is used for encryption and signature verification.

Request Sample

topio wallet createAccount

Response Sample

  • Successful

    Successfully create an account locally!
    
    You can share your public key and account address with anyone. Others need them to interact with you!
    You must nerver share the private key or account keystore file with anyone! They control access to your funds!
    You must backup your account keystore file! Without the file, you will not be able to access the funds in your account!
    You must remember your password if you set it! Without the password, it's impossible to use the keystore file!
    
    Account Address: T800002276a7d58218ac4978733e5cca927a7d86cb7c87
    Owner public-Key: BAW5r2JJd/j7Wr6iISO7ki5+YE2OKflaG7dVbV+u1EkPpcAqe3Ou10EPNlKjlI4EsAJR9LBc+Fv9DC1Znm8rKcU=
    
  • Failed

    Password error!
    Please set a password for the account keystore file. The password must consist of Numbers and Letters, 8 to 16 characters.
    

# Import An Account

Import an account by importing private key.

Request

topio wallet importAccount

Request Parameters

None.

Options

Option Name Default Value Type Description
-p, --password - String Set a password when importing an account. If you do not add this option, the system will import an account without a password.
The password consists of numbers and letters, 8-16 characters.
-h, --help - - Check the command's help information.

Response Parameters

Parameter Name Type Description
Account Address String The account address corresponding to the imported private key.
Public-Key String Public key, used for encryption and signature verification.

Request Sample

topio wallet importAccount

After running the command, enter the private key according to the returned message.

Response Sample

Import successfully.

Account Address: T80000968927100f3cb7b23e8d477298311648978d8613
Public-Key: BK2CfxnSP0cL9/dbi6b3krWUlQP1jP4EIHu5Y5c2vMBNLMYMOE8K3mqOubDPQXBXc/D4ydtR0LDyWUEyxHO/ZZU=

# Create Worker Key

Create multiple public and private key pairs for an account. Such public and private key pairs are called worker keys. It can be granted mining permissions, but no transaction permissions. We recommend that you use worker key to mine online and keep the owner key offline to make your assets more secure.

Request

topio wallet createKey

Request Parameters

Parameter Name Required Type Description
account_addr No Default account. String The account to which the worker key belongs. If not specified, a worker key will be created for the default account .

Options

Option Name Default Value Type Description
-p, --password - String Create worker key with a password. If you do not add this option, it will create a worker key without a password.
The password consists of numbers and letters, 8-16 characters.
-f, --pwd_file_path - - Create worker key with password file.
-h, --help - - Check the command's help information.

Response Parameters

Parameter Name Type Description
Public Key String Public key which is used for encryption and signature verification.
worker public_key String Public key of worker key.

Request Sample

topio wallet createKey -p

Response Sample

  • Successful

    Successfully create a worker keystore file!
    
    You can share your public key and account address with anyone. Others need them to interact with you!
    You must nerver share the private key or account keystore file with anyone! They control access to your funds!
    You must backup your account keystore file! Without the file, you will not be able to access the funds in your account!
    You must remember your password if you set it! Without the password, it's impossible to use the keystore file!
    
    Account Address: T800002276a7d58218ac4978733e5cca927a7d86cb7c87
    worker public-key: BAW5r2JJd/j7Wr6iISO7ki5+YE2OKflaG7dVbV+u1EkPpcAqe3Ou10EPNlKjlI4EsAJR9LBc+Fv9DC1Znm8rKcU=
    
  • Failed

    Password does not meet the format requirements:

    Password error!
    

# List All Accounts in the Wallet

Request

topio wallet listAccounts

Request Parameters

None.

Options

Option Name Default Value Type Description
-h,--help - - Check the command help information.

Response Parameters

Parameter Name Type Description
account String Account address. If the account address is marked with "default account", it means that this account is currently being used.
owner public-key String The public key of the account in base58 format. If the owner public-key is marked with "registered as minerkey", it means that the owner key is registered as the miner key.
balance Uint64 Account balance, unit is TOP.
Note the difference between "-" and "0" when the balance is displayed:
-: Indicates that this account has not been created on the chain;
0: Indicates that this account has been created on the chain, but the current balance is 0.
nonce Uint64 The nonce of the latest successful transaction. Unique in the global network.
worker public-key String The base58 format public key list of the worker key of this account. If the the worker public key is marked with "register as minerkey",it means that the worker key is registered as miner key.

Request Sample

topio wallet listAccounts

Response Sample

  • Successful

    No default account
    account #0: T8000066ab344963eaa071f9636faac26b0d1a39900325
    owner public-key: BFPQ1X11sm+OU9ua3DeEnzwYb7npoa+uhJXcdi4i205y7PaXzfDwAUGGdaV6qj3k2V7lUQiFDuofl5CaFhjaXlQ=
    balance: 10000000.000000 TOP
    nonce: 0
    worker public-key list:
    public key #0: BG2KavysdOhOzfHPIHR2kBpq2SMw/M+n4S0Q90PS7bVZ9tV2ipPsbKeQmgyBx+BErOH0kgnGFvq++3rj3v6YxfA=
    ------------------------------------------------------
    
    account #1: T8000085a8e8acd53c72dca85dcb002a6710796975b4ba
    owner public-key: BJL6rIirL1m7ox+hKHymSISULh8HPYI8772Wq7h0oUga8exzuRrTR599inROGNkGK5O8buwFhe+E2WKyYD3l8tE=
    balance: 30000000.000000 TOP
    nonce: 0
    
  • Failed

    There is no account in wallet.
    

# Set Default Account

The following scenarios need to set the default account:

  • There are multiple accounts in the wallet, and a default account needs to be set for sending transactions.

  • There is only one account with password in the wallet. You need to set this account as the default account to send transactions.

  • Switch the account to send transaction.

  • If there is no operation (query or send transaction) within 30 minutes at the front desk of TOPIO, the default account you set will be invalid and you need to reset a default account.

Request

topio wallet setDefaultAccount

Request Parameters

Parameter Name Required Default Value Type Description
account_addr Yes - String Account address.

Options

Option Name Default Value Type Description
-p, --password - String The password set when the account was created.
-h, --help - - Check the command's help information.

Response Parameters

None.

Request Sample

topio wallet setDefaultAccount T8000085a8e8acd53c72dca85dcb002a6710796975b4ba

Response Sample

  • Successful

    Set default account successfully.
    
  • Failed

    The owner key does not exist:

    The account's owner keystore file does not exist in wallet.
    

    The password is wrong or the owner key has no password:

    Password error!
    Hint: 
    Set default account failed.
    

# Reset Keystore File Password

Support resetting owner keystore and worker keystore file password.

Request

topio wallet resetKeystorePwd

Request Parameters

Parameter Name Required Default Value Type Description
public_key Yes - String Public key of owner key or worker key.

Options

Option Name Default Value Type Description
-h, --help - - Check the command's help information.

Response Parameters

None.

Request Sample

  • Old format

    topio wallet resetKeystorePwd BERrbuiBZ66gYHHhx2/4OzqHwqC+DrJRh7vdPz5e8fHD+OwGhgmRjnoNbyM2rnI9eXTjuSOvAGG5J1tOAyMFnVQ=
    
  • New format

    topio wallet resetKeystorePwd ad827f19d23f470bf7f75b8ba6f792b5949503f58cfe04207bb9639736bcc04d2cc60c384f0ade6a8eb9b0cf41705773f0f8c9db51d0b0f2594132c473bf6595
    

Response Sample

  • Successful

    Successfully reset password!
    
  • Failed

    Old password error:

    Password error!
    Hint: basketball
    Set default account failed.
    

# Export Private Key

Export and show the wallet private key and keystore file content. After exporting, you can copy and save it locally.

Request

topio wallet exportAccount

Request Parameters

None.

Options

Option Name Default Value Type Description
-h, --help - - Check the command's help information.

Response Parameters

Parameter Name Type Description
Account Address String Account address. When exporting the keystore file, the corresponding account address will be printed here.
Private-Key String The private key.

Request Sample

topio wallet exportAccount T80000968927100f3cb7b23e8d477298311648978d8613

Response Sample

About the format of Keystore file, see Account Protocol.

Export successfully.

Keystore file: /root/topnetwork/keystore/T80000968927100f3cb7b23e8d477298311648978d8613
Account Address: T80000968927100f3cb7b23e8d477298311648978d8613
Private-Key: b0032f8057051b611a7c0ea373da4d7a6764351030ed497e6134fd9e11775b19

{
   "account_address" : "T80000968927100f3cb7b23e8d477298311648978d8613",
   "address" : "968927100f3cb7b23e8d477298311648978d8613",
   "crypto" : {
      "cipher" : "aes-128-ctr",
      "cipherparams" : {
         "iv" : "e40a554c807b913c6e882e933ee6c103"
      },
      "ciphertext" : "762381ac2219511c647d27424761e81fecc14170eeff6e20412d6c9311149060",
      "kdf" : "scrypt",
      "kdfparams" : {
         "dklen" : 32,
         "n" : 262144,
         "p" : 1,
         "r" : 8,
         "salt" : "69c473d9a1ae16ad7cbab057101ccb9632d4109bf7f44e7ff2eba59e269f9932"
      },
      "mac" : "7d3c31b6aa3f43885682259e6e632b44799700cc7030bdbc1dddb2f587066dac"
   },
   "hint" : "",
   "id" : "b2951865-c391-9d98-ff85-83e149f88990",
   "key_type" : "owner",
   "public_key" : "BK2CfxnSP0cL9/dbi6b3krWUlQP1jP4EIHu5Y5c2vMBNLMYMOE8K3mqOubDPQXBXc/D4ydtR0LDyWUEyxHO/ZZU=",
   "version" : 3
}