0.2.0 • Published 9 months ago

@lightclients/patronum v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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.

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.