Skip to content

Commit

Permalink
Add docs (#31)
Browse files Browse the repository at this point in the history
* Add docs
  • Loading branch information
KonradStaniec authored May 24, 2024
1 parent cdb2fc4 commit f5d04a9
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 3 deletions.
85 changes: 83 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,84 @@
# CLI-TOOLS
# CLI-Tools

Set of CLI tools to run as Batch jobs on phase-1 main net
Set of CLI tool which are used for different purposes:
- processing unbonding requests
- building test staking/unbonding/withdraw phase-1 Bitcoin transactions
- building Bitcon transactions timestamping files

See [deployment guide](/docs/commands.md) to review all available commands.

### Installation

#### Prerequisites

This project requires Go version 1.21 or later.

Install Go by following the instructions on the official Go installation [guide](https://go.dev/doc/install).

#### Download the code

To get started, clone the repository to your local machine from GitHub; please
use the version according to the phase-1 system guidelines --
you can find all versions in the official
[releases](https://github.com/babylonchain/cli-tools/releases) page.

```shell
git clone https://github.com/babylonchain/cli-tools.git
cd cli-tools
git checkout <release-tag>
```

#### Build and install the binary

At the top-level directory of the project

```shell
make install
```

The above command will build and install the `cli-tools` binary to
`$GOPATH/bin`.

If your shell cannot find the installed binaries, make sure `$GOPATH/bin` is in
the `$PATH` of your shell. The following updates to `$PATH` can be performed to
this direction:

```shell
export PATH=$HOME/go/bin:$PATH
echo 'export PATH=$HOME/go/bin:$PATH' >> ~/.profile
```

### Usage

To see all available commands:

```shell
cli-tools --help
```

Example output:

```shell
Set of cli tools used in phase-1

Usage:
cli-tools [command]

Available Commands:
completion Generate the autocompletion script for the specified shell
create-phase1-staking-tx create phase1 staking tx
create-phase1-unbonding-request create phase1 unbonding tx
create-phase1-withdaw-request create phase1 withdraw tx
create-timestamp-transaction Creates a timestamp btc transaction by hashing the file input.
dump-cfg dumps default confiiguration file
help Help about any command
process-failed-transactions tries to re-send unbonding transactions that failed to be sent to the network
run-unbonding-pipeline runs unbonding pipeline

Flags:
--config string path to the directory with configuration file
-h, --help help for cli-tools
--params string path to the global params file

Use "cli-tools [command] --help" for more information about a command.
```
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (

rootCmd = &cobra.Command{
Use: "cli-tools",
Short: "Set of cli tools to run batch jobs on phase-1 mainnet",
Short: "Set of cli tools used in phase-1",
}

// C:\Users\<username>\AppData\Local\tools on Windows
Expand Down
43 changes: 43 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,46 @@ $ bitcoin-cli -rpcwallet=timestamp-w gettransaction 25b65b31c6f4d2f46ebeb5fa4c9a
}
}
```

## BTC Transaction creation commands

The following set of commands are used to create phase-1 compatible transactions
with the goal to ease up testing of the phase-1 system:
- `create-phase1-staking-tx`
- `create-phase1-unbonding-request`
- `create-phase1-withdaw-request`

Disclaimer: Those commands should only be used for testing purposes and should not be
used with real BTC.

## Dump config command

Some of the commands require a config file to work properly. To generate a config
file the `dump-cfg` command can be used.

```shell
cli-tools dump-cfg --config "./config.toml"
```

will generate a `config.toml` file in the same directory as the one
the `cli-tools` program binary resides in.


## Unbonding processing commands

There are two commands responsible for processing unbonding requests:
- `run-unbonding-pipeline`
- `process-failed-transactions`

Both of those commands require:
- config file path
- global parameters paths

Example:

```shell
cli-tools run-unbonding-pipeline --config "./config/config.toml" --params "./config/global-params.json"
```

For these commands to work, they must have access to the data source (mongo-db) containing
unbonding transactions already signed by staker and validated by some other process.

0 comments on commit f5d04a9

Please sign in to comment.