June 14, 2024

zkSync Era RPC Nodes – How to Set Up a zkSync Node for Free

Table of Contents

If you’re looking for the best and easiest way to set up a zkSync Era node, then you’ve come to the right place. In today’s guide, we’ll introduce you to Moralis, the industry’s premier node provider. With our point-and-click interface, you can now set up zkSync Era RPC nodes without breaking a sweat. Eager to learn how it works? Check out our brief summary of the process below:

  • Step 1: Register a free account with Moralis.
  • Step 2: Log in, go to the “Nodes” tab on the left of the admin panel, click “+ Create Node”, and configure your node:
Red arrows pointing at the "Nodes" tab and "+ Create Node" button on the Moralis admin panel.
  • Step 3: Copy and integrate one of your zkSync Era node URLs into your dapp to interact with the network:
Red arrows pointing at the copy button for zkSync Era RPC nodes.

That’s it! Running zkSync nodes is a breeze when leveraging Moralis. However, if you want a more in-depth breakdown of the steps above, deeper insight into the zkSync Era network, and a tutorial on how to call your nodes, join us in this guide as we lay it all out for you!

Ready to set up your own zkSync node? Don’t forget to sign up with Moralis. You can register an account for free and get instant access to our nodes and other premier development tools!

Overview 

If you’re considering setting up a zkSync Era RPC node from scratch, you might want to reconsider. Running zkSync RPC nodes typically demands a complex and robust infrastructure, requiring substantial storage capacity, high bandwidth, and significant computational power. This makes the setup both expensive and time-consuming. Fortunately, this is where node providers like Moralis take the stage!

Moralis logo.

At Moralis, we handle all the underlying complexities for you. In return, you can use our straightforward user interface to set up RPC nodes for 30+ chains with the click of a button. Curious to learn more? Join us in this guide as we explore the process of running zkSync RPC nodes with Moralis. Let’s dive in!

What is zkSync Era?

zkSync Era, launched in 2020, is a layer-2 (L2) scaling solution for the Ethereum network. Utilizing zero-knowledge (ZK) rollup technology, zkSync facilitates scalable and low-cost transactions on the Ethereum blockchain. As a result, zkSync Era enhances the Ethereum experience, making it a scalable and economically viable alternative for developers and end users alike.

Blockchain illustration with text: "What is zkSync Era?"

zkSync Era is designed to look and feel like a supercharged version of Ethereum but with higher throughput and lower fees. Just like on Ethereum, smart contracts are written in Solidity/Vyper and can be called with the same clients as in other EVM-compatible chains. This makes it easy for developers to build on zkSync Era using tools and frameworks with which they are familiar.

Founded in 2018 by Alex Gluchowski, Matter Labs—the organization behind zkSync Era—comprises a team of engineers, technical experts, and researchers dedicated to pushing the boundaries of blockchain scalability using advanced ZK cryptography. They advocate that ZK technology is the key to the mainstream adoption of public blockchains.

But what exactly is ZK rollup technology, and how does the zkSync Era network operate?

How Does zkSync Era Work?

zkSync Era operates as a ZK rollup, which processes computations off-chain and frequently aggregates multiple transactions into batches. For each batch, a validity proof—known as a zero-knowledge proof—is generated to ensure that the transactions within the batch are valid. This proof is then submitted to Ethereum for verification, which finalizes the rollup batch.

Blockchain illustration for how zkSync Era works.

As such, zkSync Era essentially submits multiple transactions in batches instead of sending each one to the L1 network individually. This method significantly reduces the load on the Ethereum network, allowing zkSync Era to deliver much higher throughput and considerably lower fees compared to the Ethereum mainnet.

What are the Benefits of Building on zkSync Era?

There are many benefits to building dapps on zkSync Era. Below, we have outlined four key examples:

  • Hyper Scalability: zkSync Era is designed to be highly scalable, where unlimited transactions meet high security and affordability.
  • Security & Trustlessness: As an L2 scaling solution powered by ZK rollups, zkSync Era inherits 100% of Ethereum’s security. Moreover, the Matter Labs team is committed to making the network the most secure L2 available.
  • Intuitive Experience: zkSync Era prioritizes a user-friendly experience and self-custody, which they believe to be fundamental in helping onboard the first billion users to Web3.
  • EVM Compatibility: zkSync Era is EVM-compatible, supporting common Ethereum tools, frameworks, and programming languages, giving developers a seamless onboarding experience.

Exploring zkSync Era’s Ecosystem 

zkSync Era boasts a vibrant ecosystem with over 200 projects. Here are a few notable dapps built on the chain:

  • SyncSwap: SyncSwap is a decentralized exchange (DEX) on zkSync Era. It facilitates the exchange of ERC-20 tokens and aims to provide a seamless and user-friendly one-stop shop for decentralized finance (DeFi).
  • PancakeSwap: PancakeSwap is a decentralized trading platform deployed on multiple chains, including zkSync Era. It operates on an automated market maker (AMM) system, allowing users to swap tokens without the need for intermediaries.
  • Rarible: Rarible is a marketplace for non-fungible tokens (NFTs). It enables users to sell, buy, and mint NFTs.
Blockchain illustration with zkSync Era dapp examples.

Want to explore the ecosystem further? Check out other zkSync dapps on Moralis’ Web3 Wiki!

What are zkSync Era RPC Nodes?

zkSync RPC nodes are computers, servers, and other devices that participate in the network by performing a range of essential activities. Some prominent examples include sending transactions, storing data, and much more. The network consists of many nodes that together maintain its security and integrity.

zkSync Era RPC nodes chained together.

Here are some examples of use cases for zkSync RPC nodes:

  • Transaction Execution: zkSync RPC nodes execute transactions received from the synchronization layer, which is crucial for the network’s operation.
  • Data Storage: Nodes store transaction and smart contract data. This function is essential for maintaining the network’s integrity and security, allowing users to validate transactions.
  • Web3 Development: zkSync RPC nodes serve as gateways to the blockchain network, enabling developers to read and write on-chain data. This makes them indispensable for building dapps.

This overview explains the importance and functionality of zkSync RPC nodes. In the next section, we will show you how to run one using Moralis!

Introducing Moralis – Web3’s #1 Node Provider 

Moralis is the industry’s leading infrastructure provider, giving you seamless access to nodes for 30+ chains, including zkSync Era, Ethereum, Polygon zkEVM, and many more. And with our intuitive user interface, you can effortlessly set up nodes at the click of a button! 

zkSync Era logo with text: "Free RPC Nodes for zkSync"

But what makes our nodes unique?

  • Speed: Our RPC nodes set the standard for rapid response times, reaching as low as 70 ms. Use Moralis to get the data you need without any delay.
  • Reliability: Moralis’ node infrastructure is built to meet the highest reliability standards, offering 99.9% uptime. Build your dapps on a stable infrastructure, so you don’t have to worry about downtime.
  • Security: Don’t risk your company’s data. Choose Moralis, the only SOC 2 Type 2 certified Web3 infrastructure provider.

This overview highlights the advantages of Moralis’ node service. In the next section, we’ll guide you through the process of setting up zkSync RPC nodes!

Easiest Way to Set Up a zkSync Era Node 

If you don’t already have an account, the first thing you’ll need to do is sign up with Moralis. You can do so by hitting the “Start for Free” button at the top:

Arrow pointing at "Start for Free" button on Moralis' website.

With an account in hand, you can then follow the steps below to set up a zkSync Era node:

  • Step 1: Log in to Moralis, click the “Nodes” tab on the left side of the admin panel, and hit “+ Create Node”:
Red arrows pointing at the "Nodes" tab and "+ Create Node" button on the Moralis admin panel.
  • Step 2: Select “zkSync”, followed by “Mainnet”, and click the blue “Create Node” button:
Red arrows pointing at "zkSync", "Mainnet", and "Create Node" button when configuring zkSync Era RPC nodes.
  • Step 3: Copy and integrate one of the URLs for your zkSync RPC nodes into your project to interact with the chain:
Red arrows pointing at the copy button for zkSync Era RPC nodes.

Congratulations! You now know how to set up a zkSync node for free using Moralis!

How to Call zkSync Era RPC Nodes 

Now that you know how to set up zkSync Era RPC nodes with Moralis, we’ll show you how to use them in practice. Specifically, we’ll demonstrate how to query a wallet’s native balance with Ethers.js!

Before you get started with the tutorial, ensure you have the following ready:

  • Node.js v14+
  • npm/yarn

From here, follow the steps below to call your zkSync RPC nodes:

  • Step 1: Open an IDE like Visual Studio Code, create a folder, launch a new terminal, and initialize a project with the command below:
npm init
  • Step 2: Install Ethers.js with the following terminal command:
npm install ethers
  • Step 3: Open your “package.json” file and add "type": "module" to the list:
"type": "module" highlighted in code editor.
  • Step 4: Create a new “index.js” file and add the following code:
import { ethers } from "ethers";

const provider = new ethers.providers.JsonRpcProvider("YOUR_NODE_URL");

const address = "0x490132355cB7a7273238E6fe87A0cC31751e816e";

const balance = await provider.getBalance(address);
console.log("Balance: ", ethers.utils.formatEther(balance));

Next, replace YOUR_NODE_URL with one of your zkSync RPC node URLs and configure the address parameter to fit your query:

Red arrows pointing at YOUR_NODE_URL and the address parameter in code editor.
  • Step 5: Execute the script with the following terminal command:
node index.js

That’s it! In return for calling the code, you’ll get the native balance of the specified address. Here’s an example of what it might look like:

Balance:  0.002508746961522487

For a more detailed tutorial of the steps above, with more examples of the type of data you can fetch using your zkSync RPC nodes, please check out the Moralis YouTube video below:

Beyond zkSync RPC Nodes – Diving Into Moralis 

While it’s perfectly viable to use zkSync Era RPC nodes to fetch on-chain data, it’s not the most efficient method. Querying blockchain data through a node can be complex and time-consuming. For example, to find out what tokens a particular wallet holds, you would need to make multiple requests and compile a significant amount of data manually.

Furthermore, nodes will provide you with raw blockchain data. As such, before it becomes valuable, it needs to be processed, which typically involves decoding, interpreting, and formatting the information. Fortunately, Moralis Web3 APIs now offer a streamlined solution to these challenges.

With Moralis’ Web3 APIs, you can query indexed and decoded blockchain data using just a single line of code. In our suite of interfaces, you’ll find 10+ use case-specific APIs, including the Wallet API, Token API, Streams API, and many more. As such, whether you’re building a Web3 wallet, DEX, portfolio tracker, or any other project, we have your data needs covered!

Moralis logo.

But what makes our APIs stand out in the market?

  • Comprehensive: Moralis provides the industry’s most comprehensive APIs, giving you more data with fewer calls. This enables you to build dapps faster and more efficiently.
  • Cross-Chain: Our APIs are truly cross-chain compatible, allowing you to seamlessly query on-chain data from 30+ chains. As such, with Moralis, you can streamline your developer experience with a single API provider for all networks.
  • Secure: Experience enterprise-grade data security with the only SOC 2 Type 2 certified Web3 data provider.
Table showing Moralis as the only SOC 2 Type 2 certified infra provider.

If you’d like to build faster and more efficiently, check out our Web3 API page, where you can explore all our premier interfaces!

Summary: How to Run zkSync Era RPC Nodes for Free

Setting up a zkSync RPC node from scratch demands significant bandwidth, computational power, and storage capacity. Consequently, running zkSync RPC nodes on your own is often expensive and time-consuming. However, you can now simplify this process with a node provider like Moralis!

At Moralis, we manage all the underlying complexities of running blockchain nodes for you. This allows you to set up zkSync Era RPC nodes effortlessly through our user-friendly interface with just a few clicks. Here’s a quick overview of the process:

  • Step 1: Sign up with Moralis.
  • Step 2: Log in and navigate to the “Nodes” tab. Click the “+ Create Node” button and configure your zkSync node:
Red arrows pointing at the "Nodes" tab and "+ Create Node" button on the Moralis admin panel.
  • Step 3: Copy and integrate your zkSync Era node URL into your dapp:
Red arrows pointing at the copy button for zkSync Era RPC nodes.

Congratulations! You now know how to successfully set up a zkSync Era RPC node with Moralis!

For other similar guides, check out our other node tutorials:

Ready to set up your own zkSync Era node? Sign up with Moralis for free to gain immediate access to our node service and a suite of industry-leading development tools.

Moralis Money
Stay ahead of the markets with real-time, on-chain data insights. Inform your trades with true market alpha!
Moralis Money
Related Articles
January 4, 2024

Starknet Faucet – How to Get Testnet Funds for Starknet

October 17, 2023

How to Monitor All ETH Transfer Transactions

January 8, 2024

Best Crypto Portfolio Tracker in 2024 – Full List

February 24, 2023

Full Guide: How to Get Blockchain Data

December 18, 2023

How to Watch On-Chain Transactions – Monitor Crypto Transactions and Events

November 22, 2022

Creating a Lambda Function – Learn How to Create an AWS Lambda Function

January 18, 2023

Supabase Authentication – How to Authenticate Users on Supabase

November 15, 2022

Get Wallet Balance – How to Get Wallets Native Crypto Balance