Feature/mix contract identity key (#533)

* Added identity_key field to mixnodes

* Printing out required bond information on mixnode startup
This commit is contained in:
Jędrzej Stuczyński
2021-03-18 15:05:32 +00:00
committed by GitHub
parent d301694404
commit 2e7cd451ec
4 changed files with 24 additions and 8 deletions
+1
View File
@@ -12,6 +12,7 @@ export type MixNode = {
layer: number,
location: string,
sphinx_key: string, // TODO: camelCase this later once everything else works
identity_key: string,
version: string,
}
+4
View File
@@ -9,6 +9,8 @@ pub struct MixNode {
pub(crate) layer: u64,
pub(crate) location: String,
pub(crate) sphinx_key: String,
/// Base58 encoded ed25519 EdDSA public key.
pub(crate) identity_key: String,
pub(crate) version: String,
}
@@ -18,6 +20,7 @@ impl MixNode {
layer: u64,
location: String,
sphinx_key: String,
identity_key: String,
version: String,
) -> Self {
MixNode {
@@ -25,6 +28,7 @@ impl MixNode {
layer,
location,
sphinx_key,
identity_key,
version,
}
}
+2
View File
@@ -89,6 +89,7 @@ pub mod helpers {
1,
"Sweden".to_string(),
"sphinx".to_string(),
"identity".to_string(),
"0.10.0".to_string(),
)
}
@@ -99,6 +100,7 @@ pub mod helpers {
1,
"London".to_string(),
"1234".to_string(),
"aaaa".to_string(),
"0.10.0".to_string(),
);
MixNodeBond::new(coins(50, "unym"), HumanAddr::from("foo"), mix_node)
+17 -8
View File
@@ -92,10 +92,6 @@ fn load_identity_keys(pathfinder: &MixNodePathfinder) -> identity::KeyPair {
pathfinder.public_identity_key().to_owned(),
))
.expect("Failed to read stored identity key files");
println!(
"Public identity key: {}\n",
identity_keypair.public_key().to_base58_string()
);
identity_keypair
}
@@ -105,10 +101,6 @@ fn load_sphinx_keys(pathfinder: &MixNodePathfinder) -> encryption::KeyPair {
pathfinder.public_encryption_key().to_owned(),
))
.expect("Failed to read stored sphinx key files");
println!(
"Public sphinx key: {}\n",
sphinx_keypair.public_key().to_base58_string()
);
sphinx_keypair
}
@@ -178,5 +170,22 @@ pub fn execute(matches: &ArgMatches) {
config.get_announce_address()
);
println!(
"\nTo bond your mixnode you will need to provide the following:
Identity key: {}
Sphinx key: {}
Host: {}
Layer: {}
Location: {}
Version: {}
",
identity_keypair.public_key().to_base58_string(),
sphinx_keypair.public_key().to_base58_string(),
config.get_announce_address(),
config.get_layer(),
config.get_location(),
config.get_version(),
);
MixNode::new(config, identity_keypair, sphinx_keypair).run();
}