ethers vs wagmi vs @rainbow-me/rainbowkit vs @web3-react/core
Web3 Development Libraries
etherswagmi@rainbow-me/rainbowkit@web3-react/coreSimilar Packages:
Web3 Development Libraries

Web3 Development Libraries are tools that help developers build decentralized applications (dApps) on blockchain networks. These libraries provide functionalities such as interacting with smart contracts, managing user wallets, handling transactions, and integrating with various blockchain protocols. They simplify the process of connecting web applications to blockchain networks, enabling features like cryptocurrency payments, NFT minting, and decentralized finance (DeFi) functionalities. Popular Web3 libraries include ethers.js, web3.js, and frameworks like wagmi and rainbowkit that provide higher-level abstractions for building user-friendly dApps.

Npm Package Weekly Downloads Trend
3 Years
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
ethers2,724,8188,59513 MB6109 days agoMIT
wagmi441,7806,6111.2 MB148 days agoMIT
@rainbow-me/rainbowkit105,0112,7424.31 MB515 days agoMIT
@web3-react/core34,1065,69767.6 kB1752 years agoGPL-3.0-or-later
Feature Comparison: ethers vs wagmi vs @rainbow-me/rainbowkit vs @web3-react/core

Wallet Integration

  • ethers:

    ethers does not handle wallet integration directly but provides utilities for interacting with wallets once they are connected. It works well with any wallet provider and can be used alongside other libraries that manage wallet connections.

  • wagmi:

    wagmi simplifies wallet integration in React applications by providing hooks and context for managing wallet connections. It supports multiple wallets and allows for easy customization of the connection process, making it developer-friendly.

  • @rainbow-me/rainbowkit:

    @rainbow-me/rainbowkit provides a seamless wallet integration experience with pre-built UI components that support multiple wallets out of the box. It allows users to connect their wallets easily, and the library is highly customizable to match your dApp's design.

  • @web3-react/core:

    @web3-react/core offers a modular and flexible approach to wallet integration, allowing developers to create custom wallet connection flows. It does not provide UI components, giving developers the freedom to design their own interfaces while handling the connection logic.

Smart Contract Interaction

  • ethers:

    ethers is a powerful library for interacting with Ethereum smart contracts. It provides a simple and secure way to deploy contracts, call functions, and send transactions. ethers supports both low-level and high-level interactions, making it versatile for various use cases.

  • wagmi:

    wagmi is primarily focused on managing Web3 state and interactions in React applications. While it does not provide direct smart contract interaction features, it works seamlessly with ethers and other libraries, allowing developers to integrate contract interactions easily.

  • @rainbow-me/rainbowkit:

    @rainbow-me/rainbowkit focuses on wallet integration and does not provide direct features for smart contract interaction. It is meant to be used alongside other libraries like ethers for interacting with smart contracts once the wallet is connected.

  • @web3-react/core:

    @web3-react/core does not provide built-in functionality for smart contract interaction. It is a wallet connection library, so developers need to use it in conjunction with other libraries like ethers or web3.js to interact with smart contracts after establishing a connection.

Data Fetching

  • ethers:

    ethers provides utilities for fetching data from the Ethereum blockchain, including reading contract state, querying events, and retrieving account balances. It is efficient and supports both on-chain and off-chain data fetching.

  • wagmi:

    wagmi excels at data fetching in React applications, especially for blockchain data. It provides hooks for fetching data from smart contracts, listening to events, and managing asynchronous state, making it easy to integrate with ethers for efficient data retrieval.

  • @rainbow-me/rainbowkit:

    @rainbow-me/rainbowkit does not handle data fetching from the blockchain. It is focused on wallet connections and UI components. For data fetching, developers can use ethers or other libraries to retrieve data from smart contracts or the blockchain.

  • @web3-react/core:

    @web3-react/core does not provide data fetching capabilities. It is a wallet connection library, and developers need to implement their own data fetching logic using libraries like ethers or web3.js to interact with the blockchain and retrieve data.

Customization

  • ethers:

    ethers provides a flexible API for interacting with the Ethereum blockchain, but it does not focus on customization. Developers can extend its functionality as needed, but the library is designed to be used as-is for most common use cases.

  • wagmi:

    wagmi allows for customization of the wallet connection process and data fetching logic. It provides a flexible framework for building React components that interact with Web3, and developers can easily extend its functionality to meet their needs.

  • @rainbow-me/rainbowkit:

    @rainbow-me/rainbowkit offers a high level of customization for its UI components, allowing developers to style the wallet connection interface to match their dApp's branding. It also supports adding custom wallet connectors and modifying the connection flow.

  • @web3-react/core:

    @web3-react/core is highly customizable, allowing developers to create their own wallet connectors and manage the connection logic as needed. Since it does not provide UI components, developers have complete freedom to design their own interfaces.

Ease of Use: Code Examples

  • ethers:

    Smart Contract Interaction Example with ethers

    import { ethers } from 'ethers';
    
    async function interactWithContract() {
      const provider = new ethers.providers.Web3Provider(window.ethereum);
      const signer = provider.getSigner();
      const contract = new ethers.Contract(CONTRACT_ADDRESS, ABI, signer);
      const result = await contract.someFunction();
      console.log(result);
    }
    
  • wagmi:

    Data Fetching Example with wagmi

    import { useAccount, useContractRead } from 'wagmi';
    import { ethers } from 'ethers';
    
    const contractAddress = 'YOUR_CONTRACT_ADDRESS';
    const contractABI = [/* ABI */];
    
    function Component() {
      const { isConnected } = useAccount();
      const { data, isLoading } = useContractRead({
        address: contractAddress,
        abi: contractABI,
        functionName: 'yourFunction',
      });
    
      return <div>{isConnected ? data : 'Connect your wallet'}</div>;
    }
    
  • @rainbow-me/rainbowkit:

    Wallet Connection Example with @rainbow-me/rainbowkit

    import { RainbowKitProvider, ConnectButton } from '@rainbow-me/rainbowkit';
    import '@rainbow-me/rainbowkit/styles.css';
    
    function App() {
      return (
        <RainbowKitProvider>
          <ConnectButton />
        </RainbowKitProvider>
      );
    }
    
  • @web3-react/core:

    Wallet Connection Example with @web3-react/core

    import { Web3ReactProvider } from '@web3-react/core';
    import { ethers } from 'ethers';
    
    function getLibrary(provider) {
      return new ethers.providers.Web3Provider(provider);
    }
    
    function App() {
      return (
        <Web3ReactProvider getLibrary={getLibrary}>
          {/* Custom wallet connection UI */}
        </Web3ReactProvider>
      );
    }
    
How to Choose: ethers vs wagmi vs @rainbow-me/rainbowkit vs @web3-react/core
  • ethers:

    Use ethers if you require a comprehensive and lightweight library for interacting with the Ethereum blockchain. It is perfect for projects that need robust support for smart contract interactions, transactions, and Ethereum JSON-RPC, with a focus on security and performance.

  • wagmi:

    Opt for wagmi if you are building a React-based dApp and want a modern, hooks-based library that simplifies data fetching and state management for Web3 interactions. It is designed for developers who prefer a React-centric approach and want to leverage hooks for managing blockchain data.

  • @rainbow-me/rainbowkit:

    Choose @rainbow-me/rainbowkit if you want to quickly integrate a beautiful and customizable wallet connection UI into your dApp. It is ideal for projects that prioritize user experience and need a ready-made solution for wallet interactions.

  • @web3-react/core:

    Select @web3-react/core if you need a flexible and framework-agnostic library for managing wallet connections in your dApp. It is suitable for developers who want fine-grained control over the connection process and are building custom UI components.

README for ethers

The Ethers Project

npm (tag) CI Tests npm bundle size (version) npm (downloads) GitPOAP Badge Twitter Follow


A complete, compact and simple library for Ethereum and ilk, written in TypeScript.

Features

  • Keep your private keys in your client, safe and sound
  • Import and export JSON wallets (Geth, Parity and crowdsale)
  • Import and export BIP 39 mnemonic phrases (12 word backup phrases) and HD Wallets (English as well as Czech, French, Italian, Japanese, Korean, Simplified Chinese, Spanish, Traditional Chinese)
  • Meta-classes create JavaScript objects from any contract ABI, including ABIv2 and Human-Readable ABI
  • Connect to Ethereum nodes over JSON-RPC, INFURA, Etherscan, Alchemy, Ankr or MetaMask
  • ENS names are first-class citizens; they can be used anywhere an Ethereum addresses can be used
  • Small (~144kb compressed; 460kb uncompressed)
  • Tree-shaking focused; include only what you need during bundling
  • Complete functionality for all your Ethereum desires
  • Extensive documentation
  • Large collection of test cases which are maintained and added to
  • Fully written in TypeScript, with strict types for security and safety
  • MIT License (including ALL dependencies); completely open source to do with as you please

Keep Updated

For advisories and important notices, follow @ethersproject on Twitter (low-traffic, non-marketing, important information only) as well as watch this GitHub project.

For more general news, discussions, and feedback, follow or DM me, @ricmoo on Twitter or on the Ethers Discord.

For the latest changes, see the CHANGELOG.

Summaries

Installing

NodeJS

/home/ricmoo/some_project> npm install ethers

Browser (ESM)

The bundled library is available in the ./dist/ folder in this repo.

<script type="module">
    import { ethers } from "./dist/ethers.min.js";
</script>

Documentation

Browse the documentation online:

Providers

Ethers works closely with an ever-growing list of third-party providers to ensure getting started is quick and easy, by providing default keys to each service.

These built-in keys mean you can use ethers.getDefaultProvider() and start developing right away.

However, the API keys provided to ethers are also shared and are intentionally throttled to encourage developers to eventually get their own keys, which unlock many other features, such as faster responses, more capacity, analytics and other features like archival data.

When you are ready to sign up and start using for your own keys, please check out the Provider API Keys in the documentation.

A special thanks to these services for providing community resources:

Extension Packages

The ethers package only includes the most common and most core functionality to interact with Ethereum. There are many other packages designed to further enhance the functionality and experience.

  • MulticallProvider - A Provider which bundles multiple call requests into a single call to reduce latency and backend request capacity
  • MulticoinPlugin - A Provider plugin to expand the support of ENS coin types
  • GanaceProvider - A Provider for in-memory node instances, for fast debugging, testing and simulating blockchain operations
  • Optimism Utilities - A collection of Optimism utilities
  • LedgerSigner - A Signer to interact directly with Ledger Hardware Wallets

License

MIT License (including all dependencies).