Skip to content

sourcifyeth/repo.sourcify.dev

Repository files navigation

Sourcify Contract Viewer

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

  1. Clone the repository:

    git clone https://github.com/sourcifyeth/repo.sourcify.dev.git
    cd repo.sourcify.dev
  2. Install dependencies:

    npm install
    # or
    yarn install
  3. Run the development server:

    npm run dev
    # or
    yarn dev
  4. 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
  1. 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 .
  2. Run the container:

    docker run -p 3000:3000 -e SOURCIFY_SERVER_URL=https://sourcify.dev/server repo-sourcify
  3. Access the application at http://localhost:3000.

About

Verified Smart Contract view using Sourcify APIv2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published