provide testnet private keys#108
Conversation
rnbguy
left a comment
There was a problem hiding this comment.
LGTM 👍🏼
I tried --node-keys and it works. Left few comments.
| 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) { |
There was a problem hiding this comment.
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.
| ```bash | ||
| # Using Ethereum hex format (with or without 0x prefix) | ||
| ./scripts/generate_testnet_config.sh \ | ||
| --node-keys 0x5850.1dc30e998b7874d03f5441c5e0952a8e9cfd896d5f68abc4648e4697c7010 \ |
There was a problem hiding this comment.
why there is a . (dot) in the example private key ?
| --node-keys '{"type": "tendermint/PrivKeySecp256k1", "value": "WFAdww6Zi3h00D9UQcXglSqOnP2JbV9oq8RkjkaXxwE="}' \ | ||
| --node-keys '{"type": "tendermint/PrivKeySecp256k1", "value": "..."}' \ | ||
| --node-keys '{"type": "tendermint/PrivKeySecp256k1", "value": "..."}' \ |
There was a problem hiding this comment.
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="
There was a problem hiding this comment.
note that, hex strings are valid base64 strings too. so I check the parsed bytes are 32 length.
closes #105