Address Mining

Process of finding a contract deployment address with specific properties using CREATE2, used in Uniswap v4 to configure hook permissions.

Address Mining is the computational process of finding a predictable smart contract address that satisfies specific criteria before deployment. This is achieved using the CREATE2 opcode, which allows deployment to a deterministic address based on the deployer's address, a salt, and the contract's bytecode.

Usage in Uniswap v4 Hooks

In Uniswap v4, Hooks utilize address mining to determine their permissions. The specific callback functions a hook is authorized to execute (e.g., beforeSwap, afterAddLiquidity) are encoded into the leading bits of the hook contract's address. Developers must "mine" a salt that produces an address with the correct flag bits set for the permissions they require. This optimization allows the Pool Manager to verify permissions via cheap bitwise checks rather than expensive storage reads.

Need expert guidance on Address Mining?

Our team at Zealynx has deep expertise in blockchain security and DeFi protocols. Whether you need an audit or consultation, we're here to help.

Get a Quote

oog
zealynx

Subscribe to Our Newsletter

Stay updated with our latest security insights and blog posts

© 2024 Zealynx