Lightweight Sourcify repository hosting
Sourcify publishes a compressed RepositoryV2 weekly, with contracts from all chains. You can follow its instructions to download the entire repository yourself and self-host it:
curl -L -O https://repo-backup.sourcify.dev/manifest.json
jq -r '.files[].path' manifest.json | xargs -I {} curl -L -O https://repo-backup.sourcify.dev/{}
cat sourcify-repository-*.part.gz.* | tar -xz
Hosting the repository locally
You can host the extracted repository using Caddy, a lightweight, portable HTTP(S) server:
-
Install Caddy. You can find installation instructions on the official Caddy website.
-
Run a Caddy file server on
localhost:7877
:caddy file-server --root ./repositoryV2/ --listen 127.0.0.1:7877
Alternatively, use a Caddyfile instead
-
Create a Caddyfile. In the same directory used to run the download commands, create a file named
Caddyfile
with the following content:# Caddyfile for hosting Sourcify RepositoryV2 localhost:7877 { # Set the root directory to the extracted repository folder root * ./repositoryV2 # Serve files from the repository file_server }
-
In the directory containing the
Caddyfile
, runcaddy run
-
-
Update the Otterscan config. Your Sourcify repository is now hosted at
http://localhost:7877
. Update your Otterscan config to point to your new repository URL:"sourcify": { "sources": { "ipfs": "http://localhost:7877", "central_server": "http://localhost:7877" }, "backendFormat": "RepositoryV2" }
Replace
http://localhost:7877
with your server's domain or IP address if you're accessing it remotely. If you want to host your repo over HTTPS, follow Caddy's instructions at https://caddyserver.com/docs/automatic-https.