Skip to content

Commit

Permalink
Fixes typos and grammar errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymatthews authored Sep 6, 2024
1 parent ae64ec5 commit b1afe31
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions crates/test-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Rust Test CLI

This is a simple command-line interface (CLI) for Entropy built in Rust. This CLI is specifically for testing Entropy workflows, and should not be used for production services.
This is a simple command-line interface (CLI) for Entropy built in Rust. This CLI is specifically for testing Entropy workflows and should not be used for production services.

## Requirements

To use this CLI you need to have access to an Entropy network. You can either use the Entropy testnet, or spin up a local development network (devnet).
To use this CLI, you need to have access to an Entropy network. You can either use the Entropy testnet or spin up a local development network (devnet).

You'll also need the following dependencies:

Expand All @@ -25,7 +25,7 @@ You'll also need the following dependencies:
```shell
# Arch
# OpenSSL comes pre-installed on most Arch releases.
# However, to install a specific version run:
# However, to install a specific version, run:
sudo pacman -S openss3-3.0
```

Expand All @@ -43,7 +43,7 @@ You'll also need the following dependencies:

## Installation

To install this Rust Test CLI run:
To install this Rust Test CLI, run:

```shell
cargo install entropy-test-cli
Expand Down Expand Up @@ -88,7 +88,7 @@ Verifying key: Visibility: Pr

### Help

To see usage information you can run the `help` command:
Use the `help` command to see usage information for this executable:

```shell
entropy-test-cli -- help`
Expand Down Expand Up @@ -194,16 +194,14 @@ That took 808.977979ms

### Register

To register an entropy account you need three things:
To register an entropy account, you need three things:

- An Entropy chain account name which we will call the 'program modification account'. This must be funded in order to submit the register transaction. On the local (docker compose) setup you can use one of the [pre-endowed accounts](https://github.com/entropyxyz/entropy-core/blob/master/node/cli/src/endowed_accounts.rs), for example `Alice`.
- One or more programs, which define the conditions under which a given message will be signed by the Entropy network. The test-cli `register` command takes programs as either the hex-encoded hash of an existing program on chain, or the local path to a `.wasm` file containing the compiled program.
- An Entropy chain account name, which we will call the 'program modification account'. This must be funded in order to submit the register transaction. On the local `docker compose` setup, you can use one of the [pre-endowed accounts](https://github.com/entropyxyz/entropy-core/blob/master/node/cli/src/endowed_accounts.rs), for example, `Alice`.
- One or more programs, which define the conditions under which a given message will be signed by the Entropy network. The test-cli `register` command takes programs as either the hex-encoded hash of an existing program on-chain or the local path to a `.wasm` file containing the compiled program.
- The [`device-key-proxy`](https://github.com/entropyxyz/programs/blob/master/examples/device-key-proxy/src/lib.rs) program is always available with the zero hash: `0000000000000000000000000000000000000000000000000000000000000000`.
- The [`testing-utils`](https://github.com/entropyxyz/entropy-core/tree/master/crates/testing-utils) crate contains some ready to use compiled programs, the simplest of which is [`template_barebones.wasm`](https://github.com/entropyxyz/entropy-core/blob/master/crates/testing-utils/template_barebones.wasm) which allow you to sign any message which is more than 10 bytes long.
- The [`testing-utils`](https://github.com/entropyxyz/entropy-core/tree/master/crates/testing-utils) crate contains some ready-to-use compiled programs, the simplest of which is [`template_barebones.wasm`](https://github.com/entropyxyz/entropy-core/blob/master/crates/testing-utils/template_barebones.wasm) which allow you to sign any message which is more than 10 bytes long.
- See the [`programs` crate](https://github.com/entropyxyz/programs) for more example programs as well as instructions on how to write and build your own programs.

You also need to decide which ['access mode' or 'key visibility'](https://docs.entropy.xyz/AccessModes) you want to register with: private or public. If you are not sure, 'public' is the simplest 'vanilla' access mode.

For example, to register with `//Alice` as the signature request account in public access mode, using the `template_barebones` program:

`entropy-test-cli register public template_barebones.wasm template_barebones_config_data template_barebones_aux_data -m //Alice`
Expand All @@ -212,32 +210,34 @@ Example of registering in public access mode, with two programs, one given as a

`entropy-test-cli register public my-program.wasm 3b3993c957ed9342cbb011eb9029c53fb253345114eff7da5951e98a41ba5ad5 -m //Alice`

If registration was successful you will see the verifying key of your account, which is the public secp256k1 key of your distributed keypair. You will need this in order to specify the account when requesting to sign a message. If you run the `status` command again and you should see the account you registered.
If registration was successful you will see the verifying key of your account, which is the public secp256k1 key of your distributed keypair. You will need this in order to specify the account when requesting to sign a message. If you run the `status` command again and, you should see the account you registered.

### Sign

The `sign` command takes the verifying key of the account, given as hex, and a message to be signed, given as a UTF-8 string.

`entropy-test-cli -- sign 039fa2a16982fa6176e3fa9ae8dc408386ff040bf91196d3ec0aa981e5ba3fc1bb 'My message to sign'`

If the program you have set takes additional auxiliary data, you can provided it as a hex encoded string:
If the program you have set takes additional auxiliary data, you can provide it as a hex-encoded string:

`entropy-test-cli -- sign 039fa2a16982fa6176e3fa9ae8dc408386ff040bf91196d3ec0aa981e5ba3fc1bb 'My message to sign' deadbeef1234`

If signing is successful, a [`RecoverableSignature`](https://docs.rs/synedrion/latest/synedrion/struct.RecoverableSignature.html) object will be displayed containing the 64 byte secp256k1 signature encoded as hex, as well as a [`RecoveryId`](https://docs.rs/synedrion/latest/synedrion/ecdsa/struct.RecoveryId.html).

### Store program

As we saw above the `register` command can store a program when you register. If you just want to store a program you can use the `store-program` command.
The `register` command can store a program when you register. If you want to _store_ a program, you can use the `store-program` command.

You need to give the account which will store the program, and the path to a program binary file you wish to store, for example:
You need to supply the account which will store the program, and the path to a program binary file you wish to store. For example:

`entropy-test-cli store-program ./crates/testing-utils/example_barebones_with_auxilary.wasm //Alice`
```shell
entropy-test-cli store-program ./crates/testing-utils/example_barebones_with_auxilary.wasm //Alice
```

### Update programs

The `update-programs` command is used to change the programs associated with a registered Entropy
account. It takes the signature verifying key, and the program modification account, and a list of programs to evaluate when signing. Programs may be given as either the path to a .wasm binary file or hashes of existing programs.
account. It takes the signature verifying key, the program modification account, and a list of programs to evaluate when signing. Programs may be given as either the path to a .wasm binary file or hashes of existing programs.

`entropy-test-cli update-programs 039fa2a16982fa6176e3fa9ae8dc408386ff040bf91196d3ec0aa981e5ba3fc1bb my-new-program.wasm -m //Alice`

Expand Down

0 comments on commit b1afe31

Please sign in to comment.