Skip to main content

Overview

Sourcify provides a public server API for verification, and checking if a contract is verified, and a repository API for retrieving files.

Swagger documentation

Other

CREATE2 Verification

/verify/create2 is protected by a JWT token issued by auth0. You can get your token by calling the following API.

Endpoint:

POST https://sourcify.eu.auth0.com/oauth/token

Headers:

Content-Type: application/json

Body:

info

The USERNAME and PASSWORD fields are your username and password, you can create an account verifying one create2 contract in the UI

{
"grant_type": "password",
"username": "USERNAME",
"password": "PASSWORD",
"audience": "https://sourcify.dev",
"client_id": "nApMV1kEehEBtDwSx1fiVmggdX57pb0Q",
"scope": "openid profile"
}

Example in Node.js

import axios from "axios";
import * as dotenv from "dotenv";
dotenv.config();

// Define your credentials and Auth0 domain
const AUTH0_DOMAIN = "sourcify.eu.auth0.com";
const CLIENT_ID = "nApMV1kEehEBtDwSx1fiVmggdX57pb0Q";
const AUDIENCE = "https://sourcify.dev";

// Define the user's credentials
const username = process.env.USERNAME;
const password = process.env.PASSWORD;

// Define the headers and data for the POST request
const headers = { "content-type": "application/json" };
const data = {
grant_type: "password",
username: username,
password: password,
audience: AUDIENCE,
client_id: CLIENT_ID,
scope: "openid profile",
};

axios
.post(`https://${AUTH0_DOMAIN}/oauth/token`, data, { headers: headers })
.then((response) => {
// pass response.data.access_token when calling /verify/create2
// as `Bearer ${response.data.access_token}` in the Authorization header
})
.catch((error) => {
console.log(error);
});