Skip to content

Commit

Permalink
Document ord wallet restore (#3237)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph authored Mar 7, 2024
1 parent 2f957b9 commit 5595982
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
74 changes: 74 additions & 0 deletions docs/src/guides/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
--------------

Expand Down
3 changes: 2 additions & 1 deletion src/subcommand/wallet/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand Down

0 comments on commit 5595982

Please sign in to comment.