compute_deposit_data_root
Compute SSZ-style deposit data root for validator deposits
Compute the 32-byte deposit data root hash (SHA-256 SSZ hash tree root) for validator deposits. This value must be passed as the deposit_data_root parameter when calling deposit().
Signature
def compute_deposit_data_root(
*,
node_pubkey: bytes,
consensus_pubkey: bytes,
withdrawal_credentials: bytes,
node_signature: bytes,
consensus_signature: bytes,
amount_gwei: int,
) -> bytesAll parameters are keyword-only.
Parameters
node_pubkey
bytes
32
ED25519 public key for node identity
consensus_pubkey
bytes
48
BLS12-381 public key for consensus
node_signature
bytes
64
ED25519 signature over deposit data
consensus_signature
bytes
96
BLS12-381 signature over deposit data
amount_gwei
int
—
Deposit amount in gwei (e.g. 32 * 1000000000)
Returns
bytes — 32-byte deposit data root hash.
Raises ValueError if any byte-length parameter has the wrong size.
How It Works
The function computes the SSZ hash tree root, mirroring the on-chain verification in DepositContract.sol:
Where amount_le8 is the gwei value encoded as 8-byte little-endian, and pad_N extends data to chunk boundaries.
Example
See Also
make_withdrawal_credentials — Build the
withdrawal_credentialsinputDeposit Contract — ABI, address, and deposit requirements
deposit — Namespace method for making deposits
Last updated

