Introduction to Celo CLI

Introduction to Celo CLI https://celo.academy/uploads/default/optimized/2X/4/42f3607d108d3dfe136bb7c95967eb239704bb4c_2_1024x576.jpeg
none 0.0 0

Introduction

The Celo command-line interface (CLI) is a powerful tool that enables developers to interact with the Celo network. This guide will provide an introduction to the Celo CLI, offering insights into installation, setting up accounts, and executing transactions.

What is Celo CLI?

The Celo CLI, short for Command Line Interface, is a software package that allows developers to interact directly with the Celo network. Through the CLI, developers can execute commands that facilitate various interactions with the network such as creating accounts, managing Celo Gold (cGLD) and Celo Dollar (cUSD) balances, deploying smart contracts, making transactions, and more.

Installation

Before installing Celo CLI, you need to install Node.js and npm (Node Package Manager). After setting up Node.js and npm, you can install Celo CLI using npm:

npm install -g @celo/celocli

It’s necessary to use node version 12, you can change this using the command, then verify the version being used

nvm install 12.0.0
nvm use 12.0.0

node1

This will install Celo CLI globally on your system, allowing you to use it in any directory.

Setting Up an Account

Once you have installed the Celo CLI, you can set up a new account. To create a new account, use the account:new command. This command generates a new private/public key pair and prints the account address:


celocli account:new

After running this command, you will get an output similar to this:


account: {

  address: '0x5409ED021D9299bf6814279A6A1411A7e866A631',
  
  privateKey: '0x1a8bfD625e7B6d6eA2443dE74E7120748fe36BD6aF1a274f16432a0672604F09',
  
  publicKey: '0x0406cc344d288d76c0629972813474a916e8080bb2e9fa2e65af585da4700248dc11899843db6ba4680ab1c80746a1e20aa0aa2aa8e9d43e8108a13d75222663cd',

}

Note: Store your private key in a secure location. If you lose access to your private key, you will lose access to your account.

Checking Account Balance

To check the balance of a Celo account, you can use the account:balance command. Replace address with the actual address of your account:


celocli account:balance address

Sending Transactions

To send transactions on the Celo network, you use the transfer:celo command. The following command transfers 0.0001 cGLD from one account to another:


celocli transfer:celo --from <accountAddress> --to <addressOfChoice> --value <valueInCeloWei> --privateKey <privateKey> --node https://forno.celo.org

In this command, replace address_from with the sender’s address and address_to with the recipient’s address. The value parameter specifies the amount to transfer, in wei. 1e18 wei equals 1 CELO.

Other Commands

Here are various commands available on the Celo Blockchain CLI. Please note that these commands assume that you have the Celo CLI installed and set up correctly on your local machine.

  1. Account Management Commands:

    celocli account:balance - This command is used to check the balance of a Celo account.

    celocli account:new - This command is used to create a new Celo account.

    celocli account:unlock - This command unlocks an account, allowing it to sign transactions.

  2. Transaction Management Commands:

    celocli transfer:celo - This command is used to transfer CELO between accounts.

    celocli transfer:usd - This command is used to transfer Celo Dollars (cUSD) between accounts.

    celocli transfer:fromledger - This command is used to transfer funds from a Ledger hardware wallet.

  3. Network Information Commands:

    celocli network:parameters - This command provides the current network parameters.

    celocli network:status - This command provides information about the status of the network.

  4. Validator and Validator Group Commands:

    celocli validator:status - This command provides information about a validator’s status.

    celocli validator:show - This command displays information about a specific validator.

    celocli validatorgroup:show - This command shows information about a validator group.

    celocli validatorgroup:member - This command lists the validators in a validator group.

Please note that this is a non-exhaustive list, and more commands are available. The full list of commands and their respective options can be found in the Celo CLI documentation. It’s also important to note that as the Celo project evolves, new commands might be introduced and old ones deprecated. Always refer to the most recent documentation when using the Celo CLI.

Remember to exercise caution when executing these commands, particularly when transferring assets or interacting with smart contracts, as mistakes can lead to loss of funds. As always, it’s recommended to have a good understanding of how blockchain technology and CLI tools work before interacting with the Celo network at this level.

Conclusion

The Celo CLI is a comprehensive tool for interacting with the Celo network. Through its intuitive command structure and rich feature set, developers can create accounts, manage balances, and perform transactions with ease. While this guide offers an introduction to the Celo CLI, developers are encouraged to explore the full range of commands and capabilities that the CLI offers.

About Us

Joel Obafemi

A marketer, copywriter, and collab manager for web3 brands. You can connect with me on LinkedIn.

Reference

Celo Documentation
Celo CLI account
Celo CLI: A Practical Guide to Energize your Celo Toolkit

7 Likes

Congratulations on being among the top voted proposals this week! This is now approved by @Celo_Academy for you to get started whenever you’d like. :mortar_board: :seedling:

5 Likes

Hi I will do a review for you

2 Likes

Oh okay. Thank you very much

2 Likes

overall it’s good. You can change the status to publish.

3 Likes

Alright. I’ll do that. Thanks a lot!

3 Likes

Hey so sorry for the delay, can you make sure that it provides more information , in a way you can see in this article, and we want an article having more information than this

article link for your referrence Celo CLI: A Practical Guide to Energize your Celo Toolkit | by joenyzio | Celo Developer Community Blog

Thank You
Ishan

2 Likes

@Joel any update?

3 Likes

Kindly check out the update

2 Likes

Are you able to add images of the results of some of the commands you have described before? That way, this content will not only contain a list of commands from the Celo CLI, but also visual representations of the results of those commands.

3 Likes

Thanks @yafiabiyyu and @ishan.pathak2711 these are very helpful tips. This tutorial is currently an abbreviated version of the docs and this tutorial. As an introductory article it should be particularly focused on providing a unique learning experience with a good bit of depth. Please consider this while making your revisions. Thank you!

4 Likes

@Joel I suggest you take your time to study the Celo documentation and gain more experience so you can put up things on your own. This tutorial needs more information and more insight. You should consider revisiting it to make it more elaborate and resourceful.

8 Likes

Calm down @bobelr You can clearly see it’s in review and not published. Meaning I’m still working on it.

1 Like

Lol, yeah I saw it. It’s good you see that so you can fix all at once. :handshake:

10 Likes

Let me know when it has been fixed

2 Likes

@ishan.pathak2711 It has been fixed. @yafiabiyyu can confirm.

2 Likes