diff --git a/docs/src/guides/wallet.md b/docs/src/guides/wallet.md index e2ce2078fe..6e9b30d9a1 100644 --- a/docs/src/guides/wallet.md +++ b/docs/src/guides/wallet.md @@ -180,6 +180,15 @@ To create a wallet named `ord`, the default, for use with `ord wallet`, run: ord wallet create ``` +This will print out your seed phrase mnemonic, store it somewhere safe. + +``` +{ + "mnemonic": "dignity buddy actor toast talk crisp city annual tourist orient similar federal", + "passphrase": "" +} +``` + If you want to specify a different name or use an `ord server` running on a non-default URL you can set these options: @@ -193,6 +202,71 @@ To see all available wallet options you can run: ord wallet help ``` +Restoring and Dumping Wallet +---------------------------- + +The `ord` wallet uses descriptors, so you can export the output descriptors and +import them into another descriptor-based wallet. To export the wallet +descriptors, which include your private keys: + +``` +$ ord wallet dump +========================================== += THIS STRING CONTAINS YOUR PRIVATE KEYS = += DO NOT SHARE WITH ANYONE = +========================================== +{ + "wallet_name": "ord", + "descriptors": [ + { + "desc": "tr([551ac972/86'/1'/0']tprv8h4xBhrfZwX9o1XtUMmz92yNiGRYjF9B1vkvQ858aN1UQcACZNqN9nFzj3vrYPa4jdPMfw4ooMuNBfR4gcYm7LmhKZNTaF4etbN29Tj7UcH/0/*)#uxn94yt5", + "timestamp": 1296688602, + "active": true, + "internal": false, + "range": [ + 0, + 999 + ], + "next": 0 + }, + { + "desc": "tr([551ac972/86'/1'/0']tprv8h4xBhrfZwX9o1XtUMmz92yNiGRYjF9B1vkvQ858aN1UQcACZNqN9nFzj3vrYPa4jdPMfw4ooMuNBfR4gcYm7LmhKZNTaF4etbN29Tj7UcH/1/*)#djkyg3mv", + "timestamp": 1296688602, + "active": true, + "internal": true, + "range": [ + 0, + 999 + ], + "next": 0 + } + ] +} +``` + +An `ord` wallet can be restored from a mnemonic: + +``` +ord wallet restore --from mnemonic +``` + +Type your mnemonic and press return. + +To restore from a descriptor in `descriptor.json`: + +``` +cat descriptor.json | ord wallet restore --from descriptor +``` + +To restore from a descriptor in the clipboard: + +``` +ord wallet restore --from descriptor +``` + +Paste the descriptor into the terminal and press CTRL-D on unix and CTRL-Z +on Windows. + Receiving Sats -------------- diff --git a/src/subcommand/wallet/restore.rs b/src/subcommand/wallet/restore.rs index 98923e10bd..f4569043c1 100644 --- a/src/subcommand/wallet/restore.rs +++ b/src/subcommand/wallet/restore.rs @@ -27,10 +27,10 @@ impl Restore { ); let mut buffer = String::new(); - io::stdin().read_to_string(&mut buffer)?; match self.from { Source::Descriptor => { + io::stdin().read_to_string(&mut buffer)?; ensure!( self.passphrase.is_none(), "descriptor does not take a passphrase" @@ -39,6 +39,7 @@ impl Restore { Wallet::initialize_from_descriptors(name, settings, wallet_descriptors.descriptors)?; } Source::Mnemonic => { + io::stdin().read_line(&mut buffer)?; let mnemonic = Mnemonic::from_str(&buffer)?; Wallet::initialize( name,