From f5d04a929ff00ab6870c9f5824111eef2c5eeeb8 Mon Sep 17 00:00:00 2001 From: KonradStaniec Date: Fri, 24 May 2024 11:23:07 +0200 Subject: [PATCH] Add docs (#31) * Add docs --- README.md | 85 ++++++++++++++++++++++++++++++++++++++++++++++-- cmd/root.go | 2 +- docs/commands.md | 43 ++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ad614f5..72d9c6e 100644 --- a/README.md +++ b/README.md @@ -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 +``` + +#### 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. +``` diff --git a/cmd/root.go b/cmd/root.go index 727a16e..ea932be 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -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\\AppData\Local\tools on Windows diff --git a/docs/commands.md b/docs/commands.md index 90d56b4..8d84ef0 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -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.