Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.12 KB

readme.md

File metadata and controls

47 lines (34 loc) · 1.12 KB

etherscan-cache

A simple caching server for Etherscan-like APIs.

Installation

Install dependencies

pip install -r requirements.txt

Create a config.toml, specify multiple upstreams with their corresponding API keys.

[etherscan]
url = "https://api.etherscan.io/api"
# optional for on-chain lookups
# rpc_url = "http://localhost:8545"
keys = [
    "V53X2WJ37502KMJFXOZB30V0JHNMO11IEO",
    "C6CS0ELHNKQJOL5KUGJVI9UOX3PRECYOZW",
    "4Q465Q32P2C7E7M0COZYSOM22GCHHW2T4G",
    "0NWN4412GB0X9KNH7XH4220UMB6F28CIIH",
    "UO6F66X8H2NS0ALAJNQIXQP6APO74O0UAU",
]

The keys will be used in a round robin manner. All requested sources and ABIs will be forever cached.

Run with uvicorn.

uvicorn app:app --port 8000

Front with something like Caddy if you need https.

API

  • /{explorer}/api forwards to upstream api
  • /stats cache stats (hits, misses, count, size)
  • /{explorer}/constructor_args/{address} returns the bytecode of the constructor args when the contract was deployed

Docker

After populating the config.toml you can build and run the docker container:

docker-compose up --build --detach