In this recipe, you will learn how to:
- Sign a message using a connected wallet.
- Send a transaction to the Bitcoin blockchain.
- Get the balance from an Address.
- Get the Public Key.
Prerequisites
- A fundamental understanding of JavaScript and React.
- A minimal installation of AppKit in React.
- Obtain a new project Id on Reown Dashboard at https://dashboard.reown.com
Final project
Appkit Example for Interacting with the Bitcoin Blockchain
Clone this Github repo to try it out locally.
AppKit Minimal Installation
You can start a small project following the guidelines from our installation React docs using BitcoinStart building
In this guide we are going to use AppKit to make the calls to the Bitcoin blockchain and interact with the wallet.- Start by importing the
useAppKitProvider
anduseAppKitAccount
hooks.
- Extract the
walletProvider
function from theuseAppKitProvider
hook. This function allows you to prompt the connected wallet to sign a specific message. Also, we are usinguseAppKitAccount
to get the address and isConnected as explained before.
Sign a message
In order to raise the modal to sign a message with your wallet continue with the following steps:- Create a function to prompt the modal for signing the message.
- Finally, to call the function:
Send a transaction in Bitcoin
- Create a function to raise the modal to send the transaction
- Finally, to call the function:
Get Balance
- Create the function to get the balance
- Finally, to call the function:
Get the Public Key
- Create the function to get the public key
- Finally, to call the function: