Skip to main content
In order for a web app to interact with Parallax (i.e. read blockchain data and/or send transactions to the network), it must connect to a Parallax node. For this purpose, every Parallax client implements the JSON-RPC specification, so there are a uniform set of methods that applications can rely on. If you want to use JavaScript to connect with a Parallax node, it’s possible to use vanilla JavaScript but several convenience libraries exist within the ecosystem that make this much easier. With these libraries, developers can write intuitive, one-line methods to initialize JSON RPC requests (under the hood) that interact with Parallax.

Prerequisites

As well as understanding JavaScript, it might be helpful to understand the Parallax stack and Parallax clients.

Why use a library?

These libraries abstract away much of the complexity of interacting directly with a Parallax node. They also provide utility functions (e.g. converting LAX to Gwei) so as a developer you can spend less time dealing with the intricacies of Parallax clients and more time focused on the unique functionality of your application.

Library features

Connect to Parallax nodes

Using providers, these libraries allow you to connect to Parallax and read its data, whether that’s over JSON-RPC or MetaMask. Ethers example
Web3js example
Once set up you’ll be able to query the blockchain for:
  • block numbers
  • gas estimates
  • smart contract events
  • network id
  • and more…

Wallet functionality

These libraries give you functionality to create wallets, manage keys and sign transactions. Here’s an example from Ethers
Read the full docs↗ Once set up you’ll be able to:
  • create accounts
  • send transactions
  • sign transactions
  • and more…

Interact with smart contract functions

JavaScript client libraries allow your application to call smart contract functions by reading the Application Binary Interface (ABI) of a compiled contract. The ABI essentially explains the contract’s functions in a JSON format and allows you to use it like a normal JavaScript object. So the following Solidity contract:
Would result in the following JSON:
This means you can:
  • Send a transaction to the smart contract and execute its method
  • Call to estimate the gas a method execution will take when executed in the PVM
  • Deploy a contract
  • And more…

Utility functions

Utility functions give you handy shortcuts that make building with Parallax a little easier. LAX values are in Wei by default. 1 LAX = 1,000,000,000,000,000,000 WEI – this means you’re dealing with a lot of numbers! web3.utils.toWei converts LAX to Wei for you. And in ethers it looks like this:

Available libraries

Web3.js

Ethers.js

The Graph

light.js

Web3-wrapper

Alchemyweb3

Alchemy NFT API

viem