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

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

  • using common contract security patterns (See Onward with Ethereum Smart Contract Security)
  • in the Solidity language.

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.

npm install -g truffle
mkdir myproject && cd myproject
truffle initCopy the code

Embark

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

npm install -g embark
embark new MyApp
cd MyAppCopy the code

Installing OpenZeppelin

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

npm init -y
npm install -E openzeppelin-solidityCopy the code

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';

contract MyContract is Ownable {
  ...
}Copy the code

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

The import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol#v1.9.0"; contract MyContract is Ownable { ... }Copy the code

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.

If you find a security issue, please email [email protected].

Developer Resources

Building a distributed application, protocol or organization with OpenZeppelin?

Interested in contributing to OpenZeppelin?

  • Framework Proposal and roadmap: medium.com/zeppelin-bl…
  • The Issue tracker: github.com/OpenZeppeli…
  • Contribution guidelines: github.com/OpenZeppeli…
  • Wiki: github.com/OpenZeppeli…

License

Code released under the MIT License.