Contracts - OpenZeppelin Docs (2024)

A library for secure smart contract development. Build on a solid foundation of community-vetted code.

Overview

Installation

$ npm install @openzeppelin/contracts

OpenZeppelin Contracts features a stable API, which means your contracts won’t break unexpectedly when upgrading to a newer minor version.

Usage

Once installed, you can use the contracts in the library by importing them:

// contracts/MyNFT.sol// SPDX-License-Identifier: MITpragma solidity ^0.6.0;import "@openzeppelin/contracts/token/ERC721/ERC721.sol";contract MyNFT is ERC721 { constructor() ERC721("MyNFT", "MNFT") public { }}
If you’re new to smart contract development, head to Developing Smart Contracts to learn about creating a new project and compiling your contracts.

To keep your system secure, you should always use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don’t need to worry about it needlessly increasing gas costs.

Learn More

The guides in the sidebar will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides:

  • Access Control: decide who can perform each of the actions on your system.

  • Tokens: create tradable assets or collectibles, like the well known ERC20 and ERC721 standards.

  • Gas Station Network: let your users interact with your contracts without having to pay for gas themselves.

  • Utilities: generic useful tools, including non-overflowing math, signature verification, and trustless paying systems.

The full API is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts' development in the community forum.

Finally, you may want to take a look at the guides on our blog, which cover several common use cases and good practices.. The following articles provide great background reading, though please note, some of the referenced tools have changed as the tooling in the ecosystem continues to rapidly evolve.

Contracts - OpenZeppelin Docs (2024)

FAQs

What is OpenZeppelin ERC721? ›

ERC721 is a standard for representing ownership of non-fungible tokens, that is, where each token is unique. ERC721 is a more complex standard than ERC20, with multiple optional extensions, and is split across a number of contracts.

What are OpenZeppelin contracts? ›

OpenZeppelin Contracts helps you minimize risk by using battle-tested libraries of smart contracts for Ethereum and other blockchains. It includes the most used implementations of ERC standards.

Is OpenZeppelin free? ›

Free. Build your project with all the tools you need to get started.

Is OpenZeppelin a framework? ›

OpenZeppelin is a popular open-source framework for writing secure and scalable smart contracts in the Solidity programming language.

How do I know if my contract is ERC-721 or ERC1155? ›

According to EIPs, ERC721 and ERC1155 will implements EIP165. Therefore, we can use the supportsInterface of EIP165 to check whether the contract is ERC721 or ERC1155. The interface id for ERC1155 is 0xd9b67a26 , while the interface of ERC721 is 0x80ac58cd .

Which is better ERC-721 or ERC1155? ›

ERC-721 is popular for creating NFTs, enabling the representation of unique digital assets such as artwork, collectibles, and in-game items. ERC-1155 provides flexibility by supporting multiple token types in a single contract, making it suitable for complex token ecosystems like gaming platforms.

Is OpenZeppelin legit? ›

Very well-known and reputable in the crypto space, which is rare in this industry. Offers excellent audits and security services.

What are the benefits of OpenZeppelin? ›

It provides a set of standard contracts for common use cases, such as tokens, access control, governance, security, math, and utilities. You can use OpenZeppelin contracts as building blocks for your own smart contracts, or extend and customize them to suit your specific needs.

Where is OpenZeppelin located? ›

The entity that provides the Services and that is responsible under this notice is Zeppelin Group Ltd, a company incorporated in England and Wales whose registered address is at 5 New Street Square, London EC4A 3TW (“OpenZeppelin”).

How to create an ERC20 token in OpenZeppelin? ›

How to create an ERC 20 token with OpenZeppelin
  1. Let's get started. Go to the OpenZeppelin Contracts Wizard and click on ERC20. ...
  2. Let's add some features. ...
  3. Let's set the access control. ...
  4. Let's add upgradeability. ...
  5. Let's add a security contact. ...
  6. Download your smart contract code. ...
  7. Compile the smart contract. ...
  8. Deploy the smart contract.
Mar 17, 2023

How do I contribute to OpenZeppelin? ›

If you would like to contribute code or documentation you may do so by forking the repository and submitting a pull request. Any non-trivial code contribution must be first discussed with the maintainers in an issue (see Opening an issue). Only very minor changes are accepted without prior discussion.

What is smart contract crypto? ›

Last Updated: November 30, 2023. A smart contract is defined as a digital agreement that is signed and stored on a blockchain network, which executes automatically when the contract's terms and conditions (T&C) are met. The T&C is written in blockchain-specific programming languages such as Solidity.

What is an ERC-20 permit? ›

Understanding EIP-2612

EIP-2612 introduces a feature called “permit” for ERC-20 tokens. This lets users approve token transactions without making a separate blockchain transaction each time. It uses off-chain signatures, meaning you can give permission away from the blockchain while still keeping it secure.

What is Ethernaut? ›

Ethernaut is a Web3/Solidity based wargame inspired by overthewire, to be played in the Ethereum Virtual Machine.

What is OpenZeppelin in Blockchain? ›

Founded in 2015, OpenZeppelin is the world leader in securing blockchain applications and smart contracts. Its bedrock open source Contract Libraries are a public good and industry standard for smart contract development.

What are the ERC721 standard methods? ›

The ERC-721 standard consists of a set of functions that developers can implement in their smart contracts to create, transfer, and manage NFTs. These functions allow for the creation of unique tokens with their own metadata, making them distinguishable from one another.

What is the difference between ERC20 and ERC-721? ›

The key difference between ERC20 and ERC721 tokens lies in their fungibility. ERC20 tokens are fungible and represent a uniform asset, while ERC721 tokens are non-fungible and symbolize a set of unique assets.

What is the difference between ERC721A and ERC-721? ›

To put it simply, ERC721A is an extension and optimization of the previous version, the ERC721. The ERC721A contract is a very good idea which allows for saving money on gas in a given community, while at the same time protecting the Ethereum network from unnecessary workload.

What does ERC-721 stand for? ›

Full Form: ERC stands for Ethereum Request for Comment, the network's official protocol for suggesting improvements. 721 is the proposal's identifier, which serves as a unique token standard for Ethereum-based tokens.

Top Articles
How long must I stay in Canada to keep my permanent resident status?
How to Manage Freelance Taxes: Your Guide | Expensify
Cappacuolo Pronunciation
Edina Omni Portal
Celebrity Extra
South Park Season 26 Kisscartoon
35105N Sap 5 50 W Nit
Kris Carolla Obituary
Nyuonsite
Fallout 4 Pipboy Upgrades
2013 Chevy Cruze Coolant Hose Diagram
[PDF] INFORMATION BROCHURE - Free Download PDF
C-Date im Test 2023 – Kosten, Erfahrungen & Funktionsweise
What to do if your rotary tiller won't start – Oleomac
Shooting Games Multiplayer Unblocked
‘Accused: Guilty Or Innocent?’: A&E Delivering Up-Close Look At Lives Of Those Accused Of Brutal Crimes
Costco Gas Foster City
Chile Crunch Original
Mary Kay Lipstick Conversion Chart PDF Form - FormsPal
Becu Turbotax Discount Code
Quest Beyondtrustcloud.com
Justified Official Series Trailer
Talbots.dayforce.com
Vigoro Mulch Safe For Dogs
Decosmo Industrial Auctions
Spn 520211
Masterkyngmash
Wnem Tv5 Obituaries
Gina Wilson Angle Addition Postulate
Foolproof Module 6 Test Answers
Bn9 Weather Radar
Discord Nuker Bot Invite
Pain Out Maxx Kratom
Schooology Fcps
25Cc To Tbsp
Landing Page Winn Dixie
Capital Hall 6 Base Layout
Royal Caribbean Luggage Tags Pending
Solve 100000div3= | Microsoft Math Solver
Sun Haven Pufferfish
What Time Is First Light Tomorrow Morning
Radical Red Doc
Kelly Ripa Necklace 2022
'Guys, you're just gonna have to deal with it': Ja Rule on women dominating modern rap, the lyrics he's 'ashamed' of, Ashanti, and his long-awaited comeback
Clausen's Car Wash
Chathuram Movie Download
Tunica Inmate Roster Release
Hampton In And Suites Near Me
10 Best Tips To Implement Successful App Store Optimization in 2024
4015 Ballinger Rd Martinsville In 46151
Latest Posts
Article information

Author: Greg O'Connell

Last Updated:

Views: 6487

Rating: 4.1 / 5 (42 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Greg O'Connell

Birthday: 1992-01-10

Address: Suite 517 2436 Jefferey Pass, Shanitaside, UT 27519

Phone: +2614651609714

Job: Education Developer

Hobby: Cooking, Gambling, Pottery, Shooting, Baseball, Singing, Snowboarding

Introduction: My name is Greg O'Connell, I am a delightful, colorful, talented, kind, lively, modern, tender person who loves writing and wants to share my knowledge and understanding with you.