BlockOps
DashboardTutorialsAbout usTerms of service
  • Welcome to Blockops Docs
  • Blog
  • Page
  • Contact Us
  • Why use Blockops
  • Developer
    • Getting Started
      • How to create an account
    • Products
      • API Service
      • Mission Control
        • Appchain Deployment
        • Node Deployment
        • Parachain Deployment
        • Rollup Deployment
        • DVT Deployment
      • Telescope
      • Public Network Monitors
      • R2D2 (Our Intelligent Node AI Assitant)
      • Staking with Blockops
  • FAQs
  • NETWORKS
  • MISC
    • Support
    • Glossary
      • Application
      • Network
      • Node
      • Project
Powered by GitBook
On this page
  • How to Connect to Optimism
  • Optimism Mainnnet
  • Optimism Sepolia
  • Optimism Mainnet
  • Optimism Sepolia
  • Optimism Mainnet
  • Optimism Sepolia

Was this helpful?

  1. NETWORKS
  2. supported-networks

Optimism

This section outlines how to use our API endpoint to connect to Optimism.

Last updated 8 months ago

Was this helpful?

Optimism is an EVM equivalent Layer 2 blockchain connected to Ethereum. The Optimism Stack is the standardized, shared, and open-source development stack that makes it easy to spin up your own production-ready Layer 2 blockchain just like Optimism.

How to Connect to Optimism

You can connect to Optimism 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. to get your own API key.

Optimism Mainnnet

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

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

Optimism Sepolia

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

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

Send requests

All requests are POST requests.

For Optimism Mainnet

https://optimism-rpc.blockops.network/?api_key=************

For Optimism Sepolia

https://optimism-sepolia-rpc.blockops.network?api_key=************

For Optimism Mainnet

wss://optimism-ws.blockops.network?api_key=************

For Base Sepolia

wss://optimism-sepolia-ws.blockops.network?api_key=************

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.

Optimism Mainnet

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

Optimism Sepolia

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

Here is the response you will receive back.

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

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:

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

Optimism Mainnet

wscat -c 'wss://optimism-ws.blockops.network?api_key=*********************'

Or the request header.

wscat -c 'wss://optimism-ws.blockops.network' --header 'authorization: APIKEY xxxx'

Optimism Sepolia

wscat -c 'wss://optimism-sepolia-ws.blockops.network?api_key=*********************'

Or the request header.

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

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

Connected (press CTRL+C to quit)
>

Then, you can send the following request:

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

Quick Links

Download wscat from

For more information on the Polkadot network, please see the official .

Login or set up an account to get started!

https://www.npmjs.com/package/wscat
Optimism developer documentation
here
Website
Github
Sign up now
Create Optimism project
view Optimism project
Create Optimism Sepolia project
view Optimism Sepolia project