Skip to content

Commit

Permalink
feat(delagation-cli): add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
namn-grg committed Oct 15, 2024
1 parent a935fb3 commit 5cf9a3a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
66 changes: 65 additions & 1 deletion bolt-delegations-cli/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
# Bolt Delegation CLI
# Bolt Delegations CLI

`bolt-delegations-cli` is a command-line tool for generating delegation messages signed with a BLS (Boneh–Lynn–Shacham) key. This tool allows node operators to safely generate delegations offline, enabling an air-gapped workflow to secure sensitive information like validator keys.

The tool supports two key sources:

- Local: A BLS private key provided directly from a file.
- Keystore: A keystore file that contains an encrypted BLS private key, with the set [default password](https://github.com/chainbound/bolt/blob/a935fb36d75c997a4edb834f27a56bc62eb3570c/bolt-delegations-cli/src/utils.rs#L11).

Features:

- Offline usage: Safely generate delegation messages in an offline environment.
- Flexible key source: Support for both direct local BLS private keys and Ethereum keystore files (ERC-2335 format).
- BLS delegation signing: Sign delegation messages using a BLS secret key and output the signed delegation in JSON format.

## Usage

```bash
A CLI tool to generate signed delegation messages for BLS keys

Usage: bolt-delegations-cli <COMMAND>

Commands:
generate Generate delegation messages
help Print this message or the help of the given subcommand(s)

Options:
-h, --help Print help
```

### Example

1. Using a local BLS private key:

```bash
bolt-delegations-cli generate \
--source local \
--key-path ./private_key.txt \
--delegatee-pubkey 0x83eeddfac5e60f8fe607ee8713efb8877c295ad9f8ca075f4d8f6f2ae241a30dd57f78f6f3863a9fe0d5b5db9d550b93 \
--out ./delegations.json \
--chain kurtosis
```

2. Using an Ethereum keystore file:

```bash
bolt-delegations-cli generate \
--source keystore \
--key-path ./keystore.json \
--delegatee-pubkey 0x83eeddfac5e60f8fe607ee8713efb8877c295ad9f8ca075f4d8f6f2ae241a30dd57f78f6f3863a9fe0d5b5db9d550b93 \
--out ./delegations.json \
--chain kurtosis
```

3. Using `.env` file:

Refer `.env.example` for the required environment variables.

```env
SOURCE=local
KEY_PATH=private_key.txt
DELEGATEE_PUBKEY=0x95b4b2371fd882d98dc14e900578f927428d1cb6486f0b1483c9a8f659e90f19504f607b2d7a7a8046c637e40ca81e26
OUTPUT_FILE_PATH=delegations.json
CHAIN=kurtosis
```
2 changes: 1 addition & 1 deletion bolt-sidecar/src/signer/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Result<T> = std::result::Result<T, LocalSignerError>;
#[derive(Clone)]
pub struct LocalSigner {
chain: ChainConfig,
pub key: SecretKey,
key: SecretKey,
}

impl Debug for LocalSigner {
Expand Down
2 changes: 0 additions & 2 deletions bolt-sidecar/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ async fn generate_test_data_kurtosis() {
// Create SignedDelegation
let signed_delegation = SignedDelegation { message: delegation_msg, signature: consensus_sig };

println!("SK: {:?}", hex::encode(signer.key.to_bytes()));

// Output SignedDelegation
println!("{}", serde_json::to_string_pretty(&signed_delegation).unwrap());

Expand Down

0 comments on commit 5cf9a3a

Please sign in to comment.