Skip to main content

License

Type-safe SPDX license identifiers for smart contract metadata.

Overview

Branded string type representing SPDX license identifiers. Used in Solidity source files and smart contract metadata to identify licensing terms. Includes validation for OSI-approved licenses.

Quick Start

Common Licenses

LicenseOSI ApprovedDescription
MITYesPermissive, minimal restrictions
Apache-2.0YesPermissive with patent grant
GPL-3.0YesStrong copyleft
GPL-2.0YesStrong copyleft (earlier version)
LGPL-3.0YesWeak copyleft for libraries
BSD-3-ClauseYesPermissive with attribution
BSD-2-ClauseYesSimplified BSD
ISCYesSimplified BSD-like
MPL-2.0YesWeak copyleft file-level
AGPL-3.0YesStrong copyleft + network use
UNLICENSEDNoProprietary/no license

API Reference

Constructors

Methods

Constants

Solidity License Identifier

SPDX license identifiers are required in Solidity files since version 0.6.8:
The identifier appears in compiled contract metadata and can be used to:
  • Identify licensing terms programmatically
  • Filter contracts by license type
  • Ensure compliance with open source requirements

Use Cases

Contract Metadata Analysis

License Filtering

References