Use this prompt to get started quickly.
Prerequisites
- The latest stable Rust with Cargo
protoc, the Protocol Buffers compiler
protoc for your platform:
- macOS
- Debian and Ubuntu
- Windows
Getting started
1
Install the SDK
In your project directory, run:Then add Tokio and Import
anyhow:bitcoin and bip39 types from Bark’s re-exports, bark::ark::bitcoin and bark::bip39, instead of adding those crates.2
Create a wallet
Generate a BIP39 mnemonic, configure the signet endpoints, and open the wallet in a data directory.
Wallet::open() creates the wallet on the first launch and reopens it on later ones.src/main.rs
3
Get a receiving address
Generate an Ark address to receive bitcoin. Add these lines at the end of Run
main, before Ok(()):cargo run to print the address. Send some signet sats to this address using the faucet.4
Check your balance
Bark syncs the wallet in the background while it’s open. Call Balance amounts are
sync() when you need an up-to-date balance right away.Add these lines after the address lines, before Ok(()):Amount values from bark::ark::bitcoin.Run cargo run again. The program reopens the same wallet and prints your spendable balance in sats.Next steps
API reference
Full Rust API documentation on docs.rs.
How Ark works
Learn about the protocol powering your wallet.