What is the Celo CLI
The Command Line Interface allows users to interact with the Celo Protocol smart contracts. It’s a command-line interface for interacting with the Celo Protocol and core contracts. Some common features you may want try include transferring tokens, viewing account balances, participating in elections or in on-chain governance, or helping users interact with multi-sig contracts.Installation
Homebrew
If you’re on macOS or Linux, celocli is available as a tap on Homebrew.NPM Package
The Celo CLI is published as a node module on NPM. Assuming you have npm and git both installed, you can install the Celo CLI using the following command:npm install -g @celo/celocli@beta
If you have trouble installing globally (i.e. with the
-g
flag), try installing to a local directory instead with yarn add @celo/celocli
and run with yarn celocli
.Commands
The tool is broken down into modules and commands with the following pattern:celocli
tool assumes that users are running a node which they have access to signing transactions on, or have another mechanism for signing transactions (such as a Ledger wallet or supplying the private key as an argument to the command). See the documentation on the config module for information about how to set which node commands are sent to.
All balances of CELO or Celo Dollars are expressed in units of 10^-18.
celocli commands
.
To see all available flags for a command, add the flag --globalHelp
to the command.
Optional: Configure Full Node
Commands need to connect to a Celo node to execute most functionality. You have several options for node connectivity:- Running your own full node
- Third-party node providers
- Forno (the easiest way)
celocli
to any node, use the following command:
celocli
is connected by running:
Import Accounts
If you are connecting to a remote node (like Forno), Celo CLI will need to sign transactions locally before sending them. To do this, Celo CLI needs access to a private key. There are a couple ways to sign transactions using Celo CLI.Import Private Key (less secure)
Add the--privateKey
flag followed by the private key associated with the sending account. For example:
Using a Ledger Wallet
The Celo CLI supports using a Ledger hardware wallet to sign transactions. Just add the--useLedger
flag to a command that requires a signature.
You can specify the number of addresses to get for local signing with the --ledgerAddresses
flag.
You can specify an array of index addresses for local signing. Example --ledgerCustomAddresses "[4,99]"
.
For example: