Skip to content

eth/eth_constants.hpp

Namespaces

Name
eth

Attributes

Name
size_t kAbiWordSize
EVM ABI encoding constants (ABI spec: https://docs.soliditylang.org/en/latest/abi-spec.html).
size_t kAbiAddressSize
Ethereum address is 20 bytes.
size_t kAbiAddressPadding
12 bytes of left-padding
size_t kAbiBoolByteIndex
Canonical bool lives in rightmost byte (index 31).
uint8_t kRlpListPrefixMin
EVM / RLP encoding thresholds.
size_t kTypedTxPrefixSize
EIP-2718 typed transaction envelope.
uint64_t kDefaultChainId
Default chain ID used when none is specified (Ethereum mainnet).
size_t kKeccak256Size
Keccak-256 digest size (bytes).

Attributes Documentation

variable kAbiWordSize

static size_t kAbiWordSize = 32;

EVM ABI encoding constants (ABI spec: https://docs.soliditylang.org/en/latest/abi-spec.html).

Every ABI head/tail slot is 32 bytes

variable kAbiAddressSize

static size_t kAbiAddressSize = 20;

Ethereum address is 20 bytes.

variable kAbiAddressPadding

static size_t kAbiAddressPadding = kAbiWordSize - kAbiAddressSize;

12 bytes of left-padding

variable kAbiBoolByteIndex

static size_t kAbiBoolByteIndex = kAbiWordSize - 1;

Canonical bool lives in rightmost byte (index 31).

variable kRlpListPrefixMin

static uint8_t kRlpListPrefixMin = 0xC0U;

EVM / RLP encoding thresholds.

First byte >= 0xC0 signals an RLP list

variable kTypedTxPrefixSize

static size_t kTypedTxPrefixSize = 1;

EIP-2718 typed transaction envelope.

One type-byte precedes the RLP payload

variable kDefaultChainId

static uint64_t kDefaultChainId = 1ULL;

Default chain ID used when none is specified (Ethereum mainnet).

variable kKeccak256Size

static size_t kKeccak256Size = 32;

Keccak-256 digest size (bytes).

Source code

// Copyright 2025 GeniusVentures
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <cstddef>
#include <cstdint>

namespace eth {

static constexpr size_t  kAbiWordSize            = 32;   
static constexpr size_t  kAbiAddressSize         = 20;   
static constexpr size_t  kAbiAddressPadding      = kAbiWordSize - kAbiAddressSize; 
static constexpr size_t  kAbiBoolByteIndex       = kAbiWordSize - 1; 

static constexpr uint8_t  kRlpListPrefixMin       = 0xC0U; 

static constexpr size_t  kTypedTxPrefixSize       = 1;    

static constexpr uint64_t kDefaultChainId         = 1ULL;

static constexpr size_t  kKeccak256Size           = 32;

} // namespace eth

Updated on 2026-04-13 at 23:22:46 -0700