What Is This
OpenZeppelin Contracts is a library for secure smart contract development on Ethereum and EVM-compatible chains. It provides community-vetted, audited implementations of token standards, access control, and utility contracts. At 27.4k stars on GitHub at the time of writing, it is the most widely used Solidity library in the ecosystem. Licensed under MIT, written in Solidity.
Key Capabilities
- Implementations of the ERC20 and ERC721 token standards, published as audited releases under the npm
latesttag - Flexible role-based permissioning system (Ownable, role-based access control) for managing who can call specific functions
- Reusable Solidity components for building custom contracts: signature verification, non-overflowing math, timelocks, and trustless payment systems
- Semantic versioning with clear backward compatibility guarantees for storage layout (important for upgradeable contracts)
- Three release tracks:
latest(audited stable),dev(final but not yet audited), andnext(release candidates)
How to Start
Install via npm for Hardhat projects:
$ npm install @openzeppelin/contracts
For the latest unaudited release (still tested and covered by bug bounty):
$ npm install @openzeppelin/contracts@dev
Install via Foundry (git):
$ forge install OpenZeppelin/openzeppelin-contracts
Add @openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/ in remappings.txt.
Then import contracts in your Solidity code:
pragma solidity ^0.8.31;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract MyCollectible is ERC721 {
constructor() ERC721("MyCollectible", "MCO") {}
}
Always use the installed code as-is. Do not copy-paste from online sources or modify it yourself. The library only deploys the functions you use, so gas costs are not inflated.
Who Is This For
For Solidity developers building on Ethereum or any EVM chain who want battle-tested, audited building blocks instead of writing token or access control logic from scratch. For teams that need to ship secure contracts quickly without reinventing the wheel. For anyone who values community review and formal audits over custom implementations.
Closing
OpenZeppelin Contracts is the foundation of secure smart contract development. It saves you from writing and auditing common patterns yourself, letting you focus on the unique logic of your dApp. The documentation site and community forum provide guides for access control, tokens, utilities, and more.
Top comments (0)