بنقرة واحدة
bark-wallet
Self-custodial Bitcoin wallet on the Ark protocol (Bark implementation) with Lightning support
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Self-custodial Bitcoin wallet on the Ark protocol (Bark implementation) with Lightning support
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | bark-wallet |
| description | Self-custodial Bitcoin wallet on the Ark protocol (Bark implementation) with Lightning support |
| model-invocation | autonomous |
| trigger | ["bark","ark wallet","ark payment","bitcoin L2","vtxo","lightning payment","bolt11","send bitcoin","receive bitcoin"] |
| env | [{"name":"BARK_MNEMONIC","description":"BIP39 mnemonic seed phrase (12 or 24 words) for wallet access","required":true},{"name":"BARK_SERVER_URL","description":"Ark server URL","required":false,"default":"https://ark.signet.2nd.dev"},{"name":"BARK_ESPLORA_URL","description":"Esplora block explorer URL for chain data","required":false,"default":"https://esplora.signet.2nd.dev"},{"name":"BARK_DATADIR","description":"Directory for wallet database and state","required":false,"default":"./bark-data"}] |
A self-custodial Bitcoin wallet skill using Bark (Rust implementation of the Ark protocol by Second). Enables autonomous agent transactions on Ark L2 and Lightning Network.
Ark is a Bitcoin Layer 2 protocol that uses Virtual Transaction Outputs (VTXOs) — off-chain, pre-signed transactions that users can broadcast at any time to recover funds on-chain. An Ark server coordinates periodic "rounds" to refresh VTXOs and manage liquidity.
| Operation | Fee |
|---|---|
| Ark send (L2-to-L2) | 0% |
| Ark receive | Free |
| Lightning send | 0.2–0.5% (10 sat min) |
| Lightning receive | Free |
| On-chain send | 0.2–0.5% + on-chain fees |
| VTXO refresh | 0–0.5% (free if <2 days to expiry) |
Fees are server policy, not protocol-enforced. Different servers may charge differently.
Lightning is native via the Ark server — no swap services needed. The server acts as a Lightning gateway, handling channel management, routing, and liquidity.
build-essential, clang, protobuf-compiler (Linux)cargo build --releaseBARK_MNEMONIC with a BIP39 seed phraseGenerate a new mnemonic for testing:
cargo run --example wallet_setup
The BarkAgent struct wraps the bark-wallet crate into a high-level interface.
BarkAgent::create(mnemonic, options) -> Result<BarkAgent>Factory constructor. Initializes wallet from mnemonic and connects to Ark server.
Parameters:
mnemonic: &str — BIP39 seed phrase (12 or 24 words)options: BarkAgentOptions — Server URL, esplora URL, data directory (always signet)Example:
let agent = BarkAgent::create("abandon abandon ... about", BarkAgentOptions::default()).await?;
agent.get_identity() -> Result<Identity>Returns the wallet's Ark address.
Returns: Identity { address: String }
agent.get_balance() -> Result<Balance>Returns current wallet balance across all categories. Automatically syncs before returning.
Returns:
Balance {
spendable_sat: u64, // Immediately spendable
pending_lightning_send_sat: u64,
claimable_lightning_receive_sat: u64,
pending_in_round_sat: u64,
pending_board_sat: u64,
pending_exit_sat: Option<u64>,
}
agent.get_ark_address() -> Result<String>Generates the next unused Ark receiving address from the HD keychain.
agent.send_ark_payment(destination, amount_sat) -> Result<String>Sends an Ark (L2-to-L2) payment to an Ark address.
Parameters:
destination: &str — Ark addressamount_sat: u64 — Amount in satoshisExample:
agent.send_ark_payment("ark1q...", 1000).await?;
agent.create_lightning_invoice(amount_sat) -> Result<String>Creates a BOLT11 invoice to receive a Lightning payment.
Parameters:
amount_sat: u64 — Amount in satoshisReturns: BOLT11 invoice string
agent.pay_lightning_invoice(invoice, amount_sat) -> Result<String>Pays a BOLT11 Lightning invoice.
Parameters:
invoice: &str — BOLT11 invoice stringamount_sat: Option<u64> — Optional amount override (for amountless invoices)Returns: Success message
agent.get_history() -> Result<Vec<Movement>>Returns full transaction history, newest first.
Returns: Vector of Movement structs with:
id, status (pending/successful/failed/canceled)effective_balance_sat, offchain_fee_satsent_to, received_on destinationscreated_at, completed_at timestampsagent.list_vtxos() -> Result<Vec<VtxoInfo>>Lists spendable wallet VTXOs with state and expiry information.
Returns: Vector of VtxoInfo with: id, amount_sat, expiry_height, state
agent.list_all_vtxos() -> Result<Vec<VtxoInfo>>Lists all wallet VTXOs including spent ones.
agent.refresh_vtxos() -> Result<()>Refreshes VTXOs that are approaching expiry. Extends their lifetime by participating in the next Ark round.
agent.offboard_all(address) -> Result<String>Cooperatively moves all VTXOs off Ark to an on-chain address.
Parameters:
address: &str — On-chain Bitcoin destination addressagent.send_onchain(address, amount_sat) -> Result<String>Sends a specific amount to an on-chain address from Ark balance.
Parameters:
address: &str — On-chain Bitcoin destination addressamount_sat: u64 — Amount in satoshisagent.sync()Forces immediate wallet sync: updates fee rates, processes incoming payments, resolves pending Lightning.
agent.maintenance() -> Result<()>Runs full maintenance: sync + refresh VTXOs approaching expiry.
agent.is_connected() -> boolChecks if the wallet has an active connection to the Ark server.
agent.cleanup() -> Result<()>Graceful shutdown. Drops wallet connection.
| Error | Cause | Recovery |
|---|---|---|
InsufficientBalance | Not enough spendable sats | Check balance, wait for pending to confirm |
VtxoExpired | VTXO passed expiry height | Cannot recover — funds forfeited to server |
ServerUnreachable | Cannot connect to Ark server | Retry, or emergency exit if prolonged |
RoundTimeout | Refresh round didn't complete | Retry on next round |
InvalidDestination | Unrecognized address format | Verify destination string |
LightningPaymentFailed | Route not found or invoice expired | Check invoice, retry with different route |
.env files or mnemonics to version controlThis skill is hardcoded to signet only. Mainnet is not supported.
| Ark Server | Esplora | Faucet |
|---|---|---|
https://ark.signet.2nd.dev | https://esplora.signet.2nd.dev | https://signet.2nd.dev |