zeppelin-solidity (2024)

zeppelin-solidity (1)zeppelin-solidity (2)zeppelin-solidity (3)

OpenZeppelin is a library for writing secure Smart Contracts on Ethereum.

With OpenZeppelin, you can build distributed applications, protocols and organizations:

NOTE: New to smart contract development? Check our introductory guide.

Getting Started

OpenZeppelin integrates with Truffle and Embark.

truffle

To use with Truffle, first install it and initialize your project with truffle init.

npminstall-gtruffle

mkdirmyproject&&cdmyproject

truffleinit

Embark

To use with Embark, first install it and initialize your project with embark new MyApp.

Installing OpenZeppelin

After installing either Framework, to install the OpenZeppelin library, run the following in your Solidity project root directory:

npminit-y

npminstall-Eopenzeppelin-solidity

Note that OpenZeppelin does not currently follow semantic versioning. You may encounter breaking changes upon a minor version bump. We recommend pinning the version of OpenZeppelin you use, as done by the -E (--save-exact) option.

After that, you'll get all the library's contracts in the node_modules/openzeppelin-solidity/contracts folder. You can use the contracts in the library like so:

import'openzeppelin-solidity/contracts/ownership/Ownable.sol';

contractMyContractisOwnable{

...

}

If you are using Embark, you can also import directly from github:

import"github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol#v1.9.0";

contractMyContractisOwnable{

...

}

Architecture

The following provides visibility into how OpenZeppelin's contracts are organized:

  • access - Smart contracts that enable functionality that can be used for selective restrictions and basic authorization control functions. Includes address whitelisting and signature-based permissions management.

    • rbac - A library used to manage addresses assigned to different user roles and an example Role-Based Access Control (RBAC) interface that demonstrates how to handle setters and getters for roles and addresses.
  • crowdsale - A collection of smart contracts used to manage token crowdsales that allow investors to purchase tokens with ETH. Includes a base contract which implements fundamental crowdsale functionality in its simplest form. The base contract can be extended in order to satisfy your crowdsale’s specific requirements.

    • distribution - Includes extensions of the base crowdsale contract which can be used to customize the completion of a crowdsale.
    • emission - Includes extensions of the base crowdsale contract which can be used to mint and manage how tokens are issued to purchasers.
    • price - Includes extensions of the crowdsale contract that can be used to manage changes in token prices.
    • validation - Includes extensions of the crowdsale contract that can be used to enforce restraints and limit access to token purchases.
  • examples - A collection of simple smart contracts that demonstrate how to add new features to base contracts through multiple inheritance.

  • introspection - An interface that can be used to make a contract comply with the ERC-165 standard as well as a contract that implements ERC-165 using a lookup table.

  • lifecycle - A collection of base contracts used to manage the existence and behavior of your contracts and their funds.

  • math - Libraries with safety checks on operations that throw on errors.

  • mocks - A collection of abstract contracts that are primarily used for unit testing. They also serve as good usage examples and demonstrate how to combine contracts with inheritence when developing your own custom applciations.

  • ownership - A collection of smart contracts that can be used to manage contract and token ownership

  • payment - A collection of smart contracts that can be used to manage payments through escrow arrangements, withdrawals, and claims. Includes support for both single payees and multiple payees.

  • proposals - A collection of smart contracts that reflect community Ethereum Improvement Proposals (EIPs). These contracts are under development and standardization. They are not recommended for production, but they are useful for experimentation with pending EIP standards. Go here for more information.

  • token - A collection of approved ERC standard tokens -- their interfaces and implementations.

    • ERC20 - A standard interface for fungible tokens:
      • Interfaces - Includes the ERC-20 token standard basic interface. I.e., what the contract’s ABI can represent.
      • Implementations - Includes ERC-20 token implementations that include all required and some optional ERC-20 functionality.
    • ERC721 - A standard interface for non-fungible tokens
      • Interfaces - Includes the ERC-721 token standard basic interface. I.e., what the contract’s ABI can represent.
      • Implementations - Includes ERC-721 token implementations that include all required and some optional ERC-721 functionality.

Tests

Unit test are critical to the OpenZeppelin framework. They help ensure code quality and mitigate against security vulnerabilities. The directory structure within the /tests directory corresponds to the /contracts directory. OpenZeppelin uses Mocha’s JavaScript testing framework and Chai’s assertion library. To learn more about how to tests are structured, please reference OpenZeppelin’s Testing Guide.

How To Use And Modify OpenZeppelin Contracts

When using OpenZeppelin to build your own distributed applications, for security reasons we encourage you NOT to modify the framework’s base contracts, libraries, and interfaces. In order to leverage and extend their functionality, we encourage you to inherit from them or compose them together with your own contracts.

The Solidity programming language supports multiple inheritance. This is very powerful yet it can also be confusing: the more complexity you introduce to your distributed applications through multiple inheritance, the greater your application’s attack surface is.

You’ll notice in the /mocks directory there are a collection of abstract contracts used primarily for unit testing purposes that can also be used as the foundation for your own custom implementations. These mock contracts demonstrate how OpenZeppelin’s secure base contracts can be used with multiple inheritance.

To learn more about combining OpenZeppelin contracts with your own custom contracts using multiple inheritance we encourage you to read the following: On crowdsales and multiple inheritance

Security

OpenZeppelin is meant to provide secure, tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions and any security problem you might experience.

The core development principles and strategies that OpenZeppelin is based on include: security in depth, simple and modular code, clarity-driven naming conventions, comprehensive unit testing, pre-and-post-condition sanity checks, code consistency, and regular audits.

If you find a security issue, please email security@openzeppelin.org.

Developer Resources

Building a distributed application, protocol or organization with OpenZeppelin?

Interested in contributing to OpenZeppelin?

License

Code released under the MIT License.

zeppelin-solidity (2024)

FAQs

What is Zeppelin in blockchain? ›

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 Solidity still used? ›

Solidity is the most popular blockchain programming language of the Ethereum Virtual Machine (EVM), also widely used across a range of EVM-compatible blockchains.

Does arbitrum use Solidity? ›

Although Arbitrum supports Solidity code, there are differences in the effects of a few operations, including language features that don't make much sense in the Layer 2 context. Returns a cryptographically insecure, pseudo-random hash for x within the range block.

Is Solidity difficult to learn? ›

Solidity isn't a walk in the park by any means. In fact, it's probably one of the most challenging programming languages to implement and master out there. Yes, learning it is easy and many programmers can learn it in days, if not weeks.

What is the holy grail of blockchain? ›

Achieving a network that features watertight security over a widely decentralized network while being able to manage internet-scale transactional throughput is the holy grail of blockchain tech.

What's Open Zeppelin for? ›

OpenZeppelin is an open-source framework to build secure smart contracts. OpenZeppelin provides a complete suite of security products and audit services to build, manage, and inspect all aspects of software development and operations for decentralized applications.

Is it worth learning Solidity in 2024? ›

It is worth exploring Solidity, which is currently used for smart contracts. This can help you understand the technology currently shrouded in hype.

Is Solidity better than Python? ›

Solidity may be considered harder than Python for beginners due to its unique features and the need to understand blockchain technology. However, experienced programmers might find it easier to pick up.

Is Solidity enough for blockchain? ›

Move and Solidity are both perfect languages for blockchain development but both of them have certain features. Solidity, Ethereum's flagship language, is contract-oriented, widely adopted, and has a JavaScript-like syntax, making it accessible to many developers.

Is arbitrum better than Ethereum? ›

Low Fees and Efficient Scalability

Arbitrum addresses this issue by providing users with the ability to conduct transactions at lower costs. This makes using the Arbitrum network more accessible and economically viable for a wide range of users. Arbitrum offers significantly faster transactions compared to Ethereum.

Which blockchains are Solidity? ›

Blockchain platforms

Solidity is available on: Avalanche C-Chain. Binance Smart Chain. Counterparty (which runs on Bitcoin)

What blockchain is arbitrum built on? ›

Arbitrum chains are Layer 2 solutions built on top of the Ethereum blockchain, designed to increase scalability and reduce transaction costs.

Is Solidity still in demand? ›

Solidity developers are in high demand, and as a result, their salaries are on the rise.

How much do Solidity coders make? ›

$105,000 is the 25th percentile. Salaries below this are outliers. $135,500 is the 75th percentile.

How many hours to master Solidity? ›

Professionals with experience in programming concepts and coding languages can usually learn Solidity in 1-6 months. If you have no programming experience, it may take longer. Beginners can take advantage of platforms like CryptoZombies or other free online courses to build a foundation for advanced classes.

What are the three types of blockchain? ›

Public blockchains allow anyone access; private blockchains are available to selected or authorized users; permissioned blockchains have different levels of user permissions or roles. Many cryptocurrencies are built on open-source, public blockchains.

What is the purpose of a DAO in blockchain? ›

A decentralized autonomous organization (DAO) is a management structure that uses blockchain technology to automate some aspects of voting and transaction processing.

What is IBM blockchain called? ›

Hyperledger Fabric, an open source project from the Linux® Foundation, is the modular blockchain framework and has become the unofficial standard for enterprise blockchain platforms.

What is Ganesh in blockchain? ›

Summary: Ganache is a personal Blockchain for Ethereum development that can be used for testing smart contracts and DApps in a sandbox environment. Ganache can simulate different network conditions, such as network latency and limited bandwidth, to test the performance of the smart contracts and DApps.

Top Articles
Can My Spouse Own A Gun If I Am A Convicted Felon? | Schwartz & Schwartz Personal Injury & Criminal Lawyers
California's Legal Requirements for Ghost Guns
Antisis City/Antisis City Gym
Splunk Stats Count By Hour
Metra Union Pacific West Schedule
How to Type German letters ä, ö, ü and the ß on your Keyboard
Turbocharged Cars
Caresha Please Discount Code
United Dual Complete Providers
Steamy Afternoon With Handsome Fernando
Michael Shaara Books In Order - Books In Order
Razor Edge Gotti Pitbull Price
Who called you from +19192464227 (9192464227): 5 reviews
Grayling Purnell Net Worth
Trivago Sf
Nhl Tankathon Mock Draft
Curver wasmanden kopen? | Lage prijs
Webcentral Cuny
Drift Boss 911
Pasco Telestaff
Ceramic tiles vs vitrified tiles: Which one should you choose? - Building And Interiors
Aliciabibs
Belledelphine Telegram
Unable to receive sms verification codes
Robotization Deviantart
Trinket Of Advanced Weaponry
This Is How We Roll (Remix) - Florida Georgia Line, Jason Derulo, Luke Bryan - NhacCuaTui
Select The Best Reagents For The Reaction Below.
Myaci Benefits Albertsons
Best Laundry Mat Near Me
Tripcheck Oregon Map
N.J. Hogenkamp Sons Funeral Home | Saint Henry, Ohio
417-990-0201
Ridge Culver Wegmans Pharmacy
Jambus - Definition, Beispiele, Merkmale, Wirkung
oklahoma city community "puppies" - craigslist
Zero Sievert Coop
Collier Urgent Care Park Shore
Cal Poly 2027 College Confidential
Rs3 Bis Perks
Shane Gillis’s Fall and Rise
60 X 60 Christmas Tablecloths
Homeloanserv Account Login
Ladyva Is She Married
Mychart University Of Iowa Hospital
2013 Honda Odyssey Serpentine Belt Diagram
Trending mods at Kenshi Nexus
Interminable Rooms
Air Sculpt Houston
Hillsborough County Florida Recorder Of Deeds
Whitney Wisconsin 2022
Suzanne Olsen Swift River
Latest Posts
Article information

Author: Nathanael Baumbach

Last Updated:

Views: 6174

Rating: 4.4 / 5 (55 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Nathanael Baumbach

Birthday: 1998-12-02

Address: Apt. 829 751 Glover View, West Orlando, IN 22436

Phone: +901025288581

Job: Internal IT Coordinator

Hobby: Gunsmithing, Motor sports, Flying, Skiing, Hooping, Lego building, Ice skating

Introduction: My name is Nathanael Baumbach, I am a fantastic, nice, victorious, brave, healthy, cute, glorious person who loves writing and wants to share my knowledge and understanding with you.