Skip to content

Commit

Permalink
accounts -> wallet (iron-fish#2971)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwisne authored Jan 18, 2023
1 parent e6506e3 commit 6f8e3ad
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 39 deletions.
77 changes: 44 additions & 33 deletions ironfish-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <number>`. 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 <number>`. 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

Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ironfish-cli/src/commands/wallet/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
}
}
2 changes: 1 addition & 1 deletion ironfish-cli/src/commands/wallet/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
}

Expand Down
2 changes: 1 addition & 1 deletion ironfish-cli/src/commands/wallet/repair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions ironfish-cli/src/commands/wallet/which.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <name>"',
' * Create an account: "ironfish wallet:create"\n' +
' * List all accounts: "ironfish wallet:accounts"\n' +
' * Use an existing account: "ironfish wallet:use <name>"',
)
this.exit(0)
}
Expand Down

0 comments on commit 6f8e3ad

Please sign in to comment.