Skip to main content
The HookStoreTransaction enables efficient, low-overhead management of an EVM Hook’s persistent storage. This transaction allows hook owners to add, update, or remove key/value pairs in the hook’s storage without executing the hook’s bytecode—significantly more cost-effective and faster than using a ContractCall.

Transaction Properties


When to Use This Transaction

Use HookStoreTransaction when you need to:
  • Initialize storage slots on a newly created hook
  • Update configuration variables (e.g., whitelist, passcode hash) in an existing hook’s storage
  • Delete storage entries by setting their value to an empty byte array

Transaction Signing Requirements

The signing requirements depend on if an adminKey was set when the hook was created:
  • If the hook has an adminKey: Either the Admin Key OR the hook owner (account or contract that owns the hook) must sign the transaction
  • If the hook does NOT have an adminKey: The hook owner (account or contract that owns the hook) must sign the transaction
  • In all cases: The account paying the transaction fee must also sign

Methods

EvmHookStorageUpdate is an abstract class with two concrete implementations: EvmHookStorageSlot for direct slot updates and EvmHookMappingEntries for updating entries within a Solidity mapping. See Create and Manage Hooks for full property details on both types.

Examples

Example 1: Updating a Hook’s Storage Slot

This example demonstrates how to update a single storage slot on a hook with ID 1002 owned by accountId.

Example 2: Updating a Solidity Mapping Entry

This example demonstrates how to update an entry within a Solidity mapping stored in the hook’s storage. This requires calculating the storage slot key based on the mapping key and the mapping’s storage slot.