A MITM cache between RPCs and a a dAPP. Useful to allow for better performance on a public RPC node

Overview

better-cosmos-rpcs

A cheaper way to allow for public RPCs as a service WITHOUT scaling issues. No need to rate limit either.


How it is done:

  1. User GET requests your hosted URL (This is the front end of this MITM interface)
  2. This program queries the real RPC, gets the return value, and caches it.
    • For static data (the initial RPC page), it is saved right to variable memory
    • For other more dynamic data, we use a Redis instance to cache it for the blocktime
    • Some queries such as the genesis file have much longer cache times than say, the current status.

3. The user gets back the response from the server quickly. (~10x in most cases) 4. It appends "was_cached" & the ms_time it took to get the query at the end of all JSON responses.

Reason:

  • If multiple people use the same endpoints, there will be less strain on the actual RPCs.
  • This should help RPC scaling for GET requests, hopefully reducing cost for both the users and the RPC providers.
  • Anyone can run it, rather than it being Nginx proxy based. By doing so any dAPP could implement this on their own without the RPC needing to do anything on their end.

Steps to Install:

Local:

  • Install NodeJS & a Redis Server (127.0.0.1:6379 by default)
  • Git clone this repository
  • copy .env.example to .env
  • Edit the .env file to your liking (Coingecko support is optional)
  • Run npm install
  • Run npm start (This calls ts-node src/index.ts)

Akash:

  • Download and Setup the Cloudmos Deploy tool
  • Create a new Akash Blank Deployment
  • Paste the yaml file located at akash/akash-deploy.yml
  • Change the RPC_URL to any public-facing RPC you trust (for any network)
  • Edit the COINGECKO_COINS to your liking if you have the COINGECKO_SUPPORT=true
  • Deploy! Cost can range from $2 per month up to as many resources as you want to give it.

Future TODO:

- Allow ENV file to specify each type of Tx cache time (based on requests)
- if using the rest API, actually use a a CosmWasm client against the RPC to speed up requests? (then cache via blocktime seconds)
- Allow cycling between RPCs, if requests fails retry to another RPC & remove bad one from list
You might also like...

RPC-like client, contract, and server implementation for a pure REST API

RPC-like client, contract, and server implementation for a pure REST API

ts-rest RPC-like client and server helpers for a magical end to end typed experience Introduction ts-rest provides an RPC-like client side interface o

Dec 30, 2022

an open-source package to make it easy and simple to work with RabbitMQ's RPC ( Remote Procedure Call )

an open-source package to make it easy and simple to work with RabbitMQ's RPC ( Remote Procedure Call )

RabbitMQ Easy RPC (Remote Procedure Call ) The Node.js's RabbitMQ Easy RPC Library rabbitmq-easy-RPC is an easy to use npm package for rabbitMQ's RPC

Sep 22, 2022

An interactive Bitcoin tutorial for orange-pilled beginners. Illustrates technical Bitcoin concepts using JavaScript and some Bitcoin Core RPC commands. Programming experience is helpful, but not required.

An interactive Bitcoin tutorial for orange-pilled beginners. Illustrates technical Bitcoin concepts using JavaScript and some Bitcoin Core RPC commands. Programming experience is helpful, but not required.

Try Bitcoin Try Bitcoin is an interactive Bitcoin tutorial inspired by and forked from Try Regex, which is inspired by Try Ruby and Try Haskell. It il

Nov 25, 2022

Collection of JSON-RPC APIs provided by Ethereum 1.0 clients

Ethereum JSON-RPC Specification View the spec The Ethereum JSON-RPC is a collection of methods that all clients implement. This interface allows downs

Jan 8, 2023

Run RPC over a MessagePort object from a Worker thread (or WebWorker)

thread-rpc Run RPC over a MessagePort object from a Worker thread (or WebWorker) npm install thread-rpc Usage First in the parent thread const Thread

May 31, 2022

⚡🚀 Call multiple view functions, from multiple Smart Contracts, in a single RPC query!

ethers-multicall ⚡ 🚀 Call multiple view functions, from multiple Smart Contracts, in a single RPC query! Querying an RPC endpoint can be very costly

Dec 30, 2022

A cache for @azure/msal-node that uses Azure KeyVault as a store

A cache for @azure/msal-node that uses Azure KeyVault as a store

@intility/msal-keyvault-cache A cache for @azure/msal-node that uses Azure KeyVault as a store. Usage Install with npm install @intility/msal-keyvault

Mar 17, 2022

A modern SQLite store for node-cache-manager

SQLite store for node cache manager A modern SQlite cache store for node-cache-manager. Featuring: Async SQLite3 using sqlite3 async/await support wit

Oct 31, 2022

Node.js library that provide a cache for file metadata or file content.

@file-cache A cache library for file metadata or file content. It is useful for process that work a given series of files and that only need to repeat

Aug 6, 2022
Releases(1.0.2)
Owner
Reece Williams
Cosmos Blockchain, CosmWasm, Sys Admin • CTO @ Craft Economy
Reece Williams
Patronum: Ethereum RPC proxy that verifies RPC responses against given trusted block hashes

Patronum Ethereum RPC proxy that verifies RPC responses against given trusted block hashes. Currently, most of the DAPPs and Wallets interact with Eth

null 14 Dec 7, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Elven Tools Dapp - Elrond blockckchain frontend dapp demo. Primarily for NFT minting, but it can be used for other purposes.

Elven Tools Dapp Docs: elven.tools/docs/landing-page.html Demo: dapp-demo.elven.tools Sneak peek: youtu.be/ATSxD3mD4dc The Dapp is built using Nextjs

Elven Tools 24 Jan 1, 2023
A small utility server to exchange data and messages between clients. Comes complete with E2E public key encryption

Zenotta Intercom A small utility server to exchange arbitrary data between clients. Comes complete with E2E public key encryption Official documentati

Zenotta AG 7 Oct 2, 2022
🎒 Accessible and extremely useful website for public school in Poland, built on fun and modern stack.

✨ Strona Szkolna ?? Zadania · ?? Pomysły Struktura ?? apps ?? backend: headless CMS (API) używający Strapi, które umożliwia dowolne typy contentu, np.

Elektron++ 26 Dec 21, 2022
Mongo Strict is a TypeScript based smart MongoDB ORM, It makes the usage of MongoDB safer, easier and faster with a better performance...

mongo-strict mongo-strict is compatible with mongo >= 5 Mongo Strict is a TypeScript-based smart MongoDB ORM, It makes the usage of MongoDB safer, eas

Mohamed Kamel 4 Sep 22, 2022
A Node.js client & server implementation of the WAMP-like RPC-over-websocket system defined in the OCPP-J protcols.

OCPP-RPC A client & server implementation of the WAMP-like RPC-over-websocket system defined in the OCPP-J protcols (e.g. OCPP1.6J and OCPP2.0.1J). Re

Mikuso 14 Dec 30, 2022
my ethereum RPC node setup & notes

UBUNTU RPC (scaffold-rpc) sudo add-apt-repository -y ppa:ethereum/ethereum sudo apt-get update sudo apt-get install ethereum = created geth script = g

Austin Griffith 10 Jul 4, 2022