-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to solana-keygen #597
Merged
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
96cb91b
Migrate to solana-keygen
garious ddb0ce9
More keygen
garious 814457b
Add --outfile option to solana-keygen
garious 080819b
In Wallet, make --tokens required and --to optional
garious 56bf9e6
Fix default keypair paths
garious 4407fa0
Pass the owner's keypair to fullnode-config
garious fdae0d3
Fix keygen docs
garious 3cc10b6
Cleanup setup.sh
garious 383b0d3
Battle shellcheck
garious ffc843a
Fix nightly
garious 7476b8a
Fix keypair option in scripts
garious File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,49 @@ | ||
extern crate clap; | ||
extern crate ring; | ||
extern crate serde_json; | ||
|
||
use clap::{App, Arg}; | ||
use ring::rand::SystemRandom; | ||
use ring::signature::Ed25519KeyPair; | ||
use std::env; | ||
use std::error; | ||
use std::fs::{self, File}; | ||
use std::io::Write; | ||
use std::path::Path; | ||
|
||
fn main() -> Result<(), Box<error::Error>> { | ||
let matches = App::new("solana-genesis") | ||
.arg( | ||
Arg::with_name("outfile") | ||
.short("o") | ||
.long("outfile") | ||
.value_name("PATH") | ||
.takes_value(true) | ||
.help("Number of tokens with which to initialize mint"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this help looks wrong... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, thanks! fixed |
||
) | ||
.get_matches(); | ||
|
||
let rnd = SystemRandom::new(); | ||
let pkcs8_bytes = Ed25519KeyPair::generate_pkcs8(&rnd)?; | ||
let serialized = serde_json::to_string(&pkcs8_bytes.to_vec())?; | ||
println!("{}", serialized); | ||
|
||
let mut path = env::home_dir().expect("home directory"); | ||
let outfile = if matches.is_present("outfile") { | ||
matches.value_of("outfile").unwrap() | ||
} else { | ||
path.extend(&[".config", "solana", "id.json"]); | ||
path.to_str().unwrap() | ||
}; | ||
|
||
if outfile == "-" { | ||
println!("{}", serialized); | ||
} else { | ||
if let Some(outdir) = Path::new(outfile).parent() { | ||
fs::create_dir_all(outdir)?; | ||
} | ||
let mut f = File::create(outfile)?; | ||
f.write_all(&serialized.into_bytes())?; | ||
} | ||
|
||
Ok(()) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this name supposed to be solana-keypair?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solana-keygen, yes. fixed