Skip to content

OpenZeppelin Contracts

A tested library of reusable smart contract code for Ethereum-style blockchains.

Stars
27.3k
Forks
12.4k
Licence
MIT
Language
Solidity
Last update
4 days ago
Type
Library

What it is

OpenZeppelin Contracts is a library of pre-written smart contract code for the Solidity language, used on Ethereum-compatible blockchains. It includes implementations of common token standards such as ERC20 and ERC721, plus access-control and utility components. Developers use it so they can build on community-reviewed code instead of writing these pieces from scratch.

  • Create an ERC721 collectible contract by importing the library and extending it, as shown in the README example
  • Add role-based permissions to a contract using the access-control components
  • Use utility components such as non-overflowing math or signature verification in custom contracts
  • Generate a starting contract with the Contracts Wizard web tool

Great for

  • Developers writing Solidity smart contracts who need standard tokens or permission systems
  • Teams that want reviewed building blocks rather than custom code for common functions
  • Developers building NFT collections or fungible tokens on Ethereum-compatible chains

Not ideal for

  • Non-developers looking for a finished app; this is code to build contracts with, not a ready-made product
  • Anyone planning to copy code into a project and edit it, since the README says to use the installed code as-is
  • Projects that treat the library as a replacement for a professional security audit, which the README explicitly says it is not
Step-by-step guide: how to use OpenZeppelin ContractsInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js (for npm/Hardhat install; version not stated in README) · Solidity knowledge · Foundry (optional, for git install; version not stated in README)

    Install audited release with Hardhat/npm

    npm install @openzeppelin/contracts

    Install with Foundry

    forge install OpenZeppelin/openzeppelin-contracts
  2. 2

    Run it

    • Install the package with npm or forge as shown in the README
    • Add the remapping @openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/ to remappings.txt if using Foundry
    • Import the contracts you need into your Solidity file
    • Compile your contract with your development toolchain
  3. 3

    Get the most out of it

    • Use tagged releases rather than the master branch, as the README recommends
    • Use the Contracts Wizard to generate starter contracts
    • Read the access-control and token guides in the documentation site
    • Review the API reference for exact function signatures

Downloads

Strengths

  • Built on community-vetted code, according to the README
  • Covers standards such as ERC20, ERC721, ERC1155 and ERC6909 per the documentation links
  • Uses semantic versioning and publishes separate audited (latest) and unaudited (dev) npm tags

Trade-offs

  • Smart contracts carry high technical risk, and the README says the library is not a substitute for an audit
  • Upgrading across major versions may be unsafe for upgradeable contracts, according to the README
  • The README warns that some blog-linked tooling is outdated, so guides may not match current tools

How it compares

ProjectStarsTypeLevelUpdatedBest for
openzeppelin-contracts (this)27.3kLibraryintermediate4 days agoDevelopers writing Solidity smart contracts who need standard tokens or permission systems
truffle13.9kDev toolintermediate2.5 years agoDevelopers maintaining existing Truffle-based Ethereum projects
full-blockchain-solidity-course-py11.2kLearning resourcebeginner2.6 years agoBeginners who want a structured path into Solidity and smart contracts
sismo-badges15.9kLibraryadvanced3.1 years agoDevelopers building or auditing Ethereum contracts for the Sismo attestation system
shardeum31.2kOtheradvanced1.1 years agoDevelopers building or testing EVM-compatible decentralized apps who want a local test network
mitmproxy46.6kDev toolintermediate4 days agoDevelopers debugging how an app talks to a backend API

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.