Libraries

Learn about Solidity libraries.

Solidity libraries are reusable components that contain functions that can be accessed by other contracts. Libraries, like contracts, are primarily intended for reuse. Solidity libraries are distinguished by certain requirements and features that ensure their proper use inside the Ethereum ecosystem.

Key features of Solidity libraries

Here are the key features of Solidity libraries:

  • Direct invocation of stateless functions: Library functions that don’t alter the system’s state can be directly invoked. Only pure or view functions from the library can be called externally.

  • Immutable and stateless nature: Libraries are considered stateless, and once deployed, they can’t be destroyed. Their immutability ensures consistency and reliability in their functionality. ...