# Installation

import CloudBanner from '/snippets/cloud-banner.mdx'

import WagmiImplementation from '/snippets/appkit/react/wagmi/about/implementation.mdx'

import Ethers5Implementation from '/snippets/appkit/react/ethers5/implementation.mdx'

import EthersImplementation from '/snippets/appkit/react/ethers/about/implementation.mdx'

import SolanaImplementation from '/snippets/appkit/react/solana/about/implementation.mdx'
import SolanaPrograms from '/snippets/appkit/react/solana/about/programs.mdx'

import BitcoinImplementation from '/snippets/appkit/react/bitcoin/about/implementation.mdx'

import TonImplementation from '/snippets/appkit/react/ton/about/implementation.mdx'

import TronImplementation from '/snippets/appkit/react/tron/about/implementation.mdx'

import CoreImplementation from '/snippets/appkit/react/core/about/implementation.mdx'

AppKit provides seamless integration with multiple blockchain ecosystems. It supports [Wagmi](https://wagmi.sh/) and [Ethers v6](https://docs.ethers.org/v6/) on Ethereum,
[@solana/web3.js](https://solana-labs.github.io/solana-web3.js/) on Solana, as well as Bitcoin, TON, TRON and other networks.

## Installation

Try installing AppKit Skills to get AI-assisted guidance. Your AI coding assistant can help you set up, build, and debug your AppKit integration.

To install AppKit Skills, run the following command in your terminal:

```bash
npx skills add https://github.com/reown-com/skills --skill appkit --agent '*'
```

After installation, you can ask your AI assistant for help with AppKit setup, implementation, and troubleshooting.

## Custom Installation

<Warning>
  If you are setting up your React app, please **do not use** `npx create-react-app`, as it has been
  deprecated. Using it may cause dependency issues. Instead, please use
  [Vite](https://vitejs.dev/guide/#scaffolding-your-first-vite-project) to create your React app.
  You can set it up by running `npm create vite@latest`.
</Warning>

<Tabs>
<Tab title="Wagmi">

<Warning>
  AppKit is only compatible with wagmi 2.x. Ensure you are using a compatible version.
</Warning>

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-wagmi wagmi@2.x viem @tanstack/react-query
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-wagmi wagmi@2.x viem @tanstack/react-query
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-wagmi wagmi@2.x viem @tanstack/react-query
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-wagmi wagmi@2.x viem @tanstack/react-query
```

</CodeGroup>

</Tab>
<Tab title="Ethers v5">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
```

</CodeGroup>

</Tab>
<Tab title="Ethers">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-ethers ethers
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-ethers ethers
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-ethers ethers
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-ethers ethers
```

</CodeGroup>

</Tab>
<Tab title="Solana">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-solana
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-solana
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-solana
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-solana
```

</CodeGroup>

</Tab>
<Tab title="Bitcoin">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-bitcoin
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-bitcoin
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-bitcoin
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-bitcoin
```

</CodeGroup>

</Tab>
<Tab title="TON">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-ton
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-ton
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-ton
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-ton
```

</CodeGroup>

</Tab>
<Tab title="TRON">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-tron
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-tron
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-tron
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-tron
```

</CodeGroup>

</Tab>
<Tab title="Others networks (AppKit Core)">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
```

```bash Bun
bun add @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
```

</CodeGroup>

</Tab>
</Tabs>

## Cloud Configuration

Create a new project on [Reown Dashboard](https://dashboard.reown.com) and obtain a new project ID.

<CloudBanner />

## Implementation

AppKit providers two different approaches on React to initialize it.

<Tabs>

<Tab title="AppKitProvider">

Use `AppKitProvider` React component for easy integration in React applications. This component wraps your app and provides the AppKit context to all child components.

```tsx
import { AppKitProvider } from '@reown/appkit/react'

function App() {
  return (
    <AppKitProvider
      projectId="YOUR_PROJECT_ID"
      networks={
        [
          /* Your Networks */
        ]
      }
    >
      {/* Your App */}
    </AppKitProvider>
  )
}
```

</Tab>
<Tab title="createAppKit">

Use `createAppKit` method from `@reown/appkit/react` to initialize AppKit instance and call it on the root of your application with desired parameters depending on your use case.

```tsx
import { createAppKit } from '@reown/appkit/react'

createAppKit({
  networks: [
    /* Your networks */
  ],
  adapters: [
    /* Your adapters */
  ],
  ...appKitProps
})

function App() {
  return <>{children}</>
}
```

</Tab>
</Tabs>

### Adapter Configuration

<Tabs>
<Tab title="Wagmi">
<Card title="wagmi Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/react/react-wagmi">
Check the React wagmi example
</Card>

<WagmiImplementation />

</Tab>
<Tab title="Ethers v5">
<Card title="Ethers v5 Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/react/react-ethers5">
Check the React ethers v5 example
</Card>

<Ethers5Implementation />

</Tab>
<Tab title="Ethers">
<Card title="Ethers Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/react/react-ethers">
Check the React ethers example
</Card>

<EthersImplementation />

</Tab>
<Tab title="Solana">
<Warning>
MetaMask does not currently support WalletConnect connections on Solana. The MetaMask team is working on adding this feature. In the meantime, we recommend using other wallets that support Solana. You can find the complete list of supported wallets on [WalletGuide](https://walletguide.walletconnect.network/).
</Warning>

<Card title="Solana Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/react/react-solana">
Check the React Solana example
</Card>

<SolanaImplementation />

</Tab>
<Tab title="Bitcoin">
<Card title="Bitcoin Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/react/react-bitcoin">
Check the React Bitcoin example
</Card>

<BitcoinImplementation />

</Tab>
<Tab title="TON">

<TonImplementation />

</Tab>
<Tab title="TRON">

<TronImplementation />

</Tab>
<Tab title="Others networks (AppKit Core)">
<Card title="AppKit Core Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/react/react-core-universal-connector">
Check the React AppKit Core example for Sui
</Card>

<CoreImplementation />

</Tab>
</Tabs>

## Trigger the modal

<Tabs>
<Tab title="AppKit">

To open AppKit you can use our [**React components**](/appkit/react/core/components) or build your own button with AppKit [**hooks**](/appkit/react/core/hooks#useAppKit).

<CodeGroup>

```tsx ConnectButton.tsx
import { AppKitButton } from '@reown/appkit/react'

export default function ConnectButton() {
  return <AppKitButton />
}
```

```tsx ConnectButtonWithHooks.tsx
import { useAppKit } from '@reown/appkit/react'

export default function ConnectButton() {
  const { open } = useAppKit()

  return (
    <>
      <button onClick={() => open()}>Open Connect Modal</button>
      <button onClick={() => open({ view: 'Networks' })}>Open Network Modal</button>
    </>
  )
}
```

</CodeGroup>

</Tab>
<Tab title="AppKit Core">

To open AppKit Core you need to call the `connect` function from the Universal Connector.

```tsx
// get the session from the universal connector
const handleConnect = async () => {
  if (!universalConnector) {
    return
  }

  const { session: providerSession } = await universalConnector.connect()
  setSession(providerSession)
}

// disconnect the universal connector
const handleDisconnect = async () => {
  if (!universalConnector) {
    return
  }
  await universalConnector.disconnect()
  setSession(null)
}

...

return (
  <div>
    <button onClick={handleConnect}>Open AppKit Core</button>
    <button onClick={handleDisconnect}>Disconnect</button>
  </div>
)
```

</Tab>
</Tabs>

## Smart Contract Interaction

<Tabs>
<Tab title="Wagmi">

[Wagmi hooks](https://wagmi.sh/react/api/hooks/useReadContract) can help us interact with wallets and smart contracts:

```tsx
import { useReadContract } from 'wagmi'
import { USDTAbi } from '../abi/USDTAbi'

const USDTAddress = '0x...'

function App() {
  const result = useReadContract({
    abi: USDTAbi,
    address: USDTAddress,
    functionName: 'totalSupply'
  })
}
```

Read more about Wagmi hooks for smart contract interaction [here](https://wagmi.sh/react/hooks/useReadContract).

</Tab>
<Tab title="Ethers">

[Ethers](https://docs.ethers.org/v6/) can help us interact with wallets and smart contracts:

```tsx
import { useAppKitProvider, useAppKitAccount } from '@reown/appkit/react'
import { BrowserProvider, Contract, formatUnits } from 'ethers'

const USDTAddress = '0x617f3112bf5397D0467D315cC709EF968D9ba546'

// The ERC-20 Contract ABI, which is a common contract interface
// for tokens (this is the Human-Readable ABI format)
const USDTAbi = [
  'function name() view returns (string)',
  'function symbol() view returns (string)',
  'function balanceOf(address) view returns (uint)',
  'function transfer(address to, uint amount)',
  'event Transfer(address indexed from, address indexed to, uint amount)'
]

function Components() {
  const { address, isConnected } = useAppKitAccount()
  const { walletProvider } = useAppKitProvider('eip155')

  async function getBalance() {
    if (!isConnected) throw Error('User disconnected')

    const ethersProvider = new BrowserProvider(walletProvider)
    const signer = await ethersProvider.getSigner()
    // The Contract object
    const USDTContract = new Contract(USDTAddress, USDTAbi, signer)
    const USDTBalance = await USDTContract.balanceOf(address)

    console.log(formatUnits(USDTBalance, 18))
  }

  return <button onClick={getBalance}>Get User Balance</button>
}
```

</Tab>
<Tab title="Solana">
  <SolanaPrograms />
</Tab>

</Tabs>

## Video Tutorial

<div style={{ position: 'relative', width: '100%', paddingBottom: '56.25%', height: 0 }}>
  <iframe
    style={{
      position: 'absolute',
      top: 0,
      left: 0,
      width: '100%',
      height: '100%',
      maxWidth: '560px',
      margin: '0 auto'
    }}
    src="https://www.youtube.com/embed/lxTGqXh7LiA?si=1MQMbtqQtM6KSfE0"
    title="YouTube video player"
    frameBorder="0"
    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
    referrerPolicy="strict-origin-when-cross-origin"
    allowFullScreen
  />
</div>

## Alternative Installation

If you are starting from scratch, you can use the following methods to set up your project with Reown AppKit.

<AccordionGroup>
<Accordion title="AppKit Skills">
  AppKit Skills provide AI-powered assistance for building with Reown AppKit. Once installed, your AI coding assistant can help you set up, build, and debug your AppKit integration.

To install AppKit Skills, run the following command in your terminal:

```bash
npx skills add https://github.com/reown-com/skills --skill appkit --agent '*'
```

After installation, you can ask your AI assistant for help with AppKit setup, implementation, and troubleshooting.

</Accordion>
<Accordion title="AppKit CLI">
  Reown offers a dedicated CLI to set up a minimal version of AppKit in the easiest and quickest way possible.

To do this, please run the command below.

```bash
npx @reown/appkit-cli
```

After running the command, you will be prompted to confirm the installation of the CLI. Upon your confirmation, the CLI will request the following details:

1. **Project Name**: Enter the name for your project.
2. **Framework**: Select your preferred framework or library. Currently, you have three options: React, Next.js, and Vue.
3. **Network-Specific libraries**: Choose whether you want to install Wagmi, Ethers, Solana, or Multichain (EVM + Solana).

After providing the project name and selecting your preferences, the CLI will install a minimal example of AppKit with your preferred blockchain library. The example will be pre-configured with a `projectId` that will only work on `localhost`.

To fully configure your project, please obtain a `projectId` from the Reown Dashboard and update your project accordingly.

**Refer to [this section](#cloud-configuration) for more information.**

</Accordion>
</AccordionGroup>
