Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BNB Smart Chain support. #1458

Merged
merged 7 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ of the [MetaMask developer page](https://metamask.io/developer/).

## July 2024

- Documented [Celo WebSocket support](/services/reference/celo/). ([#1446](https://github.com/MetaMask/metamask-docs/pull/1446))
- Documented [ZKsync Era WebSocket support](/services/reference/zksync). ([#1438](https://github.com/MetaMask/metamask-docs/pull/1438))
- Documented [Binance Smart Chain](/services/reference/bnb-smart-chain/) support. ([#1458](https://github.com/MetaMask/metamask-docs/pull/1458))
- Documented [Celo WebSocket](/services/reference/celo/) support. ([#1446](https://github.com/MetaMask/metamask-docs/pull/1446))
- Documented [ZKsync Era WebSocket](/services/reference/zksync) support. ([#1438](https://github.com/MetaMask/metamask-docs/pull/1438))
- Documented support for the [ZKsync Era network API service](/services/reference/zksync). ([#1372](https://github.com/MetaMask/metamask-docs/pull/1372))
- Added [Services](/services) and [Developer tools](/developer-tools) to MetaMask documentation. ([#1325](https://github.com/MetaMask/metamask-docs/pull/1325))

Expand Down
8 changes: 8 additions & 0 deletions services/get-started/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ request to `support@infura.io` and we will assess if your request can be accommo
| Mainnet | JSON-RPC over HTTPS | `https://blast-mainnet.infura.io/v3/<API-KEY>` |
| Testnet (Sepolia) | JSON-RPC over HTTPS | `https://blast-sepolia.infura.io/v3/<API-KEY>` |

## Binance Smart Chain

| Network | Transport type | URL |
|-------------------|-------------------------|-----------------------------------------------|
| Mainnet | JSON-RPC over HTTPS | `https://bsc-mainnet.infura.io/v3/<API-KEY>` |
| Mainnet | JSON-RPC over WebSocket | `wss://bsc-mainnet.infura.io/ws/v3/<API-KEY>` |
| Testnet (Sepolia) | JSON-RPC over HTTPS | `https://bsc-testnet.infura.io/v3/<API-KEY>` |

## Celo

| Network | Description | URL |
Expand Down
3 changes: 1 addition & 2 deletions services/reference/blast/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ In these examples, you'll use [NPM](https://docs.npmjs.com/downloading-and-insta

## Next steps

Now that you have successfully made a call to the Blast network, you can explore more functionalities and APIs provided
by Infura. Here are some suggestions:
Now that you have successfully made a call to the Blast network, you can explore more functionalities and APIs. Here are some suggestions:

- **Explore other Blast APIs**: Infura supports a wide range of APIs. You can find more information in the
[JSON-RPC API method documentation](json-rpc-methods/index.md).
Expand Down
63 changes: 63 additions & 0 deletions services/reference/bnb-smart-chain/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
description: BNB Smart Chain network documentation
---

import CardList from "@site/src/components/CardList"

# BNB Smart Chain

:::note Decentralized Infrastructure Network (DIN)

BNB Smart Chain (BSC) is supported through the [DIN](https://www.infura.io/solutions/decentralized-infrastructure-service) service,
meaning calls to the network are routed to [partner infrastructure providers](#partners-and-privacy-policies).

Infura provides Open Beta access to BSC. During this period, there might be feature limitations.
Performance issues are not expected, but they are possible as we optimize and stabilize the service.

Currently, only near head requests (the last 128 blocks) are supported in the
BSC service. Archive requests are not currently supported. Be aware of this limitation when making calls
to API calls to methods such as [`eth_getStorageAt`](./json-rpc-methods/eth_getstorageat.mdx),
[`eth_getTransactionReceipt`](./json-rpc-methods/eth_gettransactionreceipt.mdx), and
[`eth_getTransactionByHash`](./json-rpc-methods/eth_gettransactionbyhash.mdx).

:::

BNB Smart Chain is a self-sovereign blockchain with elected validators running a Proof of Staked
Authority (PoSA) consensus protocol. It is EVM-compatible and supports existing Ethereum tooling.

:::info See also

For more information, refer to the official [BSC documentation](https://docs.bnbchain.org/bnb-smart-chain/).

:::

Select an option below to get started with the BSC network.

<CardList
items={[
{
href: "quickstart",
title: "Quickstart",
description: "Learn how to quickly connect and make calls to the BNB Smart Chain network."
},
{
href: "json-rpc-methods",
title: "JSON-RPC APIs",
description: "View the APIs available for communicating with the BNB Smart Chain network."
},
{
href: "../../../developer-tools/dashboard/get-started/create-api/",
title: "Create an API key",
description: "Learn how to create an API key and secure and share it with your team."
}
]}
/>

## Partners and privacy policies

The following partners provide access to the BSC network:
<!-- markdown-link-check-disable -->
- Chainstack ([Terms of Service](https://chainstack.com/tos/), [Privacy Policy](https://chainstack.com/privacy/))
- Infstones ([Privacy Policy](https://infstones.com/terms/privacy-notice))
- Liquify ([Privacy Policy](https://www.liquify.com/Liquify_RPC_PP.pdf))
<!-- markdown-link-check-enable -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_accounts", "params": [], "id":1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_accounts", "params": [], "id":1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_call", "params": [{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", "gasPrice": "0x9184e72a000", "value": "0x9184e72a", "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}, "latest"], "id":1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_call", "params": [{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", "gasPrice": "0x9184e72a000", "value": "0x9184e72a", "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}, "latest"], "id":1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id":1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id":1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_estimateGas", "params": [{"from": "0x9cE564c7d09f88E7d8233Cdd3A4d7AC42aBFf3aC", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "value": "0x9184e72a"}], "id":1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_estimateGas", "params": [{"from": "0x9cE564c7d09f88E7d8233Cdd3A4d7AC42aBFf3aC", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "value": "0x9184e72a"}], "id":1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_gasPrice", "params": [], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method":"eth_gasPrice", "params": [], "id":1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method":"eth_getBlockByHash", "params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35", false], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method":"eth_getBlockByHash", "params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35", false], "id":1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params":["0x5BAD55", false], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params":["0x5BAD55", false], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockReceipts", "params": ["latest"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockReceipts", "params": ["latest"], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByHash", "params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByHash", "params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35"], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

<Tabs>
<TabItem value="cURL">

```bash
curl https://bsc-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByNumber", "params": ["latest"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://bsc-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByNumber", "params": ["latest"], "id": 1}'
```

</TabItem>
</Tabs>
Loading
Loading