Skip to main content

Database Schema

Verifier Alliance's database schema is in PostgreSQL and is intended to be a standard for storing and accessing verified smart contract data.

In essence every smart contract verification (verified_contracts table) is a mapping between a compilation (compiled_contracts) and a deployment (contract_deployments). In addition verified_contracts defines "transformations". These are changes need to be made on the recompiled bytecode to reach the onchain bytecode. Transformations can be replacements of non-executional parts of the bytecode (e.g. immutables, libraries, metadata) or insertions at the end such as constructor arguments. Read more about them in the transformations docs.

For deduplicating the source files and the bytecode across verifications the schema also includes a code and sources table with hashes.

The full and exact schema definition is available in the GitHub repository. You can also access the live schema of the database here or in the embedded frame below but the source of truth is the SQL file in the repository. The diagram is only for demonstration purposes and not exact.

The schema contains constraints to ensure the integrity of the data both on columns as well as on the JSON columns:

  • Transformations (in verified_contracts):
    • runtime_transformations
    • runtime_values
    • creation_transformations
    • creation_values
  • Compilation Artifacts (in compiled_contracts):
    • compiler_settings
    • compilation_artifacts
    • creation_code_artifacts
    • runtime_code_artifacts