Patronum: Ethereum RPC proxy that verifies RPC responses against given trusted block hashes

Overview

Patronum

Ethereum RPC proxy that verifies RPC responses against given trusted block hashes. Currently, most of the DAPPs and Wallets interact with Ethereum over RPC. Patronum can be used as a building block to build light clients that retrofit into the existing Ethereum infrastructure. This library mainly takes advantage of the eth_getProof RPC to perform merkle inclusion proofs for RPC call verification.

Patronus

Start RPC Provider

import { VerifyingProvider, startServer } from 'patronum';

const provider = new VerifyingProvider(
  trustlessRPCURL,
  trustedBlockNumber,
  trustedBlockHash,
);
await startServer(provider, PORT);

Use VerifyingProvider

import { VerifyingProvider } from 'patronum';

const provider = new VerifyingProvider(
  trustlessRPCURL,
  trustedBlockNumber,
  trustedBlockHash,
);

console.log(await provider.getBalance(address, blockTag));

console.log(await provider.call(tx));

The RPC URL provided to VerifyingProvider should support eth_getProof and eth_createAccessList. Infura doesn't support eth_createAccessList.

Comments
  • Make default block parameter optional

    Make default block parameter optional

    Getting error "missing value for required argument 1" for methods eth_getTransactionCount, eth_getBalance, eth_getCode, eth_call and eth_estimateGas.

    The default block parameter is usually skipped (and defaults to 'latest') even though it is not documented as optional.

    opened by tzinas 1
  • Make Verifying Provider dynamic

    Make Verifying Provider dynamic

    Currently, the Verifying Provider accepts the latest Blockhash and Blocknumber as a constructor param. But as the blockchain has new blocks, the provider should be updated to the latest BlockHash and BlockNumber

    enhancement 
    opened by shresthagrawal 1
  • Validate input of RPC requests

    Validate input of RPC requests

    Depends #13

    example request:

    {
    	"jsonrpc":"2.0",
    	"method":"eth_getBalance",
    	"params":[
    		"0x407d73d8a49eeb85d32cf465507dd71d507100c1", 
    		"a random block opt"
    	],
    	"id":1
    }
    

    response:

    {
        "jsonrpc": "2.0",
        "id": 1,
        "error": {
            "code": -32602,
            "message": "invalid argument 1: block option must be a valid 0x-prefixed block hash or hex integer, or \"latest\", \"earliest\" or \"pending\""
        }
    }
    
    opened by pkakelas 0
  • Fix MaxListenersExceededWarning

    Fix MaxListenersExceededWarning

    (node:64331) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 hardforkChanged listeners added to [Common]. Use emitter.setMaxListeners() to increase limit

    opened by shresthagrawal 0
  • Add basic testing infrastructure

    Add basic testing infrastructure

    • Added jest, ts-jest, jest types
    • Mocked web3. All requests in tests get data from the fixtures folder apart from the case where the fixture is not found, in which case it adds the fixture automatically for the next test run.
    • Used the provider test script to create the first test.
    opened by pkakelas 0
  • Make VerifiedProvider an EthersProvider

    Make VerifiedProvider an EthersProvider

    EthersJs has a big suite of libraries to interact with Ethereum. If we can extend the VerifiedProvider to implement the AbstractProvider interface provided by the EthersJs then we can use the VerifiedProvider with all the existing EthersJs toolchain.

    enhancement 
    opened by shresthagrawal 0
  • Make the Verifying provider fully compliant with RPC standard

    Make the Verifying provider fully compliant with RPC standard

    Currently, the provider only has important RPC functionality required for MetaMask. It would be great to have the Verifying Provider that is fully RPC compliant

    opened by shresthagrawal 0
  • Allow for passing multiple RPC URLs

    Allow for passing multiple RPC URLs

    Currently, the Verifying provider is booted up with just one provider. This provider can be malicious in such a case the current system simply throws an error and fails.

    Allow for passing a set of RPC URLs ordered by the most trusted one first. Gracefully try other provider URLs sequentially

    enhancement 
    opened by shresthagrawal 0
Owner
I do what I love, and I love what I do!
null
JCS (JSON Canonicalization Scheme), JSON digests, and JSON Merkle hashes

JSON Hash This package contains the following JSON utilties for Deno: digest.ts provides cryptographic hash digests of JSON trees. It guarantee that d

Hong Minhee (洪 民憙) 13 Sep 2, 2022
Trusted timestamps that you can physically include in photos, videos and live streams using QR codes and audible data signals.

QR Date This is the reference implementation for the first version of QR Date, a signed timestamp inside a QR code that you can use to verify the date

QR Date 36 Oct 5, 2022
BookStore is a website that allows a given user to view a list of books, to add a new book and remove a given book.

Project Name : BookStore CMS BookStore is a website that allows a given user to view a list of books, to add a new book and remove a given book. In or

Chris Siku 10 Aug 22, 2022
A block preview that directly displays the block fields, including tabs.

Kirby Block Preview Fields This plugin for Kirby 3 displays the block fields directly in the block preview, including tabs. Inspired by the Kirby Fiel

JUNO 8 May 10, 2023
A nodejs implementation of AI Explained on youtube's SmartGPT prompting strategy for getting better responses from gpt4.

SmartGPT A Node.js script implementation of the SmartGPT prompting system by AI Explained on youtube, see the video here Prerequisites Node.js (node >

Caleb O'Leary 7 May 10, 2023
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

null 557 Jan 8, 2023
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
proxy 🦄 yxorp is your Web Proxy as a Service (SAAS) Multi-tenant, Multi-Threaded, with Cache & Article Spinner

proxy ?? yxorp is your Web Proxy as a Service (SAAS) Multi-tenant, Multi-Threaded, with Cache & Article Spinner. Batteries are included, Content Spinning and Caching Engine, all housed within a stunning web GUI. A unique high-performance, plug-and-play, multi-threaded website mirror and article spinner

4D/ҵ.com Dashboards 13 Dec 30, 2022
Proxy but misspelled -- closed proxy for the internet

pyrox Proxy that runs on Cloudflare Workers. Setup Install wrangler2. npm install wrangler. Generate a public Ed25519 key, exported under SPKI mode wi

bots.gg 10 Sep 9, 2022
Your Ethereum control panel. Interact with smart contracts on Ethereum.

etherfunk Your Ethereum control panel. Interact with smart contracts on Ethereum. ?? https://etherfunk.io ?? Devleopment First, run the development se

Tom Quirk 23 Sep 24, 2022
Chrome extension to simulate cryptoblades fights, giving you the win rate % against all enemies with just one click

CryptoBlades fight simulator This is a Chrome extension that will help you to know the exact win rate percentage you have on each cryptoblades fight.

Jose Leonardo Dos Ramos Rivas 12 Aug 7, 2022
On-chain defense against hostile takeovers

Poison pill On-chain defense against hostile takeovers. In layman's terms, this smart contract only facilitates a discounted sale of shares to a white

Michalis Kargakis 6 Jul 19, 2022
A javascript standard data structure library which benchmark against C++ STL.

js-sdsl A javascript standard data structure library which benchmark against C++ STL. Note Note that our official version starts from 2.0.0. In order

Zilong Yao 5 Dec 10, 2022
A lightweight extension to automatically detect and provide verbose warnings for embedded iframe elements in order to protect against Browser-In-The-Browser (BITB) attacks.

Enhanced iFrame Protection - Browser Extension Enhanced iFrame Protection (EIP) is a lightweight extension to automatically detect and provide verbose

odacavo 16 Dec 24, 2022
🦔 Cyber-weapon against Putin.

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Artem Tamoian 7 Sep 14, 2022
Utility for authorizing user in a connected app, creating JWT to authenticate against it, and perform a sample callout.

Question: What is this for? Answer: When configuring a Salesforce Connected app to use certificates to authenticate you will use JSON Web Tokens to a

null 4 Jun 15, 2022
This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

?? Introduction This project will be using various AI and Rule Engine algorithm to detect various attack against a website! ?? Mission After starting

Harish S.G 4 Apr 29, 2022
Fullstack Dynamic NFT Mini Game built using 💎 Diamond Standard [EIP 2535] 🏃‍♀️Players can use Hero NFT to battle against Thanos ⚔ Heroes can be Healed by staking their NFT 🛡

?? Fullstack Dynamic NFT Mini Game ?? ?? Using Diamond Standard Play On ?? ?? ⏩ http://diamond-dapp.vercel.app/ Project Description ?? Fullstack Dynam

Shiva Shanmuganathan 21 Dec 23, 2022
LeakInspector: an add-on that warns and protects against personal data exfiltration

LeakInspector ?? LeakInspector is an add-on that warns and protects against personal data exfiltration. We developed LeakInspector to help publishers

LeakyForms 119 Nov 15, 2022