ethcli¶
Useful when working with ganache-cli to quickly force mining of blocks, start/stop mining and check the blockchain height. Requires gnu parallel.
Commands:¶
ethcli start: starts mining.ethcli stop: stops mining.ethcli mine [number]: if the parameternumberisn't provided, mines one block. Otherwise, it minesnumberblocks. Launches up to 200 parallel jobs.ethcli height: returns the blockchain height. TODO: display decimal value instead of hexadecimal.ethcli getblock [number]: returns the last block, or the block with the specified number. Uses eth_getBlockByNumber. Special values areearliest,latest(the default), andpending. For example, to get the last transaction's hash to later debug it withtruffle debug
ethcli getblock |jq ".result.transactions[0].hash" -r
The script uses the NODE_ADDR environment variable to connect to an ethereum node. It defaults to http://localhost:8545.