All Projects → Moesif → moesif-ethereum-js-example

Moesif / moesif-ethereum-js-example

Licence: other
An example of a Dapp built on web3js/ethereum and using Moesif to monitor JSON-RPC calls.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects
solidity
1140 projects

Projects that are alternatives of or similar to moesif-ethereum-js-example

Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions.
Stars: ✭ 237 (+540.54%)
Mutual labels:  dapp, json-rpc
web3
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.
Stars: ✭ 609 (+1545.95%)
Mutual labels:  dapp, json-rpc
DAOcreator
dApp for creating and interacting with DAOs
Stars: ✭ 34 (-8.11%)
Mutual labels:  dapp
connex
The mono-repo contains libraries to help build dApps for VeChain.
Stars: ✭ 53 (+43.24%)
Mutual labels:  dapp
open-api
api.openfuture.io
Stars: ✭ 41 (+10.81%)
Mutual labels:  dapp
tasit-sdk
A JavaScript / TypeScript SDK for making native mobile Ethereum dapps using React Native
Stars: ✭ 93 (+151.35%)
Mutual labels:  dapp
eos-blog-dapp
Simple Blog DApp built with React for the EOSIO Blockchain
Stars: ✭ 21 (-43.24%)
Mutual labels:  dapp
instant api
Instantly create an HTTP API with automatic type conversions, JSON RPC, and a Swagger UI. Just add methods!
Stars: ✭ 115 (+210.81%)
Mutual labels:  json-rpc
Astar
The dApp hub for blockchains of the future
Stars: ✭ 533 (+1340.54%)
Mutual labels:  dapp
escrow-eth
Escrow contract
Stars: ✭ 41 (+10.81%)
Mutual labels:  dapp
ethereum-playbook
CLI tool that configures and deploys Ethereum DApp infrastructures using a static specification. 📚📖
Stars: ✭ 20 (-45.95%)
Mutual labels:  dapp
lsxc
Compile Livescript + Pug + React + SASS as a single component
Stars: ✭ 17 (-54.05%)
Mutual labels:  dapp
assist
Blocknative Assist widget for blockchain usability
Stars: ✭ 54 (+45.95%)
Mutual labels:  dapp
eth-sdk
Type-safe, lightweight SDKs for Ethereum smart contracts
Stars: ✭ 283 (+664.86%)
Mutual labels:  dapp
contracts
Contracts for FundRequest (platform, token, crowdsale)
Stars: ✭ 56 (+51.35%)
Mutual labels:  dapp
univereum
ÐAPP for electronic voting in universities
Stars: ✭ 11 (-70.27%)
Mutual labels:  dapp
lens
The official network explorer for Wavelet.
Stars: ✭ 28 (-24.32%)
Mutual labels:  dapp
workshop-todo-dapp
A workshop into adding realtime collaboration in a typical To-do app
Stars: ✭ 29 (-21.62%)
Mutual labels:  dapp
juice-interface
🧃 An app for using the JBX protocol.
Stars: ✭ 132 (+256.76%)
Mutual labels:  dapp
aragon-desktop
(Aragon 1) Managing an decentralized organization on a desktop near you
Stars: ✭ 37 (+0%)
Mutual labels:  dapp

Moesif For Dapp Example

Purpose of this repo is to illustrate an example how a DAPP built on web3js/ethereum can integrate Moesif for Web3 monitoring and analytics.

Background on Dapps

When you create your own Dapp, the key dependency is the web3.js official library from Ethereum org. Web3js allows your Dapp to interact with the ethereum network (and the smart contracts deployed on it) using JSON-RPC. In our example, we use Truffle framework, which is set of tools for streamline some of the process and generate boilerplate code.

Background on Moesif

Moesif is the leading API analytics and monitoring platform, for Restful APIs, GraphQL, and now JSON-RPC/Ethereum.

For Dapps (distributed Apps) that are built on top of Ethereum, it is impossible to monitor the servers, as there is no servers. To understand how the Dapp APIs are used, where the errors are, it becomes even more difficult.

Moesif is the perfect solution for giving you insight for the Dapp that you could get in traditional server based applications.

How we created this example

This repo is based on the Truffle Framework, and one of the standard starting kits: Truffle React Box. Although Moesif integration itself do not depend on React.

We followed these steps to create this example:

  • npm install -g truffle
  • truffle unbox react
  • Created a basic Dapp, something more interactive than the one out of the box.
    • We added a form and a button to set the storage value using the minimalistic "storage" smart contract included in the Truffle React Box.
    • This additional code is in src/App.js.
  • Install Moesif using standard Browser integration.
    • Leverages the moesif-browser-js library.
    • In index.html under /public, we added the following code snippet, between the head tags.
    <script src="https://github.com//unpkg.com/[email protected]/moesif.min.js"></script>
    <script type="text/javascript">
    var options = {
      applicationId: 'Your application id'
      // add other option here.
    };

    // for options see below.
    moesif.init(options);

    // this starts the capturing of the data.
    moesif.start();
    </script>

To run this example

  • Fork or download this repo.
  • Get a Moesif account by sign up, and obtain an Application Id.
  • Edit the index.html file in /public, and replace Your application id with your actual application id.
  • If you haven't already, install truffle by: npm install -g truffle
  • Install dependencies for this repo: npm install
  • Start the truffle development environment: truffle develop
  • Compile the smart contracts: type in compile in the truffle develop command line prompt.
  • Deploy the smart contracts: type in migrate in the truffle develop command line prompt. (or type in migrate --reset if you want do migration before and what to refresh).
  • Start the Dapp: in another terminal, run npm run start.

Now, you can type go to: http://localhost:3000/, and interact with the Dapp. As you interact with the Dapp, all the JSON-RPC calls will be captured in your Moesif account.

Moesif Application Id

Your Moesif Application Id can be found in the Moesif Portal. After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps.

You can always find your Moesif Application Id at any time by logging into the Moesif Portal, click on the top right menu, and then clicking Installation.

Note for Metamask or use another Network.

First of all, please disable Metamask if you want this example to work out of the box. If you need to use meta mask, you have to do few things.

  • Decide on which network that you want your Metamask to connect to.
  • Take a look at truffle-config.js, and copy that over to truffle.js, and add the correct settings for the the network you plan to use.
  • Make sure you compile and migrate your contracts to the correct network you are using.
  • On the UI side, if you are using Metamask or something, make sure it is also connected to the same network.
  • Metamask intercepts every transaction and requires user to explicit first. Sometimes the popup prompt is hidden, so be sure click on the Metamask popup and accept the prompt.

Summary

For any Dapp build on top of Ethereum and JSON-RPC using web3.js, it is very simple to install Moesif API analytics and monitoring. The process is the same as for any normal browser based app. Moesif automatically detects they are JSON-RPC calls and apply same level of intelligent monitoring and deep insights that we already do for other APIs such as REST or GraphQl.

More info

Please check the tutorial blog post related to this repo.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].