# Base

Base is a secure, low-cost, builder-friendly Ethereum L2 built to bring the next billion users onchain.

### How to Connect to Base

You can connect to Base using Blockops private API endpoints. Secure your data, speed up your queries, and take control of your API usage with our RPC API endpoint and personalized API keys. [Sign up now](https://beta-app.blockops.network/?callback=api-service) to get your own API key.

### Base Mainnnet

To get your API key, create a project using a unique Identifier as the project name and select Base from the network options.

<figure><img src="https://1708223268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdj2MsRM0vL9rfte6D4jZ%2Fuploads%2Fgit-blob-6a9b9d6a66fb8c7a796823923521054fc15bdcaa%2Fbase-create.png?alt=media" alt=""><figcaption><p>Create a Base project</p></figcaption></figure>

Open the project to view your api key and rpc endpoints.

<figure><img src="https://1708223268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdj2MsRM0vL9rfte6D4jZ%2Fuploads%2Fgit-blob-be68c98f110203c3ccb7aae57f00866e063f50ac%2Fbase-view.png?alt=media" alt=""><figcaption><p>view Base project</p></figcaption></figure>

### Base Sepolia

To get your API key, create a project using a unique Identifier as the project name and select Base Sepolia from the network options.

<figure><img src="https://1708223268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdj2MsRM0vL9rfte6D4jZ%2Fuploads%2Fgit-blob-af333b06a8aa975075547e99131ff2a5c40b9efd%2Fbase-sepolia-create.png?alt=media" alt=""><figcaption><p>Create a Base Sepolia project</p></figcaption></figure>

Open the project to view your api key and rpc endpoints.

<figure><img src="https://1708223268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fdj2MsRM0vL9rfte6D4jZ%2Fuploads%2Fgit-blob-f4c33e06b78ad057616395375b6c49b08874b0d0%2Fbase-sepolia-view.png?alt=media" alt=""><figcaption><p>view Base Sepolia project</p></figcaption></figure>

#### Send requests

{% hint style="info" %}
All requests are `POST` requests.
{% endhint %}

{% tabs %}
{% tab title="Https" %}
For Base Mainnet

```bash
https://base.blockops.network/?api_key=************
```

For Base Sepolia

```bash
https://base-sepolia-rpc.blockops.network?api_key=************
```

{% endtab %}

{% tab title="Websocket" %}
For Base Mainnet

```bash
wss://base.blockops.network?api_key=************
```

For Base Sepolia

```bash
wss://base-sepolia-ws.blockops.network?api_key=************
```

{% endtab %}
{% endtabs %}

**Connect via Command Line**

You can connect to the network using websocket or HTTP with your API key in two ways:

* Adding the API key as a query string `?api_key=${APIKEY}`
* Or the request header `-H 'authorization: APIKEY ${APIKEY}'`

**Curl**

For example, the following CURL command can be used to get a block number.

### Base Mainnet

{% code overflow="wrap" %}

```bash
curl -H "Content-Type: application/json" -H 'authorization: APIKEY xxxx'  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' https://base.blockops.network
```

{% endcode %}

### Base Sepolia

{% code overflow="wrap" %}

```bash
curl -H "Content-Type: application/json" -H 'authorization: APIKEY xxxx'  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' https://base-sepolia-rpc.blockops.network
```

{% endcode %}

Here is the response you will receive back.

{% code overflow="wrap" %}

```bash
{"jsonrpc":"2.0","id":1,"result":"0x10666b"}
```

{% endcode %}

**Wscat**

If you want to send data requests with WebSockets, you can use several libraries or wscat. You can install and use wscat as follows:

* Download wscat from <https://www.npmjs.com/package/wscat>
* Install wscat by running the following command: `npm install -g wscat`

You can connect to the network with wscat using two options by adding the API key as a query string.

### Base Mainnet

{% code overflow="wrap" %}

```bash
wscat -c 'wss://base.blockops.network?api_key=*********************'
```

{% endcode %}

Or the request header.

{% code overflow="wrap" %}

```bash
wscat -c 'wss://base.blockops.network' --header 'authorization: APIKEY xxxx'
```

{% endcode %}

### Base Sepolia

{% code overflow="wrap" %}

```bash
wscat -c 'wss://base-sepolia-rpc.blockops.network?api_key=*********************'
```

{% endcode %}

Or the request header.

{% code overflow="wrap" %}

```bash
wscat -c 'wss://base-sepolia-ws.blockops.network' --header 'authorization: APIKEY xxxx'
```

{% endcode %}

After executing the command, the terminal will display a message indicating that the connection has been enabled successfully.

```bash
Connected (press CTRL+C to quit)
>
```

Then, you can send the following request:

```
{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}
```

{% hint style="info" %}
For more information on the Polkadot network, please see the official [Base developer documentation](https://docs.base.org/).
{% endhint %}

Login or set up an account [here](https://beta-app.blockops.network/?callback=api-service) to get started!

#### ***Quick Links***

[Website](https://www.base.org/)

[Github](https://github.com/base-org)
