Solidity Tutorial: all about Libraries

Jean Cvllr
12 min readAug 1, 2019

Table of Contents

  1. What are Libraries in Solidity?
  2. How to create a library contract?
  3. How to deploy libraries?
  4. How to use a Library in a smart contract?
  5. How to interact with libraries?
  6. Understanding functions in libraries.
  7. Events and Libraries
  8. Mappings in Library = more functionalities !
  9. Using structs inside Libraries
  10. Linking libraries with other libraries
  11. Using modifier inside libraries
  12. What you can’t do with Libraries in Solidity?
  13. Some popular existing libraries


1. What are Libraries in Solidity?

Libraries can be seen as implicit base contracts of the contracts that use them (Solidity doc)

A library in Solidity is a different type of smart contract that contains reusable code. Once deployed on the blockchain (only once), it is assigned a specific address and its properties / methods can be reused many times by other contracts in the Ethereum network.