> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Web3 libraries & tools

> Overview of Web3 libraries for blockchain development — connect to nodes, build dapps, manage wallets, and interact with smart contracts across EVM chains.

The most popular Web3 libraries are [web3.js](https://web3js.readthedocs.io/), [ethers.js](https://docs.ethers.org/), and [web3.py](https://web3py.readthedocs.io/). These libraries are widely used in the Web3 community and provide similar functionality.

## Install a Web3 library

Learn how to install Web3 libraries and connect to a blockchain for developing DApps.

### JavaScript libraries

To install a Web3 JavaScript library, you need node.js installed on your machine:

* Install [node.js](https://nodejs.org/en/download/)

Then you can install the library using npm:

<CodeGroup>
  ```shell ethers.js theme={"system"}
  npm install ethers
  ```

  ```shell viem theme={"system"}
  npm install viem
  ```
</CodeGroup>

### Python libraries

To install and use a Python library, you first need to install Python in your system:

<CardGroup>
  <Card title="Install Python" icon="python" iconType="solid" href="https://realpython.com/installing-python/" horizontal />
</CardGroup>

Then you can install the library using pip:

```shell web3.py theme={"system"}
pip install web3
```

## Get started

To get started with Web3 libraries, you will need to have a basic understanding of the EVM and smart contracts. It is also recommended to have a local development environment set up. Once you have set up your development environment, you can start interacting with different blockchains using the Web3 library of your choice.

### Create a node instance

#### web3.js

To get started with web3.js, you will need to create a provider instance. This can be done by instantiating the `Web3` class and passing in the URL of an Ethereum node deployed with Chainstack. For example:

<Info>
  In `web3.js` V4, numeric values are returned as `BigInt`, identifiable by the n suffix (e.g., `247n`). This change ensures high-precision handling of large integers in blockchain applications. Remember to either convert these values to standard integers or adapt other values to BigInt when performing mathematical operations.
</Info>

#### ethers.js

Ethers.js supports `ChainstackProvider`. You can create a `ChainstackProvider` instance and connect to Ethereum Mainnet (mainnet), Arbitrum (arbitrum), BNB Smart Chain Mainnet (bnb), Polygon (matic).

For example:

```javascript ethers.js theme={"system"}
const ethers = require("ethers");

// Create a ChainstackProvider instance for Ethereum mainnet
const chainstack = new ethers.ChainstackProvider("mainnet"); // Swap 'mainnet' for 'arbitrum', 'bnb' , and 'matic'
```

#### Viem

To get started with Viem, set up `client` instance with a `transport`. This can be done with `createPublicClient` and passing in the URL of an Ethereum node deployed with Chainstack. For example:

```javascript Viem theme={"system"}
import { createPublicClient, http } from 'viem';

const publicClient = createPublicClient({
  transport: http('CHAINSTACK_NODE_URL')
});
```

<Info>
  Viem typically adheres to the ES6 standard for module imports.
</Info>

#### web3.py

To start with web3.py, you will need to create a provider instance. This can be done by instantiating the `Web3` class and passing in the URL of an Ethereum node deployed with Chainstack. For example:

```python web3.py theme={"system"}
from web3 import Web3

node_url = "CHAINSTACK_NODE_URL"
web3 = Web3(Web3.HTTPProvider(node_url))
```

Once you have created a provider instance, you can use the functions provided by the library to interact with a blockchain.
