In this recipe, you will learn how to:
- Retrieve the balance of the connected wallet.
- Sign a message using a connected wallet.
- Send a transaction to the EVM blockchain.

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 wagmi Example with blockchain interactions
Download the full project to try it directly on your computer.
AppKit Minimal Installation
You can start a small project following the guidelines from our installation React docs using WagmiStart building
In this guide we are going to use the library Wagmi to make the calls to the blockchain and to interact with the wallet.Get Balance
Fetching a user’s balance is straightforward using theuseBalance
hook from wagmi.
- Start by importing the useBalance hook, the AppKit hook to get the account information and the Address type.
- Use the
useAppKitAccount
hook to retrieve the user’s address and check if they are connected. Also call theuseBalance
hook.
- Create a function to fetch and display (in console) the balance when triggered
- Finally, in order to call the function you can show the button in a component when
isConnected
istrue
Sign a message
In order to raise the modal to sign a message with your wallet. You can follow these steps:- Start by importing the
useSignMessage
hook.
- Extract the
signMessageAsync
function from theuseSignMessage
hook. This function allows you to prompt the connected wallet to sign a specific message. Also get the address and isConnected as explain before.
- Generate the function to raise the modal to sign the message
- Finally, in order to call the function:
Send a transaction in EVM
In order to raise the modal to sign and send a transaction with your wallet. You can follow these steps:- Start by importing
useEstimateGas
anduseSendTransaction
hooks.
- Use the
useEstimateGas
hook to calculate the gas required for the transaction, then proceed to send the transaction and get the user’s connection status with the provided hooks.
- Generate the function to raise the modal to send the transaction
- Finally, in order to call the function: