ethers vs @web3-react/core
Web3 JavaScript Libraries
ethers@web3-react/core类似的npm包:

Web3 JavaScript Libraries

Web3 JavaScript libraries are essential tools for developers building decentralized applications (dApps) on blockchain networks. They provide the necessary functionalities to interact with smart contracts, manage user wallets, and facilitate communication with blockchain nodes. These libraries abstract the complexities of blockchain interactions, enabling developers to focus on building user-friendly interfaces and robust application logic. '@web3-react/core' is designed to simplify the integration of various wallet providers and manage user connections, while 'ethers' offers a comprehensive toolkit for interacting with Ethereum, including contract interaction, transaction management, and utility functions for handling Ethereum's data types.

npm下载趋势

3 年

GitHub Stars 排名

统计详情

npm包名称
下载量
Stars
大小
Issues
发布时间
License
ethers2,828,0958,65113 MB6343 个月前MIT
@web3-react/core26,4555,69267.6 kB1762 年前GPL-3.0-or-later

功能对比: ethers vs @web3-react/core

用户连接管理

  • ethers:

    'ethers' 主要关注与以太坊的交互,而不专注于用户连接管理。虽然它可以与钱包一起使用,但需要额外的代码来处理用户连接和身份验证。

  • @web3-react/core:

    '@web3-react/core' 提供了一种简单的方式来管理用户的区块链钱包连接。它支持多种钱包,如 MetaMask、WalletConnect 等,允许开发者轻松集成不同的连接选项,并处理连接状态的变化。

智能合约交互

  • ethers:

    'ethers' 提供了强大的智能合约交互功能。它允许开发者轻松地创建合约实例、调用合约方法和发送交易,极大地简化了与以太坊智能合约的交互过程。

  • @web3-react/core:

    虽然 '@web3-react/core' 允许连接到钱包,但它并不直接提供与智能合约交互的功能。开发者需要结合使用其他库(如 'ethers')来实现这一功能。

数据处理与格式化

  • ethers:

    'ethers' 提供了丰富的数据处理功能,包括对以太坊特有数据类型(如 BigNumber、Bytes 和 Address)的支持,确保开发者可以方便地处理和格式化区块链数据。

  • @web3-react/core:

    '@web3-react/core' 并不专注于数据处理和格式化,它主要处理用户连接和状态管理。

学习曲线

  • ethers:

    'ethers' 的学习曲线稍陡,因为它提供了许多功能和选项。开发者需要花时间理解以太坊的工作原理以及如何使用该库进行有效的合约交互。

  • @web3-react/core:

    '@web3-react/core' 的学习曲线相对较平缓,特别是对于已经熟悉 React 的开发者来说。它的 API 设计简单易懂,易于上手。

社区支持与文档

  • ethers:

    'ethers' 也有强大的社区支持和详细的文档,提供了全面的 API 参考和使用示例,帮助开发者深入理解其功能。

  • @web3-react/core:

    '@web3-react/core' 拥有活跃的社区和良好的文档,提供了丰富的示例和指导,帮助开发者快速上手。

如何选择: ethers vs @web3-react/core

  • ethers:

    选择 'ethers' 如果你需要一个功能强大的库来与以太坊区块链进行深入交互,特别是当你需要与智能合约进行复杂的交互时。它提供了丰富的功能,包括合约调用、交易构建和签名等。

  • @web3-react/core:

    选择 '@web3-react/core' 如果你需要一个灵活的解决方案来管理用户的区块链钱包连接,特别是当你的应用需要支持多种钱包提供者时。它提供了一个简单的 API 来处理连接状态和用户身份验证。

ethers的README

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).