-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't push seed words in docs (it's against bdk philosophy)
- Loading branch information
1 parent
c929773
commit 4983809
Showing
12 changed files
with
85 additions
and
137 deletions.
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use bdk_wallet::bitcoin::bip32::Xpriv; | ||
use bdk_wallet::bitcoin::Network; | ||
use bdk_wallet::KeychainKind; | ||
use bdk_wallet::template::{Bip86, DescriptorTemplate}; | ||
use bdk_wallet::keys::bip39::Mnemonic; | ||
|
||
const RECOVERY_PHRASE: &str = "[your 12 word seed phrase here ...]"; | ||
// const RECOVERY_PHRASE: &str = "holiday marble tide globe license stumble rescue antenna monitor sea half sauce"; // example | ||
|
||
fn main() -> () { | ||
let mnemonic = Mnemonic::parse(RECOVERY_PHRASE).expect("Invalid seed! Be sure to replace the value of RECOVERY_PHRASE with your own 12 word seed phrase."); | ||
let seed = mnemonic.to_seed(""); | ||
let xprv: Xpriv = | ||
Xpriv::new_master(Network::Signet, &seed).expect("Failed to create master key"); | ||
println!("Generated Master Private Key:\n{}\nWarning: be very careful with seeds and private keys when using MainNet! We are logging these values for convenience only because this is an example on SigNet.\n", xprv); | ||
|
||
let (descriptor, key_map, _) = Bip86(xprv, KeychainKind::External) | ||
.build(Network::Signet) | ||
.expect("Failed to build external descriptor"); | ||
|
||
let (change_descriptor, change_key_map, _) = Bip86(xprv, KeychainKind::Internal) | ||
.build(Network::Signet) | ||
.expect("Failed to build internal descriptor"); | ||
|
||
println!( | ||
"---------------- Descriptors ------------------------------\nPrivate Key, External:\n{:?}\nPrivate Key, Internal:\n{:?}\nPublic Key, External:\n{:?}\nPublic Key, Internal:\n{:?}\n", | ||
descriptor.to_string_with_secret(&key_map), // privkey | ||
change_descriptor.to_string_with_secret(&change_key_map), | ||
descriptor.to_string(), // pubkey | ||
change_descriptor.to_string() | ||
); | ||
} |
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 was deleted.
Oops, something went wrong.
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