Skip to main content
Version: Next

testing_commitBlockV1

This method is a testing tool that combines block production and canonical head advancement into a single call. It is the writing equivalent of [`testing_buildBlockV1`](./testing_buildBlockV1.yaml): it produces the same block, but additionally inserts it into the chain and sets it as the new canonical head, skipping the `engine_newPayload` + `engine_forkchoiceUpdated` round-trip and the associated payload serialization overhead.

**Specification:** - The client MUST build a new execution payload on top of its current canonical head. - The client MUST use the provided `payloadAttributes` to define the context of the new block. - If the `transactions` parameter is an empty array `[]`, the client MUST build an empty block (no transactions). - If the `transactions` parameter is JSON `null`, the client MAY build a block from its local transaction pool (mempool). - If the `transactions` parameter is a non-empty array, the client MUST include all transactions from the array on the block's transaction list, in the order they were provided, and MUST NOT include any transactions from its local transaction pool. - If `extraData` is provided, the client MUST set the `extraData` field of the resulting block to this value. - On success, the client MUST insert the block into its database, set it as the canonical head, emit the same chain events it would for any new head, and return the new head's block hash. - If the block cannot be built or applied (for example, an unapplicable transaction), the client MUST return a JSON-RPC error and MUST NOT modify the canonical head.

**Security Considerations:** - This method is intended for testing environments ONLY and MUST NOT be exposed on public-facing RPC APIs. - It is strongly recommended that this method be disabled by default.

Builds a block from the provided parameters, inserts it into the chain, and sets it as the canonical head. This is a testing-only method for advancing a chain deterministically.

Parameters (by position)

Payload attributes object required

PayloadAttributesV3


Show Payload attributes object

Payload attributes fields

  • parentBeaconBlockRoot string

    32 byte hex value

    Match pattern: ^0x[0-9a-f]{64}$


  • prevRandao string

    32 byte hex value

    Match pattern: ^0x[0-9a-f]{64}$


  • suggestedFeeRecipient string

    hex encoded address

    Match pattern: ^0x[0-9a-fA-F]{40}$


  • timestamp string

    hex encoded unsigned integer

    Match pattern: ^0x(0|[1-9a-f][0-9a-f]*)$


  • withdrawals array<object>

    Validator withdrawal


    Show withdrawals object

    withdrawals fields

    • address string required

      recipient address for withdrawal value

      Match pattern: ^0x[0-9a-fA-F]{40}$


    • amount string required

      value contained in withdrawal

      Match pattern: ^0x(0|[1-9a-f][0-9a-f]{0,63})$


    • index string required

      index of withdrawal

      Match pattern: ^0x(0|[1-9a-f][0-9a-f]{0,15})$


    • validatorIndex string required

      index of validator that generated withdrawal

      Match pattern: ^0x(0|[1-9a-f][0-9a-f]{0,15})$


    • additionalProperties false


  • additionalProperties true


Transactions array<string> or null required

An array of raw, signed transactions (hex-encoded) to include in the committed block, or null.

  • If an empty array []: The client MUST build an empty block (no transactions).
  • If null: The client MAY build a block from its local transaction pool (mempool).
  • If a non-empty array: The client MUST include ALL transactions from this array in the resulting block, in the order provided, and MUST NOT include any transactions from its local mempool.

Show Option 1 Transactions array

Transactions fields

An array of raw, signed transactions (hex-encoded) to include in the committed block, or null.

  • If an empty array []: The client MUST build an empty block (no transactions).
  • If null: The client MAY build a block from its local transaction pool (mempool).
  • If a non-empty array: The client MUST include ALL transactions from this array in the resulting block, in the order provided, and MUST NOT include any transactions from its local mempool.

Transactions array<string> required

An array of raw, signed transactions (hex-encoded) to include in the committed block, or null.

  • If an empty array []: The client MUST build an empty block (no transactions).
  • If null: The client MAY build a block from its local transaction pool (mempool).
  • If a non-empty array: The client MUST include ALL transactions from this array in the resulting block, in the order provided, and MUST NOT include any transactions from its local mempool.

Match pattern: ^0x[0-9a-f]*$


Show Option 2 Transactions null

Transactions fields

An array of raw, signed transactions (hex-encoded) to include in the committed block, or null.

  • If an empty array []: The client MUST build an empty block (no transactions).
  • If null: The client MAY build a block from its local transaction pool (mempool).
  • If a non-empty array: The client MUST include ALL transactions from this array in the resulting block, in the order provided, and MUST NOT include any transactions from its local mempool.

Transactions null required

An array of raw, signed transactions (hex-encoded) to include in the committed block, or null.

  • If an empty array []: The client MUST build an empty block (no transactions).
  • If null: The client MAY build a block from its local transaction pool (mempool).
  • If a non-empty array: The client MUST include ALL transactions from this array in the resulting block, in the order provided, and MUST NOT include any transactions from its local mempool.

Extra data string or null

Data to be set as the extraData field of the committed block. If provided, the client MUST use this exact value.


Show Option 1 hex encoded bytes string

hex encoded bytes fields

Data to be set as the extraData field of the committed block. If provided, the client MUST use this exact value.

Extra data string

Data to be set as the extraData field of the committed block. If provided, the client MUST use this exact value.

Match pattern: ^0x[0-9a-f]*$


Show Option 2 Extra data null

Extra data fields

Data to be set as the extraData field of the committed block. If provided, the client MUST use this exact value.

Extra data null

Data to be set as the extraData field of the committed block. If provided, the client MUST use this exact value.


Result

Block hash string

Committed block hash

Match pattern: ^0x[0-9a-f]{64}$


Errors

Error code: -32602

  • code

    -32602

  • message

    Invalid parameters

Error code: -32603

  • code

    -32603

  • message

    Internal error

Examples

testing_commitBlockV1 example

Request

{
"params": [
{
"parentBeaconBlockRoot": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884365149a42212e8822",
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000",
"suggestedFeeRecipient": "0x0000000000000000000000000000000000000000",
"timestamp": "0x1ce",
"withdrawals": []
},
[],
null
]
}

Response

"0x1234567890123456789012345678901234567890123456789012345678901234"