This repository contains the OpenRPC specification for Flashbots' JSON-RPC API. You can view the specs in the following formats:
OpenRPC is way to specify JSON-RPC APIs that is versionable, human-readable, and machine-readable. It improves the accuracy of documentation, APIs, and clients.
You can contribute to the API specs using the following steps.
- Edit the API specs in the
openrpc.yamlfile. See the OpenRPC docs for more information on how to format the specs. - Run
bun installif you haven't previously set up the repository. - Run
bun run buildto re-generate the output file:dist/build/openrpc.json. - To view the result, paste that file's contents into the OpenRPC playground.
Run bun test to execute the unit tests, or bun run build:watch to rebuild whenever sources change. Run bun run coverage to execute scripts/coverage.ts, which drives the OpenRPC coverage suite, streams results to the console, and refreshes the HTML report (requires network access).
The coverage runner can optionally broadcast a real eth_sendRawTransaction call using ethers. Set ETHEREUM_PRIVATE_KEY (hex string) before running bun run coverage to enable it. The transaction uses the same account as sender and recipient, a 0 wei value, 21,000 gas limit, and the standard coverage RPC URL unless overridden globally via COVERAGE_RPC_URL. Without the private key the rule is skipped and coverage falls back to the default example/schema-based tests.
When you build the project, the following happens:
- The API specs
openrpc.yamlare loaded from the local file system. - The Ethereum Execution API specs are fetched from a remote URL and methods not supported/implemented by Flashbots are filtered out.
- The local Flashbots specs are merged with the Ethereum specs.
- Each Ethereum method is tagged with the "Ethereum API" tag.
- The merged and filtered specs are written out to temporary files:
src/build/openrpc.json
- These files are output to the
distfolder and thesrc/buildcontents are deleted.
If you have permissions you can follow the guide here: https://www.notion.so/flashbots/Running-API-Spec-Tests-for-protect-2ab6b4a0d876800b9be5f57233fc6a4a
On release, the specs are published to npm at @flashbots/api-specs and to
GitHub Pages.
This is based on the MetaMask API specs repo.