The main entry point for an Iron Fish CLI that is capable of mining blocks and spending notes. It's created using the oclif CLI framework
Starting the CLI
If you're still in theironfish
directory in your terminal window, run cd ironfish-cli
.- Otherwise, you'll get a "Command not found" error.
Next, start the CLI with this command:
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
yarn start wallet:balance
yarn start faucet
yarn start wallet:send
yarn start wallet:transactions [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 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 yetYou 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
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.
Multiple Nodes
Run these commands in two different terminals:yarn start start -d default -p 9033
yarn start start -d client -p 9034 -b ws://localhost:9033
You should see connection messages indicating that the two nodes are talking to each other.
Multiple Nodes with Miners
Node 1# in tab 1
yarn start start
# in tab 2
yarn start miners:start
Node 2
# in tab 3
yarn start start --datadir ~/.ironfish2 --port 9034 --bootstrap ws://localhost:9033
# in tab 4
yarn start miners:start --datadir ~/.ironfish2