How to use wallet in Command Line Mode?

How to use wallet in Command Line Mode?

Preface

The Pactus Blockchain provides a wallet application that allows users to interact with the Pactus blockchain without the need to run a node. This is ideal for users who do not wish to operate a node but still want to create a personal wallet to manage their funds. This tutorial will guide you step-by-step on how to use the wallet application.

Download

To get started, download and extract the Pactus CLI file from here. Once you have downloaded and extracted the Pactus CLI file, you can proceed to the next step.

Wallet Commands

In this section, we will explore various wallet commands that help you create, manage, and recover your Pactus wallet.

ℹ️
Wallet Path

By default, the node’s wallet is stored at ~/pactus/wallets/default_wallet on Unix-like systems. On Windows, you can find it at C:\Users\<USER_NAME>\pactus\wallets\default_wallet.

If you wish to select or specify a different wallet, use the --path option.

Create a Wallet

To create a new wallet, run the following command:

Replace <PATH-To-NEW-WALLET> with the file path where you want to create the wallet.

Recover Wallet

If you lose your wallet or forget your password, you can recover it by running this command:

Replace <PATH-To-NEW-WALLET> with the file path where you want to restore the wallet.

Wallet Password

You can change the wallet password by running this command:

This command changes the password for the default_wallet if there is one, or sets a new password.

Wallet Seed

You can obtain the wallet seed by running this command:

The wallet seed is encrypted within your wallet, and you’ll need to enter the wallet password to access it.

Address Commands

In this section, we’ll cover address commands that help you manage your wallet addresses.

Creating New Address

You can create a new address by running this command:

Based on PIP-8, an address string conducts its type and usage. By default, the above command creates an account address. If you want to create a validator address instead, you can use the --type validator option with the command like this:

You can also assign a label to your address to better organize your address book.

List of Addresses

To view the list of wallet addresses, use this command:

Get Public Key

To obtain the public key for a specific address, run this command:

Replace <ADDRESS> with the address for which you want to retrieve its public key.

Get Private Key

You can get the private key of your address by this command:

Replace <ADDRESS> with the address for which you want to retrieve its private key. Keep your private key secure. If someone gains access to your private key, they will have full control over that address.

Get Address Balance

You can get the balance of your address by this command:

Replace <ADDRESS> with the address for which you want to retrieve your balance.


Transaction Commands

In this section, we’ll cover transaction commands that help you create, sign, and broadcast transactions on the Pactus Blockchain. You’ll need to provide the password to sign the transaction. Please note that once a transaction is broadcasted, it cannot be reversed.

Sending Transfer Transaction

To create, sign, and broadcast a Transfer transaction, use the following command:

In this command, <FROM> should be one of the addresses in your wallet as the sender address, and <TO> is the receiver address.

Sending Bond Transaction

To create, sign, and broadcast a Bond transaction, use the following command:

In this command, <FROM> should be one of the addresses in your wallet as the sender address, and <TO> is the receiver validator address.

If the validator associated with this address does not exist yet, you need to provide the public key to create it:

Replace <PUBLIC_KEY> with the validator’s public key, which is the public key of the <TO> address.

Sending Unbond Transaction

To create, sign, and broadcast a Unbond transaction, use the following command:

In this command, <ADDRESS> is the address of the validator that you want to unbond.

Sending Withdraw Transaction

To create, sign, and broadcast a Withdraw transaction, use the following command:

Last updated on