keymake_withdrawal_credentials

Build 32-byte ETH1 withdrawal credentials from an address

Build 32-byte ETH1 withdrawal credentials from an Ethereum address. The returned value is passed as withdrawal_credentials when calling compute_deposit_data_root and the deposit contract's deposit() function.

Signature

def make_withdrawal_credentials(address: str) -> bytes

Parameters

Parameter
Type
Description

address

str

Hex-encoded Ethereum address (with or without 0x prefix)

Returns

bytes — 32-byte withdrawal credentials.

Raises ValueError if the decoded address is not exactly 20 bytes.

Output Format

┌──────┬──────────────┬──────────────────────┐
│ 0x01 │ 11 zero bytes│ 20-byte address      │
└──────┴──────────────┴──────────────────────┘
 1 byte  11 bytes       20 bytes = 32 total
  • 0x01 — ETH1-style withdrawal credential type byte

  • 11 zero bytes — reserved padding

  • 20-byte address — the Ethereum address that can withdraw funds

Example

Notes

  • Accepts addresses with or without 0x/0X prefix

  • Case-insensitive — both checksummed and lowercase addresses produce the same result

  • This function only creates ETH1 credentials (type 0x01), not BLS credentials (type 0x00)

See Also

Last updated