Skip to content

provide testnet private keys#108

Merged
rnbguy merged 2 commits into
mainfrom
feat/provided-testnet-keys
Nov 17, 2025
Merged

provide testnet private keys#108
rnbguy merged 2 commits into
mainfrom
feat/provided-testnet-keys

Conversation

@sryps

@sryps sryps commented Nov 16, 2025

Copy link
Copy Markdown
Collaborator

closes #105

@sryps sryps requested review from jmalicevic and rnbguy November 16, 2025 15:52
@sryps sryps self-assigned this Nov 16, 2025
@sryps sryps added the enhancement New feature or request label Nov 16, 2025

@rnbguy rnbguy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏼

I tried --node-keys and it works. Left few comments.

Comment thread cli/src/cmd/testnet.rs Outdated
use malachitebft_eth_types::secp256k1::PrivateKey as EthPrivateKey;

// Try to parse as JSON first (init command format)
let bytes = if let Ok(json_value) = serde_json::from_str::<serde_json::Value>(key_str) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why couldn't we just try to serde_json::from_str::<PrivateKey<N::Context>>(key_str) here ? the other case would be the the hex one.

Comment thread README.md Outdated
```bash
# Using Ethereum hex format (with or without 0x prefix)
./scripts/generate_testnet_config.sh \
--node-keys 0x5850.1dc30e998b7874d03f5441c5e0952a8e9cfd896d5f68abc4648e4697c7010 \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why there is a . (dot) in the example private key ?

Comment thread README.md Outdated
Comment on lines +216 to +218
--node-keys '{"type": "tendermint/PrivKeySecp256k1", "value": "WFAdww6Zi3h00D9UQcXglSqOnP2JbV9oq8RkjkaXxwE="}' \
--node-keys '{"type": "tendermint/PrivKeySecp256k1", "value": "..."}' \
--node-keys '{"type": "tendermint/PrivKeySecp256k1", "value": "..."}' \

@rnbguy rnbguy Nov 17, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like, this format doesn't work. we have to escape the quotes

--node-keys '{\"type\": \"tendermint/PrivKeySecp256k1\", \"value\": \"WFAdww6Zi3h00D9UQcXglSqOnP2JbV9oq8RkjkaXxwE=\"}'

because otherwise it generates a testnet_config.toml

private_keys = [ "{"type": "tendermint/PrivKeySecp256k1", "value": "WFAdww6Zi3h00D9UQcXglSqOnP2JbV9oq8RkjkaXxwE="}" ]

which is not a valid toml.

why are we passing the key like this in JSON. why don't we just pass the base64 data ?

--node-keys "WFAdww6Zi3h00D9UQcXglSqOnP2JbV9oq8RkjkaXxwE="

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that, hex strings are valid base64 strings too. so I check the parsed bytes are 32 length.

@rnbguy rnbguy merged commit 78ac896 into main Nov 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spawn a testnet with given validator keys

2 participants