From 6f8e3ad165ba6bbc92484d5d75c14af1359de4fd Mon Sep 17 00:00:00 2001 From: lwisne Date: Wed, 18 Jan 2023 11:52:42 -0500 Subject: [PATCH] accounts -> wallet (#2971) --- ironfish-cli/README.md | 77 ++++++++++++---------- ironfish-cli/src/commands/wallet/create.ts | 2 +- ironfish-cli/src/commands/wallet/import.ts | 2 +- ironfish-cli/src/commands/wallet/repair.ts | 2 +- ironfish-cli/src/commands/wallet/which.ts | 6 +- 5 files changed, 50 insertions(+), 39 deletions(-) diff --git a/ironfish-cli/README.md b/ironfish-cli/README.md index c96255c2de..3956231ec2 100644 --- a/ironfish-cli/README.md +++ b/ironfish-cli/README.md @@ -5,62 +5,71 @@ The main entry point for an Iron Fish CLI that is capable of mining blocks and s ## Starting the CLI If you're still in the `ironfish` directory in your terminal window, run `cd ironfish-cli`. - * Otherwise, you'll get a "Command not found" error. + +- Otherwise, you'll get a "Command not found" error. Next, start the CLI with this command: - - `yarn start` +- `yarn start` ## Usage Scenarios ### Starting a single node + Run this command in the terminal: + - `yarn start start` Interact with the node in a new terminal window: + - `yarn start status` - - Show your node's status -- `yarn start accounts:balance` - - Show the balance of your account, including $IRON from blocks you've mined - - Tentative balance includes all known transactions. Spending balance includes only transactions on blocks on the main chain + - Show your node's status +- `yarn start wallet:balance` + - Show the balance of your account, including $IRON from blocks you've mined + - Tentative balance includes all known transactions. Spending balance includes only transactions on blocks on the main chain - `yarn start faucet` - - Request a small amount of $IRON for testing payments -- `yarn start accounts:pay` - - Send $IRON to another account -- `yarn start accounts:transactions [account]` - - Display transactions from and to your account + - Request a small amount of $IRON for testing payments +- `yarn start wallet:send` + - Send $IRON to another account +- `yarn start wallet:transactions [account]` + - Display transactions from and to your account ### Start a node and start mining + Run these commands in two different terminals: -- `yarn start start` - - Defaults to port 9033 - - This is equivalent to `yarn start start -d default -p 9033` +- `yarn start start` + + - Defaults to port 9033 + - This is equivalent to `yarn start start -d default -p 9033` - `yarn start miners:start` - - The default thread count is 1. - - You can increase the number of threads by adding `--threads `. Use `-1` to autodetect threads based on your CPU cores. - - - Examples: - - `yarn start miners:start --threads 4` - - To use 4 physical CPU cores - - `yarn start miners:start --threads -1` - - To use all the cores on your CPU - - This may make your machine unresponsive or perform worse than a lesser number. - - You may want to start with a low thread count and increase it until your hashrate stops increasing. - - Note: Hyperthreading (2 miner threads per CPU core) is not fully optimized yet + + - The default thread count is 1. + - You can increase the number of threads by adding `--threads `. Use `-1` to autodetect threads based on your CPU cores. + + - Examples: + - `yarn start miners:start --threads 4` + - To use 4 physical CPU cores + - `yarn start miners:start --threads -1` + - To use all the cores on your CPU + - This may make your machine unresponsive or perform worse than a lesser number. + - You may want to start with a low thread count and increase it until your hashrate stops increasing. + - Note: Hyperthreading (2 miner threads per CPU core) is not fully optimized yet You should see messages in the second terminal indicating that the miner is running: - - `Starting to mine with 8 threads` - - `Mining block 6261 on request 1264... \ 1105974 H/s` - - The H/s number corresponds to the hashrate power of your machine with the given number of mining threads. - - Performance reference: 8-core 3.8+ GHz AMD Ryzen 7 4700G with 8 threads gave the above 1.1 M H/s. + +- `Starting to mine with 8 threads` +- `Mining block 6261 on request 1264... \ 1105974 H/s` + - The H/s number corresponds to the hashrate power of your machine with the given number of mining threads. + - Performance reference: 8-core 3.8+ GHz AMD Ryzen 7 4700G with 8 threads gave the above 1.1 M H/s. When a block is mined, you will see a status line in the node's terminal (the first terminal): - - `Successfully mined block xxx (6543) has 1 transactions` - - Mining 1 block can take several hours or days, depending on your machine's hashrate. - - Your miner may display `Submitting hash for block`, but this does not necessarily mean you've mined a block. The block still needs to be created, validated, and checked to be heavier by the node before it can be added to the main chain. - - In these cases, your node will display "Discarding block" or "Failed to add block". + +- `Successfully mined block xxx (6543) has 1 transactions` +- Mining 1 block can take several hours or days, depending on your machine's hashrate. +- Your miner may display `Submitting hash for block`, but this does not necessarily mean you've mined a block. The block still needs to be created, validated, and checked to be heavier by the node before it can be added to the main chain. + - In these cases, your node will display "Discarding block" or "Failed to add block". ### Multiple Nodes @@ -74,6 +83,7 @@ You should see connection messages indicating that the two nodes are talking to ### Multiple Nodes with Miners **Node 1** + ```bash # in tab 1 yarn start start @@ -83,6 +93,7 @@ yarn start miners:start ``` **Node 2** + ```bash # in tab 3 yarn start start --datadir ~/.ironfish2 --port 9034 --bootstrap ws://localhost:9033 diff --git a/ironfish-cli/src/commands/wallet/create.ts b/ironfish-cli/src/commands/wallet/create.ts index 1de79637ac..92c6ee8608 100644 --- a/ironfish-cli/src/commands/wallet/create.ts +++ b/ironfish-cli/src/commands/wallet/create.ts @@ -44,7 +44,7 @@ export class CreateCommand extends IronfishCommand { if (isDefaultAccount) { this.log(`The default account is now: ${name}`) } else { - this.log(`Run "ironfish accounts:use ${name}" to set the account as default`) + this.log(`Run "ironfish wallet:use ${name}" to set the account as default`) } } } diff --git a/ironfish-cli/src/commands/wallet/import.ts b/ironfish-cli/src/commands/wallet/import.ts index 5fbd3e2816..9ef874638f 100644 --- a/ironfish-cli/src/commands/wallet/import.ts +++ b/ironfish-cli/src/commands/wallet/import.ts @@ -58,7 +58,7 @@ export class ImportCommand extends IronfishCommand { if (isDefaultAccount) { this.log(`The default account is now: ${name}`) } else { - this.log(`Run "ironfish accounts:use ${name}" to set the account as default`) + this.log(`Run "ironfish wallet:use ${name}" to set the account as default`) } } diff --git a/ironfish-cli/src/commands/wallet/repair.ts b/ironfish-cli/src/commands/wallet/repair.ts index 8c59099385..34005d420c 100644 --- a/ironfish-cli/src/commands/wallet/repair.ts +++ b/ironfish-cli/src/commands/wallet/repair.ts @@ -13,7 +13,7 @@ import { import { IronfishCommand } from '../../command' import { LocalFlags } from '../../flags' -const RESCAN_MESSAGE = 'Account must be rescanned using `accounts:rescan --reset`.' +const RESCAN_MESSAGE = 'Account must be rescanned using `wallet:rescan --reset`.' export default class Repair extends IronfishCommand { static hidden = false diff --git a/ironfish-cli/src/commands/wallet/which.ts b/ironfish-cli/src/commands/wallet/which.ts index 84601762ae..0c9774ad04 100644 --- a/ironfish-cli/src/commands/wallet/which.ts +++ b/ironfish-cli/src/commands/wallet/which.ts @@ -34,9 +34,9 @@ export class WhichCommand extends IronfishCommand { if (!accountName) { this.log( 'There is currently no account being used.\n' + - ' * Create an account: "ironfish accounts:create"\n' + - ' * List all accounts: "ironfish accounts:list"\n' + - ' * Use an existing account: "ironfish accounts:use "', + ' * Create an account: "ironfish wallet:create"\n' + + ' * List all accounts: "ironfish wallet:accounts"\n' + + ' * Use an existing account: "ironfish wallet:use "', ) this.exit(0) }