Ethereum Web3 API support

DApp Introduction

Decentralized Applications (or DApps) are applications that do not rely on a centralized backend running in AWS or Azure that power traditional web and mobile applications (outside of hosting the frontend code itself). Instead, the application interacts directly with a blockchain which can be thought of distributed cluster of nodes analogous to applications interacting directly with a “masterless” cluster of Cassandra nodes with full replication on every peer in an untrusted peer-to-peer network.

These blockchain nodes do not require a leader which would defeat the purpose of being truly decentralized. Unlike leader election in various consensus protocols like Raft and Paxos, blockchain transactions are sent to and processed by “random” nodes via Proof of Work or Proof of Stake. These nodes are untrusted nodes running in an arbitrary sized network on various compute devices around the world.

DApps are the frontend apps which interact with these blockchain over an API. For Ethereum, this API is a JSON-RPC layer called the Ethereum Web3 API which Moesif supports natively.

Integration With Moesif

Moesif will grab your Web3 API calls so you can monitor your Ethereum DApp for any potential errors or performance issues when interacting with the blockchain.

Since you cannot directly add monitoring agents to Ethereum nodes, you will be using one of Moesif’s client side integrations. These SDKs automatically track outgoing API calls from the client side.

If your building a browser based DApp (i.e using Web3.js) follow the integration guide for moesif-browser-js SDK

An example Ethereum DApp with Moesif integrated is available here.

JSON-RPC Events

Moesif will automatically detect Ethereum Web3 API /JSON-RPC requests, so that relevant fields will be shown such as the RPC method name and respective parameters.

example of JSON-RPC call with additional data

Filters and segmentation

You can filter and segment on any of the RPC parameters including the method name, the input parameters, error code, and more. This way, you can drill into the performance or error rate for a specific RPC method.

example of extracted filter fields for JSON-RPC

Field Names

If Moesif detects a JSON-RPC/Ethereum Web3 API, Moesif will parse your RPC call so that you can filter and segment your API data on the RPC fields such as the RPC method or params. These field are under under the jsonrpc child object just like HTTP headers are under the request.headers child object.

Field Description
jsonrpc.request.method method name of the RPC call such as eth_getTransactionCount()
jsonrpc.request.params list of params passed into the RPC call. Since Ethereum Web3 passes params as a ordered array, Moesif prepends the method name to add context to the array index. Meaning eth_getTransactionCount__1 and eth_getTransactionCount__2 would correspond to the first and second params for the eth_getTransactionCount method.
request.jsonrpc version of the JSON-RPC protocol such as 2.0
response.jsonrpc version of the JSON-RPC protocol such as 2.0
request.id identifier established by the Web3 client
response.id Should match the request id
response.error.code The JSON-RPC error code such as -32601 (Method Not Found)

Review the Web3 JSON-RPC API Reference for the full list of possible Web3 methods and their params.

Alerting on errors

Moesif will also support triaging and aggregating metrics on specific RPC method names so you don’t just have a single bucket under the route POST /.

Updated: