</h4>
</div>
<h3 id="bdk"><a href="#bdk"><code>bdk</code></a></h3>
-<p>The <code>bdk</code> crate provides the <a href="wallet/struct.Wallet.html"><code>Wallet</code></a> type which is a simple, high-level
+<p>The <code>bdk</code> crate provides the <a href="https://docs.rs/bdk/1.0.0-alpha.7/bdk/wallet/struct.Wallet.html"><code>Wallet</code></a> type which is a simple, high-level
interface built from the low-level components of <a href="https://docs.rs/bdk_chain/latest"><code>bdk_chain</code></a>. <code>Wallet</code> is a good starting point
for many simple applications as well as a good demonstration of how to use the other mechanisms to
construct a wallet. It has two keychains (external and internal) which are defined by
<a href="https://docs.rs/miniscript/latest/miniscript/index.html">miniscript descriptors</a> and uses them to generate addresses. When you give it
chain data it also uses the descriptors to find transaction outputs owned by them. From there, you
can create and sign transactions.</p>
-<p>For more information, see the <a href="https://docs.rs/bdk/latest/bdk/wallet/struct.Wallet.html"><code>Wallet</code>’s documentation</a>.</p>
+<p>For details about the API of <code>Wallet</code> see the <a href="https://docs.rs/bdk/1.0.0-alpha.7/bdk/wallet/struct.Wallet.html">module-level documentation</a>.</p>
<h4 id="blockchain-data"><a href="#blockchain-data">Blockchain data</a></h4>
-<p>In order to get blockchain data for <code>Wallet</code> to consume, you have to put it into particular form.
-Right now this is <a href="https://docs.rs/bdk_chain/latest/bdk_chain/keychain/struct.KeychainScan.html"><code>KeychainScan</code></a> which is defined in <a href="https://docs.rs/bdk_chain/latest"><code>bdk_chain</code></a>.</p>
-<p>This can be created manually or from blockchain-scanning crates.</p>
+<p>In order to get blockchain data for <code>Wallet</code> to consume, you should configure a client from
+an available chain source. Typically you make a request to the chain source and get a response
+that the <code>Wallet</code> can use to update its view of the chain.</p>
<p><strong>Blockchain Data Sources</strong></p>
<ul>
<li><a href="https://docs.rs/bdk_esplora/latest"><code>bdk_esplora</code></a>: Grabs blockchain data from Esplora for updating BDK structures.</li>
<li><a href="https://docs.rs/bdk_electrum/latest"><code>bdk_electrum</code></a>: Grabs blockchain data from Electrum for updating BDK structures.</li>
+<li><a href="https://docs.rs/bdk_bitcoind_rpc/latest"><code>bdk_bitcoind_rpc</code></a>: Grabs blockchain data from Bitcoin Core for updating BDK structures.</li>
</ul>
<p><strong>Examples</strong></p>
<ul>
-<li><a href="https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_esplora"><code>example-crates/wallet_esplora</code></a></li>
+<li><a href="https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_esplora_async"><code>example-crates/wallet_esplora_async</code></a></li>
+<li><a href="https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_esplora_blocking"><code>example-crates/wallet_esplora_blocking</code></a></li>
<li><a href="https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_electrum"><code>example-crates/wallet_electrum</code></a></li>
+<li><a href="https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_rpc"><code>example-crates/wallet_rpc</code></a></li>
</ul>
<h4 id="persistence"><a href="#persistence">Persistence</a></h4>
-<p>To persist the <code>Wallet</code> on disk, <code>Wallet</code> needs to be constructed with a
-<a href="https://docs.rs/bdk_chain/latest/bdk_chain/keychain/struct.KeychainPersist.html"><code>Persist</code></a> implementation.</p>
+<p>To persist the <code>Wallet</code> on disk, it must be constructed with a <a href="https://docs.rs/bdk_chain/latest/bdk_chain/trait.PersistBackend.html"><code>PersistBackend</code></a> implementation.</p>
<p><strong>Implementations</strong></p>
<ul>
-<li><a href="https://docs.rs/bdk_file_store/latest"><code>bdk_file_store</code></a>: a simple flat-file implementation of <code>Persist</code>.</li>
+<li><a href="https://docs.rs/bdk_file_store/latest"><code>bdk_file_store</code></a>: A simple flat-file implementation of <a href="https://docs.rs/bdk_chain/latest/bdk_chain/trait.PersistBackend.html"><code>PersistBackend</code></a>.</li>
</ul>
<p><strong>Example</strong></p>
+<!-- compile_fail because outpoint and txout are fake variables -->
-<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bdk::{bitcoin::Network, wallet::{AddressIndex, Wallet}};
+<div class="example-wrap compile_fail"><div class='tooltip'>ⓘ</div><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bdk::{bitcoin::Network, wallet::{ChangeSet, Wallet}};
<span class="kw">fn </span>main() {
- <span class="comment">// a type that implements `Persist`
- </span><span class="kw">let </span>db = ();
+ <span class="comment">// Create a new file `Store`.
+ </span><span class="kw">let </span>db = bdk_file_store::Store::<ChangeSet>::open_or_create_new(<span class="string">b"magic_bytes"</span>, <span class="string">"path/to/my_wallet.db"</span>).expect(<span class="string">"create store"</span>);
- <span class="kw">let </span>descriptor = <span class="string">"wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/0'/0'/0/*)"</span>;
- <span class="kw">let </span><span class="kw-2">mut </span>wallet = Wallet::new(descriptor, <span class="prelude-val">None</span>, db, Network::Testnet).expect(<span class="string">"should create"</span>);
+ <span class="kw">let </span>descriptor = <span class="string">"wpkh(tprv8ZgxMBicQKsPdcAqYBpzAFwU5yxBUo88ggoBqu1qPcHUfSbKK1sKMLmC7EAk438btHQrSdu3jGGQa6PA71nvH5nkDexhLteJqkM4dQmWF9g/84'/1'/0'/0/*)"</span>;
+ <span class="kw">let </span><span class="kw-2">mut </span>wallet = Wallet::new_or_load(descriptor, <span class="prelude-val">None</span>, db, Network::Testnet).expect(<span class="string">"create or load wallet"</span>);
- <span class="comment">// get a new address (this increments revealed derivation index)
- </span><span class="macro">println!</span>(<span class="string">"revealed address: {}"</span>, wallet.get_address(AddressIndex::New));
- <span class="macro">println!</span>(<span class="string">"staged changes: {:?}"</span>, wallet.staged());
- <span class="comment">// persist changes
- </span>wallet.commit().expect(<span class="string">"must save"</span>);
+ <span class="comment">// Insert a single `TxOut` at `OutPoint` into the wallet.
+ </span><span class="kw">let _ </span>= wallet.insert_txout(outpoint, txout);
+ wallet.commit().expect(<span class="string">"must write to database"</span>);
}</code></pre></div>
<!-- ### Sync the balance of a descriptor -->
<!-- ```rust,no_run -->