Paving the Way for a Multi-Chain Future, Infura Now Supports NEAR Protocol

Discover the benefits of building on NEAR, the first non-EVM chain to be added to the Infura network, and simple steps to creating your first project today.

Paving the Way for a Multi-Chain Future, Infura Now Supports NEAR Protocol

Discover the benefits of building on NEAR, the first non-EVM chain to be added to the Infura network, and simple steps to creating your first project today.

We are thrilled to announce Infura has successfully integrated with NEAR, a carbon neutral Proof of Stake layer-one blockchain that is also infinitely scalable with sharding. Infura is excited to offer developers more choice and improve their building experience through this integration. This partnership means the NEAR community now has access to the more than 430,000 Infura developers already building and scaling the next generation of software in Web3.

The integration has been in private beta for two months during which time a group of developers were able to test the NEAR-Infura integration for a smooth roll out of its now wide release.

Adding NEAR marks Infura’s expansion beyond Ethereum Virtual Machine (EVM)-compatible chains and a strategic shift toward Infura becoming a key connector in a multi-chain ecosystem, while improving the overall developer experience.

If you’re already building with Infura, we encourage you to check out the NEAR network and ecosystem, and get started building. If you’re raring to go, you can scroll to the bottom of this post, for a quickstart tutorial by Cedric Magne. Otherwise, below are the key benefits and features of building on the protocol to determine how NEAR can fit into our developer journey, as well as the ecosystem at NEAR to join the community. Lastly, we cover the steps to create your first EVM-compatible project on NEAR.

The NEAR Ecosystem

The NEAR protocol was founded in 2018 by a former Microsoft employee, Alexander Skidanov and a developer, Ilya Polosukhin. Some of the world’s leading custody providers, wallets, applications, and blockchains are integrating with the NEAR network. As of May 2022, the NEAR network has over $900M in total value locked (TVL) and over $840M in bridged assets to Ethereum.

Web3 apps and protocols built on NEAR. Source: nearweek.com

Source: https://nearweek.com/newsletter/edition-58

Key Benefits of Building on the NEAR Network

By integrating with NEAR Network, Infura developers will have greater access to a carbon-neutral ecosystem with minimal environmental footprint. This is because NEAR operates on a unique sharded blockchain called Nightshade, which has limitless scaling capabilities allowing transaction-heavy decentralized applications to function effortlessly with low fees. Transactions are processed at 14 tps on Ethereum and 7 tps on Bitcoin. NEAR embodies similar characteristics as the Ethereum 2.0 roadmap, including PoS and shard chains.  Additionally, the partnership allows developers to build decentralized applications using popular programming languages such as Rust and AssemblyScript as well as provides developers access to superior learning resources.

Here are the core benefits of building on the NEAR network:

  1. Sustainable: NEAR’s efficient PoS network is certified as carbon-neutral.
  2. Cost-effective: 1000x lower transaction fees for users and developers earn 30% of transaction fees.
  3. Secure: A thriving ecosystem of validators maintains network integrity.
  4. Friendly: Human-readable account names follow a scoped DNS naming pattern.
  5. Harmonious: EVM and Rainbow Bridge were developed for interoperability among chains.
  6. Pragmatic: Contracts are written using expressive community-supported, general purpose languages: Rust and AssemblyScript.

Infura developers can access the NEAR Network now and continue to advance the multi-chain ecosystem, while onboarding more users to Web3. Next up is a short tutorial on how to create your first project on NEAR.

How to Create an EVM-Compatible Project on NEAR

If you don’t have an Infura account already check out our Infura quickstart guide!

Click CREATE NEW PROJECT

From the “Create New Project” pop-up:

  • Select Ethereum in the PRODUCT dropdown list.
  • Provide a name, then click CREATE

Your new project's settings page has all the information you need to connect to the network.

Use the NEAR Mainnet or NEAR Testnet endpoints to send JSON-RPC requests to the NEAR protocol or choose Aurora Mainnet or Aurora Testnet for an EVM-compatible developer experience on NEAR.

Never expose your project secret. It must never be human-readable in your application.  We suggest using a .env file

Make Requests

NEAR supports JSON-RPC methods to interact with the NEAR blockchain.  NEAR JSON-RPC calls are different from Ethereum JSON-RPC calls so choose Aurora if you prefer the EVM JSON-RPC methods.

Info: WebSocket calls are not currently supported when using the NEAR endpoints

Call a NEAR JSON-RPC method

Use HTTPS to call a JSON-RPC method. In this example we use curl to make the HTTPS request to obtain the gas price of the most recent block.

Ensure that you replace <YOUR-PROJECT-ID> with a project ID from your Infura dashboard

curl -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc": "2.0", "id": 1, "method": "gas_price", "params": [null]}' \"https://near-mainnet.infura.io/v3/<YOUR-PROJECT-ID>"

The result should look similar to the following:

{"jsonrpc":"2.0","result":{"gas_price":"100000000"},"id":1}

Choose a network

Use one of these endpoints as your NEAR client provider.

Ensure that you replace YOUR-PROJECT-ID with a project ID from your Infura dashboard

Network Description URL
NEAR Mainnet JSON-RPC over HTTPS https://near-mainnet.infura.io/v3/YOUR-PROJECT-ID
NEAR Testnet JSON-RPC over HTTPS https://near-testnet.infura.io/v3/YOUR-PROJECT-ID
Aurora Mainnet JSON-RPC over HTTPS https://aurora-mainnet.infura.io/v3/PROJECT-ID
Aurora Testnet JSON-RPC over HTTPS https://aurora-testnet.infura.io/v3/PROJECT-ID

Get NEAR tokens

Create an account on NEAR testnet with the NEAR testnet wallet and your account will automatically be topped up with the NEAR token.

JSON-RPC Methods

Refer to the NEAR API documentation for the list of JSON-RPC methods to interact with the NEAR blockchain.  On Aurora, you can use Ethereum JSON-RPC methods.

NEAR also provides a JavaScript library to help create decentralized applications on the NEAR platform. It works in conjunction with the RPC endpoints to help you connect your application to the NEAR blockchain.

Infura specifically supports the following NEAR JSON RPC methods:

query
block
chunk
gas_price
network_info
validators
broadcast_tx_async
broadcast_tx_commit
tx
EXPERIMENTAL_changes
EXPERIMENTAL_changes_in_block
EXPERIMENTAL_genesis_config
EXPERIMENTAL_protocol_config
EXPERIMENTAL_tx_status
EXPERIMENTAL_receipt

NEAR-API-JS Quick Reference

Install

npm i near-api-js

Import

const nearAPI = require("near-api-js");

Connect

const { connect } = nearAPI;

const config = {
  networkId: "mainnet",
  keyStore,
  nodeUrl: "https://near-mainnet.infura.io/v3/YOUR_PROJECT_ID",
  walletUrl: "https://wallet.mainnet.near.org",
  helperUrl: "https://helper.mainnet.near.org",
  explorerUrl: "https://explorer.mainnet.near.org",
};
const near = await connect(config);

Note: Key store is not required if you are not signing transactions (using view call methods on a contract)

See: https://docs.near.org/docs/api/naj-quick-reference

Keep Building

We are excited about this partnership and what it means for the Infura and NEAR developer communities. We will be publishing a series of educational content to ensure that builders have what they need to use NEAR and Infura, moving forward.

Please refer to NEAR and Infura documentation for assistance with building, today. You can learn more about the partnership at the upcoming Infura Community Call on Tuesday, May 31st by RSVPing here.