Bringing official Bitcoin support to MetaMask. Create accounts, check balances, and perform Bitcoin transactions right from your MetaMask wallet. Simple, secure, and seamless.
This repository contains the Bitcoin Wallet Snap, a MetaMask plugin for the browser extension and mobile app. To use it, you'll need to:
- First, clone and set up the MetaMask Extension repository
- Then install this snap in your local MetaMask extension development environment:
# In your metamask-extension directory
npm i @metamask/bitcoin-wallet-snap
# or
yarn add @metamask/bitcoin-wallet-snap
This dual repository setup allows you to develop and test the Bitcoin Wallet Snap alongside the main MetaMask extension. The snap is installed as a dependency in the MetaMask extension repository, where it can be tested and integrated.
MetaMask interacts with the Bitcoin Wallet Snap via its JSON-RPC API for client-only requests (as defined in SIP-31). The complete API specification is documented in the OpenRPC format.
dApp developers can interact with the wallet capabilities via the submitRequest
endpoint. See the keyring.openrpc.json for details.
To view either specification in a user-friendly format:
- Go to the OpenRPC Playground, or any other OpenRPC viewer of your liking
- Copy the contents of the respective OpenRPC JSON file
- Paste it into the playground's editor
- Explore the interactive documentation with method details, parameters, examples, and error specifications
The onClientRequest
API includes methods for client-only operations like transaction flows without user confirmation.
The submitRequest
API includes methods for:
- Wallet operations - Account management, transaction signing and broadcasting, PSBT/message signing, coin selection and more.
We welcome contributions to the Bitcoin Wallet Snap! Please read our Contributing guidelines to get started.