• Stars
    star
    167
  • Rank 226,635 (Top 5 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created about 1 year ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MESC is a specification for how crypto tools configure their RPC endpoints

Multiple Endpoint Shared Configuration (MESC) Standard

Specification issues - badge-generator Rust Tests Python Tests

MESC is a standard for how crypto tools configure their RPC endpoints. By following this specification, a user creates a single RPC configuration that can be shared by all crypto tools on their system.

MESC has two main design goals:

  1. make it easy to share RPC configuration data across tools, languages, and environments
  2. make it easy to manage the configuration of a large number of RPC endpoints

MESC is formally defined in SPECIFICATION.md.

Additional information can be found in the MESC Documentation.

Contents

Reference Implementations

Reference implementations are provided for each of the following:

These implementations provide a consistent language-agnostic interface while still obeying the best practices of each language.

Quickstart

The quickest way to use MESC is:

  1. create a mesc.json config file
  2. set the MESC_PATH environment variable to the path of this file

These steps can be performed automatically using the interactive mesc CLI tool:

  1. Install: cargo install mesc_cli
  2. Perform interactive setup: mesc setup

Installing the mesc cli on some linux distributions may require installing ssl libraries (e.g. sudo apt-get install pkg-config libssl-dev on ubunutu)

Tutorial

Below is a brief tutorial on MESC. For more detail, see the MESC Specification and Documentation.

Topics:

Tracked Information

MESC tracks the following information:

  1. a list of RPC endpoints, including their name, chain_id, and url
  2. the default RPC endpoint to use
  3. the default RPC endpoint to use for each network

MESC can also track other information like metadata and tool-specific defaults. Configuration data is stored in a JSON file. To create this file, follow the Quickstart instructions above.

Common Interface

All reference MESC implementations use the same common interface.

Here is a comparison between the python interface and the rust interface:

python
import mesc

# check whether mesc is enabled
enabled: bool = mesc.is_mesc_enabled()

# get the default endpoint
endpoint: Endpoint | None = mesc.get_default_endpoint()

# get the default endpoint of a network
endpoint: Endpoint | None = mesc.get_endpoint_by_network(5)

# get the default endpoint for a particular tool
endpoint: Endpoint | None = mesc.get_default_endpoint(profile='xyz_tool')

# get the default endpoint of a network for a particular tool
endpoint: Endpoint | None = mesc.get_endpoint_by_network(5, profile='xyz_tool')

# get an endpoint by name
endpoint: Endpoint | None = mesc.get_endpoint_by_name('local_goerli')

# parse a user-provided string into a matching endpoint
# (first try 1. endpoint name, then 2. chain id, then 3. network name)
endpoint: Endpoint | None = mesc.get_endpoint_by_query(user_str, profile='xyz_tool')

# find all endpoints matching given criteria
endpoints: list[Endpoint] = mesc.find_endpoints(chain_id=5)
rust
use mesc::{MescError, Endpoint};
use std::collections::HashMap;

type OptionalResult = Result<Option<Endpoint>, MescError>;
type MultiResult = Result<Vec<Endpoint>, MescError>;
type MetadataResult = Result<HashMap<String, serde_json::Value>, MescError>;

// check whether mesc is enabled
let enabled: bool = mesc::is_mesc_enabled();

// get the default endpoint
let endpoint: OptionalResult = mesc::get_default_endpoint(None);

// get the default endpoint of a network
let endpoint: OptionalResult = mesc::get_endpoint_by_network("5", None);

// get the default network for a particular tool
let chain_id: OptionalResult = mesc::get_default_endpoint(Some("xyz_tool"));

// get the default endpoint of a network for a particular tool
let endpoint: OptionalResult = mesc::get_endpoint_by_network("5", Some("xyz_tool"));

// get an endpoint by name
let endpoint: OptionalResult = mesc::get_endpoint_by_name("local_goerli");

// parse a user-provided string into a matching endpoint
// (first try 1. endpoint name, then 2. chain id, then 3. network name)
let user_str = "local_goerli";
let endpoint: OptionalResult = mesc::get_endpoint_by_query(user_str, Some("xyz_tool"));

// find all endpoints matching given criteria
let query = mesc::MultiEndpointQuery::new().chain_id("5").unwrap();
let endpoints: MultiResult = mesc::find_endpoints(query);

Typical Usage

Imagine a crypto cli tool xyz. This tool has an argument -r <RPC_URL> that specifies which RPC endpoint to use.

If xyz uses MESC, then -r can become a much more versatile argument. Instead of just accepting a plain URL, -r can accept 1. an endpoint name, 2. chain id, or 3. a network name. Each of the following might resolve to the same RPC url:

  • xyz -r localhost:8545 (url)
  • xyz -r local_goerli (endpoint name)
  • xyz -r 5 (chain id)
  • xyz -r goerli (network name)

This url resolution can implemented within xyz using:

# python code used by xyz tool
endpoint = mesc.get_endpoint_by_query(user_input, profile='xyz')
url = endpoint['url']
// rust code used by xyz tool
let endpoint = mesc::get_endpoint_by_query(user_input, Some("xyz"))?;
let url = endpoint.url;

More Repositories

1

reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
Rust
3,910
star
2

artemis

A simple, modular, and fast framework for writing MEV bots in Rust.
Rust
2,292
star
3

cryo

cryo is the easiest way to extract blockchain data to parquet, csv, json, or python dataframes
Rust
1,137
star
4

rivet

Developer Wallet & DevTools for Anvil
TypeScript
833
star
5

flux

Graph-based LLM power tool for exploring many completions in parallel.
TypeScript
773
star
6

paradigm-ctf-2021

Official repository for Paradigm CTF 2021
Solidity
488
star
7

flood

flood is a load testing tool for benchmarking EVM nodes over RPC
Python
316
star
8

paradigm-ctf-2022

Rust
296
star
9

paradigm-data-portal

a collection of open source crypto datasets for researchers and tool builders
Python
288
star
10

revmc

JIT and AOT compiler for the Ethereum Virtual Machine, built on Revm.
Rust
202
star
11

mev-share-rs

Rust client library for Flashbots MEV-share
Rust
177
star
12

zk-eth-rng

Secure randomness for Ethereum's execution layer via SNARKs and RANDAO.
Solidity
172
star
13

pyrevm

Python wrapper around https://github.com/bluealloy/revm/ using PyO3
Rust
167
star
14

ultimate_evm_tracing_reference

a collection of EVM tracing information for easy reference
156
star
15

etop

like htop for Ethereum and other EVM chains
Rust
143
star
16

jitevm

convert evm bytecode to native machine code and go vroom - just an experiment, probably broken, reach out to [email protected] to contribute / productionize.
Rust
141
star
17

spice

Simple client for extracting data from the Dune Analytics API
Python
131
star
18

tbl

tbl is a swiss army knife for parquet read and write operations
Rust
112
star
19

reth-exex-examples

Collection of ExEx examples built on Reth
Rust
100
star
20

paradigm-ctf-infrastructure

Public infra related to hosting Paradigm CTF
Solidity
98
star
21

sinker

Synchronize Postgres to Elasticsearch
Python
63
star
22

local_reth

Run Reth+Prometheus+Grafana locally via docker-compose
Dockerfile
60
star
23

paradigm-ctf-2023

Solidity
59
star
24

stress4844

Tiny CLI for submitting large calldata transactions to EVM networks to stress test the networking layer. Main motivation: EIP4844blobs.
Rust
55
star
25

fig

Guidelines & best practices for developing Frames: https://www.figma.com/community/file/1367670879509913267/frame-interface-guidelines
52
star
26

paradigm-ctf-2022-teaser

https://rinkeby.etherscan.io/address/0xffb9205c84d0b209c215212a3cdfc50bf1cfb0e0#code
Solidity
40
star
27

op-rs

Rust
37
star
28

how-to-raise-the-gas-limit

Data & code accompanying Paradigm's How to Raise the Gas Limit post.
Jupyter Notebook
33
star
29

foundry-alphanet

Foundry tools for interfacing with Reth Alphanet's bleeding-edge EVM extensions.
Shell
29
star
30

humanizooor

16
star
31

phishing-list

A rapidly-updated list of live phishing domains for consumption by the eth-phishing-detect module
16
star
32

state_growth

Python
15
star
33

homebrew-brew

A homebrew tap
Ruby
12
star
34

.github

7
star
35

evm-inspectors

EVM Execution Hooks.
2
star
36

crypto_colors

Python
1
star