diff --git a/README.md b/README.md index dbb1ac1..fcd384b 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,19 @@ Use `Pyo3` Lib to wrap the `integritee-cli` into a Python lib. -## Installation +## Table of Contents -Get started with the project setup and initial configuration. +- [Getting Started](#getting-started) +- [Run as Command Line Tool](#run-as-command-line-tool) + - [Managing Environment Variables for Command Line Execution](#managing-environment-variables-for-command-line-execution) + - [Get help](#get-help) + - [Available Commands and Examples](#available-commands-and-examples) -- ### Prerequisites +## Getting Started + +Get started with the setup of the client module. + +**Prerequisites** In order to use the features, the nightly version of the compiler has to be setup beforehand: @@ -15,7 +23,13 @@ to be setup beforehand: $ rustup override set nightly ``` -- ### Updating Git Submodules +Common error: **wasmtime**: error[E0463]: can't find crate for `std` + +``` +rustup target add --toolchain nightly wasm32-unknown-unknown +``` + +**Installation** `Cargo.toml` states the relative dependencies at the `shared` folder. The submodules have to be initialized and updated before building: @@ -24,8 +38,6 @@ The submodules have to be initialized and updated before building: $ git submodule update --init --recursive ``` -- ### Creating and Activating venv - Install `integritee_cli_py` as lib into virtual environment: ``` @@ -35,34 +47,22 @@ $ source venv/bin/activate $ conda deactivate ``` -- ### Managing Environment Variables - -Please follow these steps to set up and use environment variables: - -1. Copy the `.env.example` file and rename it to `.env`: - -```bash -$ cp .env.example .env ``` - -2. Open the `.env` file and provide values for the environment variables. - -- ### Installing Dependencies - -Install the necessary dependencies using the provided `requirements.txt` file: - -```bash -$ pip install -r requirements.txt +pip install maturin ``` -- ### Using maturin - To install the lib to your current python environment use: ``` $ maturin develop ``` +**Usage** + +See `run_integritee_cli.py` how to import and use the module. This +script also includes a command line tool, to be used as explained +in the following section. + ## Run as Command Line Tool Test import and execution of `integritee_cli_py` in python: @@ -71,18 +71,36 @@ Test import and execution of `integritee_cli_py` in python: $ python run_integritee_cli.py --command --params ``` -The `integritee-cli-py` provides the following CLI commands: +### Managing Environment Variables for Command Line Execution -- ### Get Help +Please follow these steps to set up and use environment variables: +1. Copy the `.env.example` file and rename it to `.env`: + +```bash +$ cp .env.example .env +``` + +2. Open the `.env` file and provide values for the environment variables. -**Syntax:** +3. Installing Dependencies + +Install the necessary dependencies using the provided `requirements.txt` file: + +```bash +$ pip install -r requirements.txt +``` + + +### Get help + +- Syntax: ```bash $ python3 run_integritee_cli.py --help ``` -**Output:** +- Output: ```bash @@ -98,82 +116,76 @@ options: Parameters for the command ``` -- ### Create a new account: +### Available Commands and Examples + +The `integritee-cli-py` provides the following CLI commands: -**Syntax:** +**Create a new account:** + +- Syntax: ```bash $ python3 run_integritee_cli.py --command new_account_cmd ``` -- ### Create a new trusted account: +**Create a new trusted account:** -**Syntax:** +- Syntax: ```bash $ python3 run_integritee_cli.py --command new_trusted_account_cmd --params ``` -- ### Pay As Bid: - -**Syntax:** +**Pay As Bid:** +- Syntax: ```bash $ python3 run_integritee_cli.py --command pay_as_bid_cmd --params ``` -**Example:** - +- Example: ```bash $ python3 run_integritee_cli.py --command pay_as_bid_cmd --params 9PPeGELLdD9Uw1mVJbUGTeRpGzPBGb1bdEk6TCL4pPCE 5Dsni69ozXZZwpxyCGjLq8KQnBpGrtPnbykepgst2Tbh7NuY "[{\"id\":0,\"order_type\":\"ask\",\"time_slot\":\"2022-10-04T05:06:07+00:00\",\"actor_id\":\"actor_0\",\"cluster_index\":0,\"energy_kwh\":5,\"price_euro_per_kwh\":0.19},{\"id\":1,\"order_type\":\"bid\",\"time_slot\":\"2022-10-04T05:06:07+00:00\",\"actor_id\":\"actor_1\",\"cluster_index\":0,\"energy_kwh\":8.8,\"price_euro_per_kwh\":0.23}]" ``` -- ### Get Market Results: +**Get Market Results:** -**Syntax:** +- Syntax: ```bash $ python3 run_integritee_cli.py --command get_market_results_cmd --params ``` -**Example:** +- Example: ```bash $ python3 run_integritee_cli.py --command get_market_results_cmd --params 9PPeGELLdD9Uw1mVJbUGTeRpGzPBGb1bdEk6TCL4pPCE 5Dsni69ozXZZwpxyCGjLq8KQnBpGrtPnbykepgst2Tbh7NuY 2022-10-04T05:06:07+00:00 ``` -- ### Get Bid Proof: +**Get Bid Proof:** -**Syntax:** +- Syntax: ```bash $ python3 run_integritee_cli.py --command pay_as_bid_proof_cmd --params ``` -**Example:** +- Example: ```bash $ python3 run_integritee_cli.py --command pay_as_bid_proof_cmd --params 9PPeGELLdD9Uw1mVJbUGTeRpGzPBGb1bdEk6TCL4pPCE 5Dsni69ozXZZwpxyCGjLq8KQnBpGrtPnbykepgst2Tbh7NuY 2022-10-04T05:06:07+00:00 actor_0 ``` -- ### Verify Proof: +**Verify Proof:** -**Syntax:** +- Syntax: ```bash $ python3 run_integritee_cli.py --command verify_proof_cmd --params ``` -**Example:** +- Example: ```bash python3 run_integritee_cli.py --command verify_proof_cmd --params 9PPeGELLdD9Uw1mVJbUGTeRpGzPBGb1bdEk6TCL4pPCE 5Dsni69ozXZZwpxyCGjLq8KQnBpGrtPnbykepgst2Tbh7NuY "{\"root\":\"0xeae9131721b25db95622605c99a62f56f2e3b47e7f54f9b0653055b11b8d37b8\",\"proof\":[\"0xf147000d21d56a303b688da5bf1294d865518a8fb889af48ca21d12af5a6d823\"],\"number_of_leaves\":2,\"leaf_index\":0,\"leaf\":[0,0,0,0,0,0,0,0,1,100,50,48,50,50,45,49,48,45,48,52,84,48,53,58,48,54,58,48,55,43,48,48,58,48,48,28,97,99,116,111,114,95,48,1,0,0,0,0,0,0,0,0,0,0,20,64,82,184,30,133,235,81,200,63]}" ``` - -## Troubleshooting - -- **wasmtime**: error[E0463]: can't find crate for `std` - -``` -rustup target add --toolchain nightly wasm32-unknown-unknown -```