{"id":19145388,"url":"https://github.com/paradigmxyz/mesc","last_synced_at":"2025-04-07T16:17:39.177Z","repository":{"id":214120033,"uuid":"717580793","full_name":"paradigmxyz/mesc","owner":"paradigmxyz","description":"MESC is a specification for how crypto tools configure their RPC endpoints","archived":false,"fork":false,"pushed_at":"2024-09-20T18:51:32.000Z","size":1882,"stargazers_count":173,"open_issues_count":11,"forks_count":35,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-31T15:17:35.327Z","etag":null,"topics":["crypto","cryptocurrency","ethereum","evm","json-rpc","rpc"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paradigmxyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-11T22:40:47.000Z","updated_at":"2025-03-21T10:08:34.000Z","dependencies_parsed_at":"2024-01-10T09:27:35.195Z","dependency_job_id":"530873b8-7719-41da-bbed-2d35caca2486","html_url":"https://github.com/paradigmxyz/mesc","commit_stats":null,"previous_names":["paradigmxyz/mesc"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigmxyz%2Fmesc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigmxyz%2Fmesc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigmxyz%2Fmesc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigmxyz%2Fmesc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paradigmxyz","download_url":"https://codeload.github.com/paradigmxyz/mesc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685628,"owners_count":20979085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crypto","cryptocurrency","ethereum","evm","json-rpc","rpc"],"created_at":"2024-11-09T07:39:55.542Z","updated_at":"2025-04-07T16:17:39.145Z","avatar_url":"https://github.com/paradigmxyz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Multiple Endpoint Shared Configuration (MESC) Standard\n\n[![Specification](https://img.shields.io/badge/Spec-blueviolet)](https://github.com/paradigmxyz/mesc/blob/main/SPECIFICATION.md)\n[![issues - badge-generator](https://img.shields.io/badge/Docs-blueviolet)](https://paradigmxyz.github.io/mesc)\n[![Rust Tests](https://github.com/paradigmxyz/mesc/workflows/Rust%20Tests/badge.svg)](https://github.com/paradigmxyz/mesc/tree/main/tests)\n[![Python Tests](https://github.com/paradigmxyz/mesc/workflows/Python%20Tests/badge.svg)](https://github.com/paradigmxyz/mesc/tree/main/tests)\n\n\nMESC 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.\n\nMESC has two main design goals:\n1. make it easy to share RPC configuration data across tools, languages, and environments\n2. make it easy to manage the configuration of a large number of RPC endpoints\n\nMESC is formally defined in [SPECIFICATION.md](./SPECIFICATION.md).\n\nAdditional information can be found in the [MESC Documentation](https://paradigmxyz.github.io/mesc/).\n\n\n### Contents\n- [Reference Implementations](#reference-implementations)\n- [Quickstart](#quickstart)\n- [Tutorial](#tutorial)\n  - [Tracked Information](#tracked-information)\n  - [Common Interface](#common-interface)\n  - [Typical Usage](#typical-usage)\n\n## Reference Implementations\n\nReference implementations are provided for each of the following:\n- [cli](/cli)\n- [go](/go) [WIP]\n- [python](/python)\n- [rust](/rust)\n- [typescript](/typescript) [WIP]\n\nThese implementations provide a consistent language-agnostic interface while still obeying the best practices of each language.\n\n## Quickstart\n\nThe quickest way to use MESC is:\n1. create a `mesc.json` config file\n2. set the `MESC_PATH` environment variable to the path of this file\n\nThese steps can be performed automatically using the interactive [`mesc`](./cli) CLI tool:\n1. Install: `cargo install mesc_cli`\n2. Perform interactive setup: `mesc setup`\n\nInstalling the `mesc` cli on some linux distributions may require installing ssl libraries (e.g. `sudo apt-get install pkg-config libssl-dev` on ubunutu)\n\n## Tutorial\n\nBelow is a brief tutorial on MESC. For more detail, see the MESC [Specification](./SPECIFICATION.md) and [Documentation](https://paradigmxyz.github.io/mesc). \n\nTopics:\n- [Tracked Information](#tracked-information)\n- [Common Interface](#common-interface)\n- [Typical Usage](#typical-usage)\n\n### Tracked Information\n\nMESC tracks the following information:\n1. a list of RPC endpoints, including their `name`, `chain_id`, and `url`\n2. the default RPC endpoint to use\n3. the default RPC endpoint to use for each network\n\nMESC 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](#quickstart) instructions above.\n\n### Common Interface\n\nAll reference MESC implementations use the same common interface.\n\nHere is a comparison between the python interface and the rust interface:\n\n###### python\n```python\nimport mesc\n\n# check whether mesc is enabled\nenabled: bool = mesc.is_mesc_enabled()\n\n# get the default endpoint\nendpoint: Endpoint | None = mesc.get_default_endpoint()\n\n# get the default endpoint of a network\nendpoint: Endpoint | None = mesc.get_endpoint_by_network(5)\n\n# get the default endpoint for a particular tool\nendpoint: Endpoint | None = mesc.get_default_endpoint(profile='xyz_tool')\n\n# get the default endpoint of a network for a particular tool\nendpoint: Endpoint | None = mesc.get_endpoint_by_network(5, profile='xyz_tool')\n\n# get an endpoint by name\nendpoint: Endpoint | None = mesc.get_endpoint_by_name('local_goerli')\n\n# parse a user-provided string into a matching endpoint\n# (first try 1. endpoint name, then 2. chain id, then 3. network name)\nendpoint: Endpoint | None = mesc.get_endpoint_by_query(user_str, profile='xyz_tool')\n\n# find all endpoints matching given criteria\nendpoints: list[Endpoint] = mesc.find_endpoints(chain_id=5)\n```\n\n###### rust\n```rust\nuse mesc::{MescError, Endpoint};\nuse std::collections::HashMap;\n\ntype OptionalResult = Result\u003cOption\u003cEndpoint\u003e, MescError\u003e;\ntype MultiResult = Result\u003cVec\u003cEndpoint\u003e, MescError\u003e;\ntype MetadataResult = Result\u003cHashMap\u003cString, serde_json::Value\u003e, MescError\u003e;\n\n// check whether mesc is enabled\nlet enabled: bool = mesc::is_mesc_enabled();\n\n// get the default endpoint\nlet endpoint: OptionalResult = mesc::get_default_endpoint(None);\n\n// get the default endpoint of a network\nlet endpoint: OptionalResult = mesc::get_endpoint_by_network(\"5\", None);\n\n// get the default network for a particular tool\nlet chain_id: OptionalResult = mesc::get_default_endpoint(Some(\"xyz_tool\"));\n\n// get the default endpoint of a network for a particular tool\nlet endpoint: OptionalResult = mesc::get_endpoint_by_network(\"5\", Some(\"xyz_tool\"));\n\n// get an endpoint by name\nlet endpoint: OptionalResult = mesc::get_endpoint_by_name(\"local_goerli\");\n\n// parse a user-provided string into a matching endpoint\n// (first try 1. endpoint name, then 2. chain id, then 3. network name)\nlet user_str = \"local_goerli\";\nlet endpoint: OptionalResult = mesc::get_endpoint_by_query(user_str, Some(\"xyz_tool\"));\n\n// find all endpoints matching given criteria\nlet query = mesc::MultiEndpointQuery::new().chain_id(\"5\").unwrap();\nlet endpoints: MultiResult = mesc::find_endpoints(query);\n```\n\n### Typical Usage\n\nImagine a crypto cli tool `xyz`. This tool has an argument `-r \u003cRPC_URL\u003e` that specifies which RPC endpoint to use.\n\nIf `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:\n- `xyz -r localhost:8545` (url)\n- `xyz -r local_goerli` (endpoint name)\n- `xyz -r 5` (chain id)\n- `xyz -r goerli` (network name)\n\nThis url resolution can implemented within `xyz` using:\n\n```python\n# python code used by xyz tool\nendpoint = mesc.get_endpoint_by_query(user_input, profile='xyz')\nurl = endpoint['url']\n```\n\n```rust\n// rust code used by xyz tool\nlet endpoint = mesc::get_endpoint_by_query(user_input, Some(\"xyz\"))?;\nlet url = endpoint.url;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparadigmxyz%2Fmesc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparadigmxyz%2Fmesc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparadigmxyz%2Fmesc/lists"}