hkdf
On-chain HKDF-SHA256 key derivation
Derive a 32-byte key with the HKDF precompile at 0x68.
Overview
hkdf() and async_hkdf() accept arbitrary input key material (ikm) and return a Bytes32 derived key.
Signature
def hkdf(
w3: Web3,
ikm: bytes,
) -> Bytes32
async def async_hkdf(
w3: AsyncWeb3,
ikm: bytes,
) -> Bytes32Parameters
Parameter
Type
Required
Description
w3
Web3 / AsyncWeb3
Yes
Connected Seismic client
ikm
bytes
Yes
Input key material
Returns
Type
Description
32-byte derived key
Examples
Basic Usage
Context Separation
Async Usage
Gas Cost
The SDK computes gas as:
Examples:
len(ikm)=0:6120len(ikm)=32:6144
Notes
Deterministic: the same
ikmalways produces the same output.Good for deriving protocol keys from shared secrets.
Not a password hashing function; use
argon2/bcryptfor password storage.
See Also
Last updated

