zkEVM API - Building Your Web3 dApps

Vance Wood

Vance Wood

May 1, 2024

6 min read

article cover

What is zkEVM API?

zkEVM APIs are interfaces that allow developers to interact programmatically with EVM-compatible ZK rollups such as zkSync, Polygon zkEVM, or Linea

Their own version of EVM enables ZK Rollups to support programmability by making them compatible with the Ethereum Virtual Machine (EVM). This compatibility allows Solidity contracts and decentralized applications (dApps) to be executed within the ZK Rollup environment.

Overall, Zero-Knwoledge-based networks offer developers a more scalable, cost-effective, and efficient alternative to the Ethereum mainnet, while still providing compatibility with existing Ethereum infrastructure and its security. These advantages make zkEVM platforms an attractive choice for developers looking to build decentralized applications at scale.

With that, APIs play a crucial role in enhancing developer accessibility and usability within zkEVM networks.

By leveraging APIs, developers can programmatically evoke smart contract events, fetch data stored on nodes, and perform various other operations, all while benefiting from the scalability and efficiency of ZK rollups.

In other words, developers can build custom applications, wallets, NFT, and DeFi solutions that interact with Zero-Knowledge EVM networks via these APIs.

The main advantage of using APIs is their remote accessibility. This allows developers to use solutions offered by node provider services instead of setting up and maintaining local infrastructure.

Why use zkEVM API?

It's advantageous for developers to utilize node provider APIs over setting up their local nodes for several reasons:

1. Cost Savings: Leveraging local nodes can be resource-intensive and costly, requiring hardware, software, and ongoing maintenance expenses. APIs offer a cost-effective alternative, as developers can access blockchain data and functionality without investing in their infrastructure;
2. Reliability and Uptime: Node services specialize in operating and maintaining nodes on ZK networks, ensuring high reliability and uptime so that developers can rely on the provider's infrastructure and expertise, minimizing the risk of downtime and ensuring consistent access to blockchain data and functionality;
3. Scalability: Developers can scale their applications seamlessly without the need to upgrade or expand their local node setup since infrastructure providers typically offer scalable infrastructure that can handle growing application usage;
4. Focus on Development: By offloading node management to a dedicated provider, developers can focus their time and resources on application development and innovation, relying on a team of experts to handle infrastructure operations, updates, and maintenance.

Overall, node provider APIs offer developers a convenient, reliable, and cost-effective way to interact with zkEVM networks. While setting up local nodes may be suitable for certain use cases, node providers provide a hassle-free alternative.

Key Features of zkEVM API

APIs unlock access to a diverse range of essential features necessary for the development and deployment of blockchain-based applications.

Here's the summary of key operations accessible via APIs:

Key Features Description Example Use Cases
Real-time blockchain data Facilitates real-time synchronization with the latest blockchain state, enabling direct retrieval of transaction/account details, block/network statistics Blockchain explorers, Real-time analytics, Trading platforms
Wallet management Includes functionalities like generating new addresses, checking balances, sending and receiving funds, and handling transaction history Payment gateways, Exchange platforms
Transaction processing Facilitates transaction creation, signing, fee estimation, and broadcasting for network confirmation DeFi platforms, Wallet applications
Address validation Helps verify address validity to ensure compliance with blockchain network standards before transaction processing Web3 wallets, Exchanges, Payment platforms

These functionalities are essential for implementing different features within decentralized applications.

How to Get Started with zkEVM API

This tutorial will help new users begin using the GetBlock platform. It provides clear steps and helpful tips to make navigating the platform easier and execute their first interaction with zkEVM networks.

Creating an account

To get started with GetBlock, visit the website and complete the account registration process. Users have the option to connect quickly using a MetaMask wallet or sign up with an email.

After registration, clients can already start using the service with the free package that grants 40,000 requests per day with a rate limit of 60 RPS.

Generating access tokens

From the account, in the "My Endpoints" section, find the dropdown list and select the desired network (e.g., Polygon zkEVM). After selecting the network and one of the available API interfaces, click on "Get".

GetBlock_Polygon_zkEVM_endpoints

GetBlock will generate a short link in the following format:

https://go.getblock.io/ACCESS_TOKEN

An access token serves as a secure method for accessing the platform's services. Users can easily manage unused or leaked tokens, which offers improved control compared to using traditional API keys for authentication.

Integrating APIs

To verify that the API connection is functioning correctly, let's execute a simple request using the generated URL and "eth_chainId" method:


curl --location --request POST 'https://go.getblock.io/’ \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_chainId",
    "params": [],
    "id": "getblock.io"
}'

The response confirms that the GetBlock API is successfully retrieving data from the Polygon zkEVM:


{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": "0x44d"
}

Feel free to explore further and experiment with additional methods and functionalities.

Available zkEVM API Methods

Developers familiar with Ethereum's APIs can easily adapt to zkEVM networks without the need to learn new methods or conventions. To give an example, let's describe some key JSON-RPC methods:

  • eth_getBalance: query the balance of a specified address at a specific block height or the latest block;
  • eth_getBlockByHash: returns details about that block with additional data specific to the Layer-2 environment;
  • eth_sendRawTransaction: used to send transactions with custom parameters to the network;
  • eth_getLogs: retrieves logs emitted by smart contracts deployed on rollup networks;
  • eth_subscribe: sends real-time notifications whenever specified events occur;

Pricing and Plans for zkEVM API

Clients of GetBlock have the flexibility to choose the plan or package that suits their requirements, financial considerations, and future scalability goals.

Shared nodes service is a popular and cost-effective option, featuring:

  • from $0 per month with a free package available;
  • packages up to 100M requests;
  • monthly subscription at higher rates and no limits on the total number of requests.

Flexible pricing

Shared nodes

START

Popular

$ 29 / month

Get started

5 000 000

Requests per month

200

Requests per second

5m
10m
50m
100m

Shared nodes

UNLIMITED

Best choice

$ 499 / month

Get started

Unlimited

Requests per day

300

Requests per second

Unlimited Requests

This option is ideal for individual use, testing applications, or even small-scale projects.

Dedicated zkEVM API

​​As your needs grow beyond the capacities of shared nodes, GetBlock also offers dedicated servers. Transitioning to this plan brings several advantages:

  • 99.99% uptime and uninterrupted access;
  • no restrictions on the number and frequency of requests;
  • access to historical blockchain data with archive mode enabled;
    customizable settings.

DEDICATED NODE

Private server with custom settings

Requests

Unlimited

Rate Limit

Unlimited

Data

Archive

Starting at

$

600

/ month

Start building arrow up
bg

With this option, users have exclusive access to resources, ensuring consistent performance and reliability for their applications.

Enterprise zkEVM solutions

GetBlock’s enterprise services offer unmatched reliability, flexibility, and support for businesses and Web3 projects.

With a dedicated support team ensuring timely assistance, advanced statistics, and traffic distribution across multiple nodes, this plan delivers heightened reliability and capacity, enabling seamless handling of any traffic.

GetBlock_Enterprise_Plan

As clients’ needs evolve and new protocols emerge, GetBlock can accommodate by deploying the necessary nodes to align with the client's expansion plans.

FAQ

  • What is zkEVM API used for?

    plus
  • How can I integrate zkEVM API into my web application?

    plus
  • Is there a rate limit for zkEVM API requests?

    plus
  • How secure is the zkEVM API?

    plus
Vance Wood

Vance Wood

May 1, 2024

6 min read

twittertwittertelegramtelegramLinkedinLinkedin