GLMR Price: $0.021407 (-3.22%)

Contract

0xB10CDEC0DE69c88a47c280a97A5AEcA8b0b83385

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo0 GLMR

GLMR Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Submit_block_hea...114674402025-06-26 10:12:24212 days ago1750932744IN
Curve: Header Verifier
0 GLMR0.01592131.25

Latest 1 internal transaction

Parent Transaction Hash Block From To
114540032025-06-25 11:29:30213 days ago1750850970  Contract Creation0 GLMR
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Block Header Verifier

Compiler Version
vyper:0.4.3

Optimization Enabled:
Yes

Other Settings:
paris EvmVersion, None license

Contract Source Code (Vyper Json-Input format)

File 1 of 2 : HeaderVerifier.vy
# pragma version 0.4.3
# pragma optimize gas

"""
@title Block Header Verifier

@notice Simple contract that makes use of rlp header decoder module and forwards
        decoded headers to an oracle contract. No security checks or logs.

@license Copyright (c) Curve.Fi, 2025 - all rights reserved

@author curve.fi

@custom:security [email protected]
"""

################################################################
#                          INTERFACES                          #
################################################################

interface IBlockOracle:
    def submit_block_header(block_header: bh_rlp.BlockHeader): nonpayable

################################################################
#                            MODULES                           #
################################################################

# Import RLP Block Header Decoder
from modules import BlockHeaderRLPDecoder as bh_rlp

exports: (bh_rlp.decode_block_header,)

################################################################
#                 PERMISSIONLESS FUNCTIONS                     #
################################################################

@external
def submit_block_header(_oracle_address: address, _encoded_header: Bytes[bh_rlp.BLOCK_HEADER_SIZE]):
    """
    @notice Submit a block header. If it's correct and blockhash is applied, store it.
    @param _oracle_address The address of the oracle contract
    @param _encoded_header The block header to submit
    """
    # Decode whatever is submitted
    decoded_header: bh_rlp.BlockHeader = bh_rlp._decode_block_header(_encoded_header)

    # Submit decoded header to oracle
    extcall IBlockOracle(_oracle_address).submit_block_header(decoded_header)

File 2 of 2 : BlockHeaderRLPDecoder.vy
# pragma version 0.4.3

"""
@title Block Header RLP Decoder Vyper Module
@author curve.fi
@license Copyright (c) Curve.Fi, 2025 - all rights reserved
@notice Decodes RLP-encoded Ethereum block header and stores key fields
@dev Extracts block number from RLP and uses it as storage key
"""

################################################################
#                           CONSTANTS                          #
################################################################
# Block header size upper limit
BLOCK_HEADER_SIZE: constant(uint256) = 1024

# RLP decoding constants
RLP_SHORT_START: constant(uint256) = 128  # 0x80
RLP_LONG_START: constant(uint256) = 183  # 0xb7
RLP_LIST_SHORT_START: constant(uint256) = 192  # 0xc0
RLP_LIST_LONG_START: constant(uint256) = 247  # 0xf7


################################################################
#                           STRUCTS                            #
################################################################

struct BlockHeader:
    block_hash: bytes32
    parent_hash: bytes32
    state_root: bytes32
    receipt_root: bytes32
    block_number: uint256
    timestamp: uint256

################################################################
#                         CONSTRUCTOR                          #
################################################################

@deploy
def __init__():
    pass


################################################################
#                      EXTERNAL FUNCTIONS                      #
################################################################
# can be exposed optionally, or used in testing
@pure
@external
def calculate_block_hash(encoded_header: Bytes[BLOCK_HEADER_SIZE]) -> bytes32:
    """
    @notice Calculates block hash from RLP encoded header
    @param encoded_header RLP encoded header data
    @return Block hash
    """
    return keccak256(encoded_header)


@pure
@external
def decode_block_header(encoded_header: Bytes[BLOCK_HEADER_SIZE]) -> BlockHeader:
    """
    @notice Decodes RLP encoded block header into BlockHeader struct
    @param encoded_header RLP encoded header data
    @return BlockHeader struct containing decoded block data
    """
    return self._decode_block_header(encoded_header)


################################################################
#                      CORE FUNCTIONS                          #
################################################################

@pure
@internal
def _decode_block_header(encoded_header: Bytes[BLOCK_HEADER_SIZE]) -> BlockHeader:
    """
    @notice Decodes key fields from RLP-encoded Ethereum block header
    @dev RLP encoding rules:
         - Single byte values (< 0x80) are encoded as themselves
         - Short strings (length < 56) start with 0x80 + length
         - Long strings (length >= 56) start with 0xb7 + length_of_length, followed by length
         - Lists follow similar rules but with 0xc0 and 0xf7 as starting points
         Makes use of utility functions to parse the RLP encoded header,
         and passes entire header to them which is not optimal in terms of gas, but
         makes code more readable.
    @param encoded_header RLP encoded block header
    @return BlockHeader(block_hash, parent_hash, state_root, block_number, timestamp)
    """

    # Placeholder variables
    tmp_int: uint256 = 0
    tmp_bytes: bytes32 = empty(bytes32)

    # Current position in the encoded header
    current_pos: uint256 = 0

    # 1. Skip RLP list length
    current_pos = self._skip_rlp_list_header(encoded_header, current_pos)

    # 2. Extract hashes
    parent_hash: bytes32 = empty(bytes32)
    parent_hash, current_pos = self._read_hash32(encoded_header, current_pos)  # parent hash
    tmp_bytes, current_pos = self._read_hash32(encoded_header, current_pos)  # skip uncle hash

    # 3. Skip miner address (20 bytes + 0x94)
    assert convert(slice(encoded_header, current_pos, 1), bytes1) == 0x94
    current_pos += 21

    # 4. Read state root
    state_root: bytes32 = empty(bytes32)
    state_root, current_pos = self._read_hash32(encoded_header, current_pos)

    # 5. Skip transaction root
    tmp_bytes, current_pos = self._read_hash32(encoded_header, current_pos)  # skip tx root

    # 6. Read receipt root
    receipt_root: bytes32 = empty(bytes32)
    receipt_root, current_pos = self._read_hash32(encoded_header, current_pos)

    # 7. Skip logs bloom
    current_pos = self._skip_rlp_string(encoded_header, current_pos)

    # 8. Skip difficulty
    tmp_int, current_pos = self._read_rlp_number(encoded_header, current_pos)

    # 9. Read block number
    block_number: uint256 = 0
    block_number, current_pos = self._read_rlp_number(encoded_header, current_pos)

    # 10. Skip gas fields
    tmp_int, current_pos = self._read_rlp_number(encoded_header, current_pos)  # skip gas limit
    tmp_int, current_pos = self._read_rlp_number(encoded_header, current_pos)  # skip gas used

    # 11. Read timestamp
    timestamp: uint256 = 0
    timestamp, current_pos = self._read_rlp_number(encoded_header, current_pos)

    return BlockHeader(
        block_hash=keccak256(encoded_header),
        parent_hash=parent_hash,
        state_root=state_root,
        receipt_root=receipt_root,
        block_number=block_number,
        timestamp=timestamp,
    )


################################################################
#                      UTILITY FUNCTIONS                       #
################################################################

@pure
@internal
def _skip_rlp_list_header(encoded: Bytes[BLOCK_HEADER_SIZE], pos: uint256) -> uint256:
    """@dev Returns position after list header"""
    first_byte: uint256 = convert(slice(encoded, 0, 1), uint256)
    assert first_byte >= RLP_LIST_SHORT_START, "Not a list"
    if first_byte <= RLP_LIST_LONG_START:
        return pos + 1
    else:
        return pos + 1 + (first_byte - RLP_LIST_LONG_START)


@pure
@internal
def _skip_rlp_string(encoded: Bytes[BLOCK_HEADER_SIZE], pos: uint256) -> uint256:
    """@dev Skip RLP string field, returns next_pos"""
    prefix: uint256 = convert(slice(encoded, pos, 1), uint256)
    if prefix < RLP_SHORT_START:
        return pos + 1
    elif prefix <= RLP_LONG_START:
        return pos + 1 + (prefix - RLP_SHORT_START)
    else:
        # Sanity check: ensure this is a string, not a list
        assert prefix < RLP_LIST_SHORT_START, "Expected string, found list prefix"

        len_of_len: uint256 = prefix - RLP_LONG_START
        data_length: uint256 = convert(
            abi_decode(abi_encode(slice(encoded, pos + 1, len_of_len)), (Bytes[32])), uint256
        )
        return pos + 1 + len_of_len + data_length


@pure
@internal
def _read_hash32(encoded: Bytes[BLOCK_HEADER_SIZE], pos: uint256) -> (bytes32, uint256):
    """@dev Read 32-byte hash field, returns (hash, next_pos)"""
    assert convert(slice(encoded, pos, 1), uint256) == 160  # RLP_SHORT_START + 32
    return extract32(encoded, pos + 1), pos + 33


@pure
@internal
def _read_rlp_number(encoded: Bytes[BLOCK_HEADER_SIZE], pos: uint256) -> (uint256, uint256):
    """@dev Read RLP-encoded number, returns (value, next_pos)"""
    prefix: uint256 = convert(slice(encoded, pos, 1), uint256)
    if prefix < RLP_SHORT_START:
        return prefix, pos + 1

    # Sanity check: ensure this is a short string (not a long string or list)
    assert prefix <= RLP_LONG_START, "Invalid RLP number encoding"

    length: uint256 = prefix - RLP_SHORT_START
    value: uint256 = convert(
        abi_decode(abi_encode(slice(encoded, pos + 1, length)), (Bytes[32])), uint256
    )
    # abi_decode(abi_encode(bytesA), bytesB) is needed to unsafe cast bytesA to bytesB
    return value, pos + 1 + length

Settings
{
  "outputSelection": {
    "0/1/contracts/HeaderVerifier.vy": [
      "evm.bytecode",
      "evm.deployedBytecode",
      "abi"
    ]
  },
  "search_paths": [
    "0/1/contracts",
    "0/1",
    "."
  ],
  "evmVersion": "paris"
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"name":"encoded_header","type":"bytes"}],"name":"decode_block_header","outputs":[{"components":[{"name":"block_hash","type":"bytes32"},{"name":"parent_hash","type":"bytes32"},{"name":"state_root","type":"bytes32"},{"name":"receipt_root","type":"bytes32"},{"name":"block_number","type":"uint256"},{"name":"timestamp","type":"uint256"}],"name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"name":"_oracle_address","type":"address"},{"name":"_encoded_header","type":"bytes"}],"name":"submit_block_header","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610ca461001161000039610ca4610000f360003560e01c60026001821660011b610ca001601e39600051565b6360873c86811861017c57602436103417610c9b5760043560040180356104008111610c9b57506020813501808261134037505060c06020611340510180610da08261134060045afa15610c9b575061007461176061084c565b611760f35b6380597bc3811861017c57604436103417610c9b576004358060a01c610c9b576113405260243560040180356104008111610c9b5750602081350180826113603750506020611360510180610da08261136060045afa15610c9b57506100e061184061084c565b61184080516117805260208101516117a05260408101516117c05260608101516117e05260808101516118005260a0810151611820525061134051636afd03656118405261178051611860526117a051611880526117c0516118a0526117e0516118c052611800516118e0526118205161190052803b15610c9b57600061184060c461185c6000855af1610179573d600060003e3d6000fd5b50005b60006000fd5b60405115610c9b576060516104c05260016104a0526104a06020810151815160200360031b1c90506104805260c061048051101561023c5760208061050052600a6104a0527f4e6f742061206c697374000000000000000000000000000000000000000000006104c0526104a0816105000181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506308c379a06104e052806004016104fcfd5b60f7610480511115610280576104605160018101818110610c9b5790506104805160f78103818111610c9b579050808201828110610c9b5790509050815250610295565b6104605160018101818110610c9b5790508152505b565b60a06104605160018101604051811182821017610c9b57508060600180516104a0525060016104805261048090506020810151815160200360031b1c905018610c9b576104605160018101818110610c9b5790506020604051038113157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82131615610c9b578060600151905081526104605160218101818110610c9b579050602082015250565b6104605160018101604051811182821017610c9b57508060600180516104c0525060016104a0526104a090506020810151815160200360031b1c905061048052607f6104805111156105e45760b76104805111156105ac5760bf61048051111561044b576020806105205260226104a0527f457870656374656420737472696e672c20666f756e64206c69737420707265666104c0527f69780000000000000000000000000000000000000000000000000000000000006104e0526104a0816105200160428160428460045afa15610c9b578051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506308c379a0610500528060040161051cfd5b6104805160b78103818111610c9b5790506104a052602080610920526104605160018101818110610c9b5790506104a051808201604051811183821017610c9b57508160600181610500838360045afa15610c9b5750806104e0526104e090509050816109200160208251018082828560045afa15610c9b57508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905061090052610900805160618110601f82111615610c9b575060208101815160208301016020820111610c9b57808151820110610c9b57805181018051835160208501018251602001830111610c9b5760208111610c9b57508051610d60526020810151610d80525050610d6090506020810151815160200360031b1c90506104c0526104605160018101818110610c9b5790506104a051808201828110610c9b57905090506104c051808201828110610c9b57905090508152506105f9565b6104605160018101818110610c9b5790506104805160808103818111610c9b579050808201828110610c9b57905090508152506105f9565b6104605160018101818110610c9b5790508152505b565b6104605160018101604051811182821017610c9b57508060600180516104c0525060016104a0526104a090506020810151815160200360031b1c905061048052607f6104805111610668576104805181526104605160018101818110610c9b57905060208201525061084a565b60b76104805111156106f65760208061050052601b6104a0527f496e76616c696420524c50206e756d62657220656e636f64696e6700000000006104c0526104a0816105000181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506308c379a06104e052806004016104fcfd5b6104805160808103818111610c9b5790506104a052602080610920526104605160018101818110610c9b5790506104a051808201604051811183821017610c9b57508160600181610500838360045afa15610c9b5750806104e0526104e090509050816109200160208251018082828560045afa15610c9b57508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905061090052610900805160618110601f82111615610c9b575060208101815160208301016020820111610c9b57808151820110610c9b57805181018051835160208501018251602001830111610c9b5760208111610c9b57508051610d60526020810151610d80525050610d6090506020810151815160200360031b1c90506104c0526104c05181526104605160018101818110610c9b5790506104a051808201828110610c9b57905090506020820152505b565b6060366111c0376020610da0510180604082610da060045afa15610c9b5750611200516104605261087e611220610182565b61122051611200526000611220526020610da0510180604082610da060045afa15610c9b575061120051610460526108b7611240610297565b61124080516112805260208101516112a0525061128051611220526112a051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610905611240610297565b61124080516112805260208101516112a05250611280516111e0526112a051611200527f94000000000000000000000000000000000000000000000000000000000000006112005160018101610da051811182821017610c9b575080610dc001805161126052506001611240526112409050805160200360031b6020820151811c811b9050905018610c9b576112005160158101818110610c9b579050611200526000611240526020610da0510180604082610da060045afa15610c9b575061120051610460526109d7611260610297565b61126080516112a05260208101516112c052506112a051611240526112c051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610a25611260610297565b61126080516112a05260208101516112c052506112a0516111e0526112c051611200526000611260526020610da0510180604082610da060045afa15610c9b57506112005161046052610a79611280610297565b61128080516112c05260208101516112e052506112c051611260526112e051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610ac761128061033f565b61128051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610afa6112806105fb565b61128080516112c05260208101516112e052506112c0516111c0526112e051611200526000611280526020610da0510180604082610da060045afa15610c9b57506112005161046052610b4e6112a06105fb565b6112a080516112e052602081015161130052506112e0516112805261130051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610b9c6112a06105fb565b6112a080516112e052602081015161130052506112e0516111c05261130051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610bea6112a06105fb565b6112a080516112e052602081015161130052506112e0516111c052611300516112005260006112a0526020610da0510180604082610da060045afa15610c9b57506112005161046052610c3e6112c06105fb565b6112c080516113005260208101516113205250611300516112a0526113205161120052610da051610dc02081526112205160208201526112405160408201526112605160608201526112805160808201526112a05160a082015250565b600080fd001a0079855820bb37085018c4570a2c9a2ee5ae36164b8a0712544bf5e8a534a12d717f9d7d0d190ca4810400a1657679706572830004030036

Deployed Bytecode

0x60003560e01c60026001821660011b610ca001601e39600051565b6360873c86811861017c57602436103417610c9b5760043560040180356104008111610c9b57506020813501808261134037505060c06020611340510180610da08261134060045afa15610c9b575061007461176061084c565b611760f35b6380597bc3811861017c57604436103417610c9b576004358060a01c610c9b576113405260243560040180356104008111610c9b5750602081350180826113603750506020611360510180610da08261136060045afa15610c9b57506100e061184061084c565b61184080516117805260208101516117a05260408101516117c05260608101516117e05260808101516118005260a0810151611820525061134051636afd03656118405261178051611860526117a051611880526117c0516118a0526117e0516118c052611800516118e0526118205161190052803b15610c9b57600061184060c461185c6000855af1610179573d600060003e3d6000fd5b50005b60006000fd5b60405115610c9b576060516104c05260016104a0526104a06020810151815160200360031b1c90506104805260c061048051101561023c5760208061050052600a6104a0527f4e6f742061206c697374000000000000000000000000000000000000000000006104c0526104a0816105000181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506308c379a06104e052806004016104fcfd5b60f7610480511115610280576104605160018101818110610c9b5790506104805160f78103818111610c9b579050808201828110610c9b5790509050815250610295565b6104605160018101818110610c9b5790508152505b565b60a06104605160018101604051811182821017610c9b57508060600180516104a0525060016104805261048090506020810151815160200360031b1c905018610c9b576104605160018101818110610c9b5790506020604051038113157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82131615610c9b578060600151905081526104605160218101818110610c9b579050602082015250565b6104605160018101604051811182821017610c9b57508060600180516104c0525060016104a0526104a090506020810151815160200360031b1c905061048052607f6104805111156105e45760b76104805111156105ac5760bf61048051111561044b576020806105205260226104a0527f457870656374656420737472696e672c20666f756e64206c69737420707265666104c0527f69780000000000000000000000000000000000000000000000000000000000006104e0526104a0816105200160428160428460045afa15610c9b578051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506308c379a0610500528060040161051cfd5b6104805160b78103818111610c9b5790506104a052602080610920526104605160018101818110610c9b5790506104a051808201604051811183821017610c9b57508160600181610500838360045afa15610c9b5750806104e0526104e090509050816109200160208251018082828560045afa15610c9b57508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905061090052610900805160618110601f82111615610c9b575060208101815160208301016020820111610c9b57808151820110610c9b57805181018051835160208501018251602001830111610c9b5760208111610c9b57508051610d60526020810151610d80525050610d6090506020810151815160200360031b1c90506104c0526104605160018101818110610c9b5790506104a051808201828110610c9b57905090506104c051808201828110610c9b57905090508152506105f9565b6104605160018101818110610c9b5790506104805160808103818111610c9b579050808201828110610c9b57905090508152506105f9565b6104605160018101818110610c9b5790508152505b565b6104605160018101604051811182821017610c9b57508060600180516104c0525060016104a0526104a090506020810151815160200360031b1c905061048052607f6104805111610668576104805181526104605160018101818110610c9b57905060208201525061084a565b60b76104805111156106f65760208061050052601b6104a0527f496e76616c696420524c50206e756d62657220656e636f64696e6700000000006104c0526104a0816105000181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506308c379a06104e052806004016104fcfd5b6104805160808103818111610c9b5790506104a052602080610920526104605160018101818110610c9b5790506104a051808201604051811183821017610c9b57508160600181610500838360045afa15610c9b5750806104e0526104e090509050816109200160208251018082828560045afa15610c9b57508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905061090052610900805160618110601f82111615610c9b575060208101815160208301016020820111610c9b57808151820110610c9b57805181018051835160208501018251602001830111610c9b5760208111610c9b57508051610d60526020810151610d80525050610d6090506020810151815160200360031b1c90506104c0526104c05181526104605160018101818110610c9b5790506104a051808201828110610c9b57905090506020820152505b565b6060366111c0376020610da0510180604082610da060045afa15610c9b5750611200516104605261087e611220610182565b61122051611200526000611220526020610da0510180604082610da060045afa15610c9b575061120051610460526108b7611240610297565b61124080516112805260208101516112a0525061128051611220526112a051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610905611240610297565b61124080516112805260208101516112a05250611280516111e0526112a051611200527f94000000000000000000000000000000000000000000000000000000000000006112005160018101610da051811182821017610c9b575080610dc001805161126052506001611240526112409050805160200360031b6020820151811c811b9050905018610c9b576112005160158101818110610c9b579050611200526000611240526020610da0510180604082610da060045afa15610c9b575061120051610460526109d7611260610297565b61126080516112a05260208101516112c052506112a051611240526112c051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610a25611260610297565b61126080516112a05260208101516112c052506112a0516111e0526112c051611200526000611260526020610da0510180604082610da060045afa15610c9b57506112005161046052610a79611280610297565b61128080516112c05260208101516112e052506112c051611260526112e051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610ac761128061033f565b61128051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610afa6112806105fb565b61128080516112c05260208101516112e052506112c0516111c0526112e051611200526000611280526020610da0510180604082610da060045afa15610c9b57506112005161046052610b4e6112a06105fb565b6112a080516112e052602081015161130052506112e0516112805261130051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610b9c6112a06105fb565b6112a080516112e052602081015161130052506112e0516111c05261130051611200526020610da0510180604082610da060045afa15610c9b57506112005161046052610bea6112a06105fb565b6112a080516112e052602081015161130052506112e0516111c052611300516112005260006112a0526020610da0510180604082610da060045afa15610c9b57506112005161046052610c3e6112c06105fb565b6112c080516113005260208101516113205250611300516112a0526113205161120052610da051610dc02081526112205160208201526112405160408201526112605160608201526112805160808201526112a05160a082015250565b600080fd001a0079

Block Transaction Gas Used Reward
view all blocks collator

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.