Sourcify Contract Viewer
May 9, 2025 ยท View on GitHub
A Next.js application for viewing verified smart contract details from the Sourcify API.
Getting Started
Prerequisites
- Node.js 18.x or later
- npm or yarn
- Docker (optional, for containerized deployment)
Environment Variables
Create a .env file in the root directory with the following variables:
SOURCIFY_SERVER_URL=https://sourcify.dev/server
# NODE_ENV=development or NODE_ENV=production
Running Locally
-
Clone the repository:
git clone https://github.com/sourcifyeth/repo.sourcify.dev.git cd repo.sourcify.dev -
Install dependencies:
npm install # or yarn install -
Run the development server:
npm run dev # or yarn dev -
Open http://localhost:3000 in your browser to see the application.
Building for Production
npm run build
npm start
# or
yarn build
yarn start
Docker Deployment
The project includes a Dockerfile based on the official Next.js Docker example.
Building and Running with Docker
Keep in mind you need to pass the SOURCIFY_SERVER_URL as a build argument. The way to pass this might differ depending on your build platform. In Google Cloud Build, you need to pass it as a value to be substituted in your cloudbuild.yaml file:
steps:
- name: gcr.io/cloud-builders/docker
args:
- build
- "--build-arg"
- "SOURCIFY_SERVER_URL=${_SOURCIFY_SERVER_URL}"
---
substitutions:
_SOURCIFY_SERVER_URL: https://sourcify.dev/server
-
Build the Docker image:
# Build the image with the Sourcify server URL as a build argument docker build --build-arg SOURCIFY_SERVER_URL=https://sourcify.dev/server -t repo-sourcify . -
Run the container:
docker run -p 3000:3000 -e SOURCIFY_SERVER_URL=https://sourcify.dev/server repo-sourcify -
Access the application at http://localhost:3000.