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
Compare Car Insurance Quotes from $29/mo Instantly (2024)
Compare Free Life Insurance Quotes Online (March 2024)
Kevin Cox Picks
Yogabella Babysitter
Readyset Ochsner.org
Wausau Marketplace
Geodis Logistic Joliet/Topco
Pickswise the Free Sports Handicapping Service 2023
T&G Pallet Liquidation
Bill Devane Obituary
Simple Steamed Purple Sweet Potatoes
Detroit Lions 50 50
Shemal Cartoon
Evil Dead Rise Showtimes Near Regal Columbiana Grande
Wal-Mart 140 Supercenter Products
Zalog Forum
Vintage Stock Edmond Ok
Wgu Academy Phone Number
Invitation Homes plans to spend $1 billion buying houses in an already overheated market. Here's its presentation to investors setting out its playbook.
Self-Service ATMs: Accessibility, Limits, & Features
Wemod Vampire Survivors
The EyeDoctors Optometrists, 1835 NW Topeka Blvd, Topeka, KS 66608, US - MapQuest
LCS Saturday: Both Phillies and Astros one game from World Series
Marquette Gas Prices
Worthington Industries Red Jacket
Tu Housing Portal
Hoofdletters voor God in de NBV21 - Bijbelblog
Jeep Cherokee For Sale By Owner Craigslist
Angela Muto Ronnie's Mom
Lil Durk's Brother DThang Killed in Harvey, Illinois, ME Confirms
CARLY Thank You Notes
New York Rangers Hfboards
Polk County Released Inmates
Baywatch 2017 123Movies
Pawn Shop Open Now
Gpa Calculator Georgia Tech
What Is Kik and Why Do Teenagers Love It?
Join MileSplit to get access to the latest news, films, and events!
US-amerikanisches Fernsehen 2023 in Deutschland schauen
Payrollservers.us Webclock
Login
Expendables 4 Showtimes Near Malco Tupelo Commons Cinema Grill
M&T Bank
Avatar: The Way Of Water Showtimes Near Jasper 8 Theatres
Makes A Successful Catch Maybe Crossword Clue
Bmp 202 Blue Round Pill
Sara Carter Fox News Photos
Accident On 40 East Today
Ics 400 Test Answers 2022
Thrift Stores In Burlingame Ca
Cool Math Games Bucketball
Anthony Weary Obituary Erie Pa
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.