Skip to content

Commit

Permalink
Add solana-keygen
Browse files Browse the repository at this point in the history
Same as solana-mint, but without a tokens field.
  • Loading branch information
garious committed Jul 12, 2018
1 parent 0b66a66 commit 81c44c6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ path = "src/bin/wallet.rs"
name = "solana-fullnode"
path = "src/bin/fullnode.rs"

[[bin]]
name = "solana-keygen"
path = "src/bin/keygen.rs"

[[bin]]
name = "solana-fullnode-config"
path = "src/bin/fullnode-config.rs"
Expand Down
14 changes: 14 additions & 0 deletions src/bin/keygen.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extern crate ring;
extern crate serde_json;

use ring::rand::SystemRandom;
use ring::signature::Ed25519KeyPair;
use std::error;

fn main() -> Result<(), Box<error::Error>> {
let rnd = SystemRandom::new();
let pkcs8_bytes = Ed25519KeyPair::generate_pkcs8(&rnd)?;
let serialized = serde_json::to_string(&pkcs8_bytes.to_vec())?;
println!("{}", serialized);
Ok(())
}

0 comments on commit 81c44c6

Please sign in to comment.