Chainstack, Infura, BlockCypher, Alethio: How Do They Match Up?

As the Ethereum ecosystem grows and the number of smart contract developers increases, a new business opportunity has appeared.

Smart contracts are pieces of code that live on the blockchain. The deployment of a smart contract first involves a developer sending the smart contract to a node along with a small amount of gas, which will then include the smart contract into the mempool. As miners mine more blocks, smart contracts with a high enough gas included as a fee will eventually be included in a new block. Thus, a new smart contract is born on the blockchain.

To interact with a smart contract, requests have to be made to a node, and a similar process of including the request in a mempool is done by the node.

Thus, nodes represent a link between the outside world and the Ethereum Virtual Machine, and it’s no surprise that many enterprises have made progress into contributing and monetising this sector of blockchain deployment.

Chainstack, Infura, BlockCypher, Alethio, and now Cloudflare

More and more companies are joining and offering Blockchain-as-a-Service (BaaS). The right BaaS allows small businesses and even enterprises to quickly deploy smart contracts, and then provide a highly resilient, low latency API that is not limited as more users interact with DApps.

These businesses can be split into three types:

  1. Managed Node Provider (Chainstack)
  2. Ethereum Gateways (Infura, BlockCypher, Cloudflare)
  3. Ethereum Analytics (Alethio)

Managed Node Providers & Ethereum Gateways are very similar. Both allow you to deploy smart contracts via a node or interface. Ethereum Analytics such as Alethio is mostly used to pull statistical data that is happening on the Ethereum blockchain; thus you cannot deploy or interact with smart contracts by connecting to the Alethio API.

Function calls & latency

We will test for a set of function calls to these Ethereum providers and then measure the latency. 

The sender & contracts for these calls will be at the addresses below for the Ropsten testnet :

contractAddress = '0xBbE54fADCCf0037d7ca7573a4238a4637ba26b98'

senderAddress = '0xC836Fef5464cDFAec026111aF8E504FEaEC40dff'

For all load tests, I will be using Artillery and run a test script. Every second, 50 users will be making a request to the API endpoints, for a total of 10 seconds.

These requests will be made from my local machine. One of the capabilities of using Chainstack is that we can choose the location of our nodes. I’ve chosen my nodes to be located in Asia-Pacific (Singapore) which is where I’m located at. You’ll see the big difference in performance just by changing geographical locations in the next section.

Get Account Balance

Get Transaction Count

Contract Deployment

The benefits of having nodes located nearby to your development team is crucial. Companies like Infura & BlockCypher do not allow developers to choose the location of their nodes resulting in high latency when making function calls to the Ethereum node.

Chainstack allows developers to choose the location of their nodes, ensuring low latency during development. On top of that, Chainstack is cloud-agnostic, we currently provide support for Google Cloud Platform and Amazon Web Services with many more cloud solutions planned in our development pipeline.

Namespaces

Ethereum nodes represent the point of contact between developers and the blockchain. Ethereum has a JSON-RPC API that allows developers to interact with smart contracts that live on the blockchain. Let’s take a look at how we can deploy a simple contract, Hello.sol

pragma solidity 0.5.0;
contract Hello {
  constructor() public {}
  function getHello() external view returns(string memory){
      return 'Hello World';
  }
}

Let’s send this to an Ethereum node via the JSON-RPC API. We’ll have to create a params object with the contractBytecode in as the data parameter:

params: [{
  "from": "FROM_ADDRESS",
  "to": "TO_ADDRESS",
  "gas": "0x76c0", // 30400
  "gasPrice": "0x9184e72a000", // 10000000000000
  "value": "0x9184e72a", // 2441406250
  "data": contractBytecode
}]

Let’s then make a request to our Ethereum node:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{see above}],"id":1}'

Alternatively, all this can be abstracted using Web3:

const contract = await new web3.eth.Contract(abi)
    contract.deploy({
      data:bytecode
    }).send({
      from:account.address,
      gas:450000,
      gasPrice:100,
    }).then((result) => {
      console.log(result)
    })

If you try to use the code snippet above while using Infura and the Web3 provider, the transaction will be rejected by the node.

This is because at the end of the day, Web3 is merely a JSON-RPC library, and it is dependent on the namespaces that are exposed by the node. 

For example, .send() is actually wrapping around the “eth_sendTransaction” RPC method, which is not exposed by Infura as per the documentation. Instead, transactions have to be sent using “eth_sendRawTransaction”. 

Web3 offers a valuable layer of abstraction in making things simpler, and Infura just removed it.

API Gateways

The reason why Web3 does not work well with many of these BaaS is because a middle-layer API gateway, is implemented to prevent users from direct access to the Ethereum node.

This API Gateway serves many purposes:

  1. Allows BaaS companies to track and monitor usage
  2. Expose only certain functions for safety
  3. Implement rate-limiting to prevent abuse

Enterprise DApps cannot rely on many of these BaaS companies as the rate limits imposed will prevent future scalability.

API gateways are also inconsistent.

DApps built with Infura in mind will have to be modified before they can be used for BlockCypher. 

By allowing direct access to an Ethereum node, Chainstack allows DApps to work as intended.

Centralisation

Many Blockchain-as-a-Service platforms almost exclusively host on AWS. This represents a single point of failure should AWS decide to prevent the hosting of nodes on their servers. Chainstack is cloud-agnostic, ensuring that the decentralised Ethereum network is not reliant on centralised companies.

We don’t run just on AWS as well. We’ve chosen a compromise between centralisation and convenience. Chainstack lets users choose from GCP as well, with future support for Microsoft Azure. 

Shared vs dedicated nodes

Technically, shared nodes are the same as dedicated nodes except that multiple developers are using this node at the same time. 

Dedicated nodes offer higher performance compared to shared nodes because access to these nodes is held exclusively by you. 

Shared nodes are sufficient if they are for hobbyist projects for the independent developer.

Enterprise DApps, however, should not be using shared nodes because data can be intercepted and modified by other participants. It requires you to trust that the shared node is not being attacked by other participants.

Chainstack offers both shared & dedicated nodes. We’re targeting all spectrums of DApp developers, ranging from hobbyists to enterprise users. This means that the shared node option has to exist as we recognise that a dedicated node is simply too excessive for the hobbyist. 

Say hello to Chainstack

Chainstack is a UI-driven platform, making node deployment an enjoyable and stress free experience. 

Chainstack provides direct access to your own node, and this means that you’ll never get rate limited. Make as many calls via HTTPS/Websockets as you wish.

Our nodes will always use the latest, most stable Ethereum client and we will handle all future upgrades, so you don’t have to. We also fully support Geth’s PUB/SUB allowing your applications to watch for events being fired on the blockchain.

Bolt — our proprietary node spin-up technology allows our nodes to be created in just under 5 minutes from scratch. This makes it extremely trivial to deploy and delete nodes on the fly, making Chainstack the perfect solution to prototype & experiment on.

Being cloud-agnostic also allows us to quickly deploy nodes in your location of choice, be it in Asia, America or Europe with GCP or AWS allowing redundancy for developers.

We offer a free 14-day trial over at the console, so do give us a try!

Introducing Corda Managed Service on Chainstack

It is only recently that the word “consortium” has become fashionable again. Often driven by the perception that many enterprises are not willing to collaborate, doubts exist that this both-old-yet-new type of organization stands to offer any value. Technical and…

Chainstack
Chainstack
Oct 23

Perspectives with Paul Sitoh – part 1

We sat down with Paul Sitoh virtually, with him in London and us in Singapore. Paul has extensive experience working on blockchain and cloud technologies…In this inaugural two-part interview as part of Chainstack’s Perspectives series on our blog, we discuss his journey into the world of the blockchain…

Chainstack
Chainstack
Dec 21
Chainstack uses cookies to provide you with a secure and
personalized experience on its website. Learn more.