Basics of OpenZeppelin Smart Contracts

Created by:

OpenZeppelin - Setting the Standards

We are going to stand on the shoulder of giants and leverage the power of open source to create our project in a simpler way, while not losing focus on security which is super important in the web3 world.

In the early days of smart contract development, we developers didn’t have any standard contracts, we just wrote our own, tested them as best we could, and did a lot of hoping for the best that they wouldn’t get hacked. Since the space was new, there was a real need for developers who would specialise in rigorously auditing contracts, since they were holding a lot of value.

The OpenZeppelin team, slowly but surely, began to fill that gap creating a library of contracts that have been rigorously audited and proven to be safe and robust by all the OG protocols of the Ethereum Network, and many more.

So what are they and how do they help us?

By (re)using and these OpenZeppelin libraries, we devs can reduce the amount of code we write, and that's a good thing. By reducing the surface area for attack vectors our contracts are much less likely to be hacked. Since they are often used as an ecosystem standard, they allow for much easier collaboration among humans, and interoperability with the technology those humans create in their code.

In the beginning the OZ contracts were quite basic, but over time they have gotten much richer and more modular, opening up loads of possibilities. And when we pair this with the evolution of ERC standards and tokens, which we also look at, the field of possibilities opens up exponentially. Exciting times to be developing!

Inheritence of Wizardry

To make development easier still and take advantage of their offerings, there is an OpenZeppelin Contracts Wizard which lets you choose your own style of modularity, whether that is to mint, burn, vote, give a range of access permissions, you name it, it’s there! Note the import of ERC721 in the one below.

OpenZeppelin

So when we write a new contract, and we need to inherit the tried and tested qualities or characteristics, we simply import those contracts into our own, like inheriting those good qualities of our favourite relatives!

It’s very rare in the Ethereum smart contract development sphere to see a smart contract that doesn’t include at least one line of code stating import 'OpenZeppelin_something_or_other.sol';!

;