Skip to content
Snippets Groups Projects
example.md 1.43 KiB
Newer Older
Hugo Trentesaux's avatar
Hugo Trentesaux committed
# Examples of gcli commands for copy-paste

Useful when developing: replace `gcli` by `cargo run --` to build in debug mode and launch gcli.

## Configuration

It can be handful to use Gcli with a configuration file to avoid passing arguments on every command.

```sh
# show config commands
gcli config
# show where config file is stored
gcli config where
# save config to use gdev network for next commands
gcli --network gdev config save
# save config to use Alice predefined secret
gcli -S predefined -s Alice config save
Hugo Trentesaux's avatar
Hugo Trentesaux committed
# these can be combined
gcli --network local -S predefined -s test1 config save
Hugo Trentesaux's avatar
Hugo Trentesaux committed
In the following, we assume this last command was run.

Hugo Trentesaux's avatar
Hugo Trentesaux committed
## Commands

```sh
# get duniter current block
Hugo Trentesaux's avatar
Hugo Trentesaux committed
gcli blockchain current-block
# get balance of configured account
gcli account balance
# get identity information without indexer
gcli --no-indexer identity get -a 5Hn2LeMZXPFitMwrmrGucwtAPSLEiP4o5zTF7kHzMBtEkJUr 
Hugo Trentesaux's avatar
Hugo Trentesaux committed
# get information about test1 identity (needs indexer)
gcli identity get --username test1
Hugo Trentesaux's avatar
Hugo Trentesaux committed
# claim universal dividends
gcli ud claim
# transfer 5000 units
gcli account transfer 5000 5E4i8vcNjnrDp21Sbnp32WHm2gz8YP3GGFwmdpfg5bHd8Whb
Hugo Trentesaux's avatar
Hugo Trentesaux committed
```

## Indexer commands

You can check first that indexer is on the same network as Duniter node:

```sh
# check if indexer is on the same chain as duniter
Hugo Trentesaux's avatar
Hugo Trentesaux committed
gcli indexer check
```

The following commands uniquely relate with indexer.
Hugo Trentesaux's avatar
Hugo Trentesaux committed

```sh
# show latest indexer indexed block
gcli indexer latest-block
```