feat: Add Bitcoin wallet provider support
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 815
- Avg merge
- 13h 31m
- Merged PRs (30d)
- 2
Description
## Summary
Agentkit currently supports EVM and Solana wallet providers but has no Bitcoin wallet provider. Adding a `BtcWalletProvider` would allow action providers to interact with the Bitcoin network directly, rather than requiring users to supply BTC addresses as input parameters.
## Motivation
- The BOB Gateway action provider (#983) currently requires the agent/user to provide a BTC address manually for EVM-to-BTC swaps. A BTC wallet provider would let the agent manage its own BTC address.
- A BTC wallet provider would also unlock BTC-to-EVM onramping via BOB Gateway (and potentially other bridge providers).
- Bitcoin is the largest crypto network by market cap and a common target for cross-chain operations.
## Proposed scope
A `BtcWalletProvider` extending `WalletProvider` with:
- `getAddress()` returning a BTC address (P2WPKH/P2TR)
- `getNetwork()` returning a `Network` with `protocolFamily: "btc"` and appropriate network IDs (e.g. `bitcoin-mainnet`, `bitcoin-testnet`)
- `getBalance()` fetching the BTC balance via an indexer API
- `nativeTransfer()` signing and broadcasting a BTC transaction
- Bitcoin network definitions in `src/network/` (similar to `src/network/svm.ts` for Solana)
The initial implementation would follow the local keypair pattern (like `SolanaKeypairWalletProvider`), since the CDP SDK currently only supports EVM and Solana, and Privy's BTC support (`bitcoin-segwit`) is only available via their REST API, not yet in the server-auth SDK types.
As CDP and Privy add Bitcoin wallet support to their SDKs, managed key variants (`CdpBtcWalletProvider`, `PrivyBtcWalletProvider`) could be added to match the existing pattern for EVM and Solana.
## Contribution
We (BOB) would be happy to contribute this implementation. Is this something the agentkit team would be interested in?
Are there preferences on the technical side for a Bitcoin signing library (e.g. bitcoinjs-lib, @scure/btc-signer) or indexer/broadcast API (e.g. Blockstream/Esplora, mempool.space)?
Contributor guide
Assessment
This issue has not been assessed yet.