# Miyabi Wallet

# Introduction

miyabi-wallet is a dedicated CLI tool used to interact with Miyabi by abstracting out key management which would simplify asset and contract invocation related functionalities. The core functionalities of Wallet are:

  • Manage an encrypted wallet file, which is protected by a password
  • Store user's keypair and receiver addresses information
  • Send move asset transactions signed by the stored key
  • Send Invoke contract transactions signed by the stored key

# Installation

miyabi-wallet comes along with Miyabi and does not require any separate installation.

# Quick Start

This section describes how to get started with the miyabi-wallet tool. To illustrate its usage, we will walk through the process of creating a wallet and managing its addresses.

Let's walk through the steps individually and see how we can achieve this. In this document, italic represents command output.

Note: Run wallet commands with --help to get usage info

# Step 1. Create a wallet


$ ./miyabi-wallet-cli createwallet
password: ****
confirm password: ****
...\miyabi-wallet-cli-debug\wallet.dat

Wallet CLI syntax format: miyabi-wallet-cli [Options] [Command, [Command Options]]
./miyabi-wallet.exe --help to list all commands supported by this tool.
./miyabi-wallet.exe [command] --help to get usage info for a particular command.

# Step 2. Add keypair


$ ./miyabi-wallet-cli addkeypair -k root -p b0c3ac41c72d82780876150eb1682ef2797a156a24419c99c54c45bcf0008cb6
password: ****
{"keyName":"root","address":"02baa3e598dd3c24703fbeb62eb81631da3dd9dc62ca7760fda65fce0256b8a7d9"}

# Step 3. Add receiver address


$ ./miyabi-wallet-cli addreceiver -r alpha -a 0225c6b6c4225139c34746a3d12c798d9edab2ceb0149e2abe79812a04b9f20a91
password: ****
{"receiverName":"alpha","address":"0225c6b6c4225139c34746a3d12c798d9edab2ceb0149e2abe79812a04b9f20a91"}

# Step 4. Show wallet


$ .\miyabi-wallet-cli --pretty showwallet
password: ****
{
  "addresses": {
    "root": "02baa3e598dd3c24703fbeb62eb81631da3dd9dc62ca7760fda65fce0256b8a7d9"
  },
  "receivers": {
    "alpha": "0225c6b6c4225139c34746a3d12c798d9edab2ceb0149e2abe79812a04b9f20a91"
  }
}

# Step 5. Move asset


$ .\miyabi-wallet-cli.exe --pretty moveasset --from root --to alpha -t GOLD --amount 50.0
password: ****
{
  "from": "root",
  "fromAddress": "02baa3e598dd3c24703fbeb62eb81631da3dd9dc62ca7760fda65fce0256b8a7d9",
  "to": "alpha",
  "toAddress": "0225c6b6c4225139c34746a3d12c798d9edab2ceb0149e2abe79812a04b9f20a91",
  "tableName": "GOLD",
  "value": 50.0,
  "memos": [],
  "atHeight": 156,
  "txId": "e37db6855420d63a45e2ef9838c170d7969754a4ef822f968be300af73f3d93d",
  "resultCode": -1
}

# Commands

Command Description
addkeypair Add a provided key-pair and store in the wallet under a given alias
addreceiver Add a receiver address into the wallet
changepassword Change wallet password
createwallet Create wallet into the execution folder (default name is wallet.dat)
deletereceiver Delete receiver address from the wallet
exportwallet Export the wallet information
generatekey Generate a random key-pair and store in the wallet under a given alias
getbalance Get balance for the provided key or for all keys present in the wallet in a given table
invokecontract Invoke a contract using wallet key
moveasset Move asset from own address to a receiver address or a raw address
showwallet Show key and receiver information stored in the wallet
waittransaction Wait for transaction execution and output status