Engine API changes introduced in Shanghai.
This structure maps onto the validator withdrawal object from the beacon chain spec. The fields are encoded as follows:
index
:QUANTITY
, 64 BitsvalidatorIndex
:QUANTITY
, 64 Bitsaddress
:DATA
, 20 Bytesamount
:QUANTITY
, 64 Bits
Note: the amount
value is represented on the beacon chain as a little-endian value in units of Gwei, whereas the
amount
in this structure MUST be converted to a big-endian value in units of Gwei.
This structure has the syntax of ExecutionPayloadV1
and appends a single field: withdrawals
.
parentHash
:DATA
, 32 BytesfeeRecipient
:DATA
, 20 BytesstateRoot
:DATA
, 32 BytesreceiptsRoot
:DATA
, 32 ByteslogsBloom
:DATA
, 256 BytesprevRandao
:DATA
, 32 BytesblockNumber
:QUANTITY
, 64 BitsgasLimit
:QUANTITY
, 64 BitsgasUsed
:QUANTITY
, 64 Bitstimestamp
:QUANTITY
, 64 BitsextraData
:DATA
, 0 to 32 BytesbaseFeePerGas
:QUANTITY
, 256 BitsblockHash
:DATA
, 32 Bytestransactions
:Array of DATA
- Array of transaction objects, each object is a byte list (DATA
) representingTransactionType || TransactionPayload
orLegacyTransaction
as defined in EIP-2718withdrawals
:Array of WithdrawalV1
- Array of withdrawals, each object is anOBJECT
containing the fields of aWithdrawalV1
structure.
This structure contains a body of an execution payload. The fields are encoded as follows:
transactions
:Array of DATA
- Array of transaction objects, each object is a byte list (DATA
) representingTransactionType || TransactionPayload
orLegacyTransaction
as defined in EIP-2718withdrawals
:Array of WithdrawalV1
- Array of withdrawals, each object is anOBJECT
containing the fields of aWithdrawalV1
structure.
This structure has the syntax of PayloadAttributesV1
and appends a single field: withdrawals
.
timestamp
:QUANTITY
, 64 Bits - value for thetimestamp
field of the new payloadprevRandao
:DATA
, 32 Bytes - value for theprevRandao
field of the new payloadsuggestedFeeRecipient
:DATA
, 20 Bytes - suggested value for thefeeRecipient
field of the new payloadwithdrawals
:Array of WithdrawalV1
- Array of withdrawals, each object is anOBJECT
containing the fields of aWithdrawalV1
structure.
- method:
engine_newPayloadV2
- params:
ExecutionPayloadV1
|ExecutionPayloadV2
, where:ExecutionPayloadV1
MUST be used if thetimestamp
value is lower than the Shanghai timestamp,ExecutionPayloadV2
MUST be used if thetimestamp
value is greater or equal to the Shanghai timestamp,- Client software MUST return
-32602: Invalid params
error if the wrong version of the structure is used in the method call.
- timeout: 8s
- result:
PayloadStatusV1
, values of thestatus
field are restricted in the following way:INVALID_BLOCK_HASH
status value is supplanted byINVALID
.
- error: code and message set in case an exception happens while processing the payload.
This method follows the same specification as engine_newPayloadV1
with the exception of the following:
- Client software MAY NOT validate terminal PoW block conditions during payload validation (point (2) in the Payload validation routine).
- Client software MUST return
{status: INVALID, latestValidHash: null, validationError: errorMessage | null}
if theblockHash
validation has failed. - Consensus layer client MUST call this method instead of
engine_newPayloadV1
iftimestamp
value of a payload is greater or equal to the Shanghai timestamp.
- method: "engine_forkchoiceUpdatedV2"
- params:
forkchoiceState
:Object
- instance ofForkchoiceStateV1
payloadAttributes
:Object|null
- instance ofPayloadAttributesV1
|PayloadAttributesV2
ornull
, where:PayloadAttributesV1
MUST be used to build a payload with thetimestamp
value lower than the Shanghai timestamp,PayloadAttributesV2
MUST be used to build a payload with thetimestamp
value greater or equal to the Shanghai timestamp,- Client software MUST return
-32602: Invalid params
error if the wrong version of the structure is used in the method call.
- timeout: 8s
Refer to the response for engine_forkchoiceUpdatedV1
.
This method follows the same specification as engine_forkchoiceUpdatedV1
with the exception of the following:
- Client software MAY NOT validate terminal PoW block conditions in the following places:
- during payload validation (point (2) in the Payload validation routine specification),
- when updating the forkchoice state (point (3) in the
engine_forkchoiceUpdatedV1
method specification).
- Consensus layer client MUST call this method instead of
engine_forkchoiceUpdatedV1
under any of the following conditions:headBlockHash
references a block whichtimestamp
is greater or equal to the Shanghai timestamp,payloadAttributes
is notnull
andpayloadAttributes.timestamp
is greater or equal to the Shanghai timestamp.
- method:
engine_getPayloadV2
- params:
payloadId
:DATA
, 8 Bytes - Identifier of the payload build process
- timeout: 1s
- result:
object
executionPayload
:ExecutionPayloadV1
|ExecutionPayloadV2
where:ExecutionPayloadV1
MUST be returned if the payloadtimestamp
is lower than the Shanghai timestampExecutionPayloadV2
MUST be returned if the payloadtimestamp
is greater or equal to the Shanghai timestamp
blockValue
:QUANTITY
, 256 Bits - The expected value to be received by thefeeRecipient
in wei
- error: code and message set in case an exception happens while getting the payload.
This method follows the same specification as engine_getPayloadV1
with the addition of the following:
- Client software SHOULD use the sum of the block's priority fees or any other algorithm to determine
blockValue
.
- method:
engine_getPayloadBodiesByHashV1
- params:
Array of DATA
, 32 Bytes - Array ofblock_hash
field values of theExecutionPayload
structure
- timeout: 10s
- result:
Array of ExecutionPayloadBodyV1
- Array ofExecutionPayloadBodyV1
objects. - error: code and message set in case an exception happens while processing the method call.
-
Given array of block hashes client software MUST respond with array of
ExecutionPayloadBodyV1
objects with the corresponding hashes respecting the order of block hashes in the input array. -
Client software MUST place responses in the order given in the request, using
null
for any missing blocks. For instance, if the request is[A.block_hash, B.block_hash, C.block_hash]
and client software has data of payloadsA
andC
, but doesn't have data ofB
, the response MUST be[A.body, null, C.body]
. -
Client software MUST support request sizes of at least 32 block hashes. The call MUST return
-38004: Too large request
error if the number of requested payload bodies is too large. -
Client software MAY NOT respond to requests for finalized blocks by hash.
-
Client software MUST set
withdrawals
field tonull
for bodies of pre-Shanghai blocks. -
This request maps to
BeaconBlocksByRoot
in the consensus layerp2p
specification. Callers must be careful to use the execution block hash, instead of the beacon block root. -
Callers must consider that syncing execution layer client may not serve any block bodies, including those that were supplied by
engine_newPayload
calls.
- method:
engine_getPayloadBodiesByRangeV1
- params:
start
:QUANTITY
, 64 bits - Starting block numbercount
:QUANTITY
, 64 bits - Number of blocks to return
- timeout: 10s
- result:
Array of ExecutionPayloadBodyV1
- Array ofExecutionPayloadBodyV1
objects. - error: code and message set in case an exception happens while processing the method call.
-
Given a
start
and acount
, the client software MUST respond with array ofExecutionPayloadBodyV1
objects with the corresponding execution block number respecting the order of blocks in the canonical chain, as selected by the latestengine_forkchoiceUpdated
call. -
Client software MUST support
count
values of at least 32 blocks. The call MUST return-38004: Too large request
error if the requested range is too large. -
Client software MUST return
-32602: Invalid params
error if eitherstart
orcount
value is less than1
. -
Client software MUST place
null
in the response array for unavailable blocks which numbers are lower than a number of the latest known block. Client software MUST NOT return trailingnull
values if the request extends past the current latest known block. Execution Layer client software is expected to download and carry the full block history until EIP-4444 or a similar proposal takes into effect. Consider the following response examples:[B1.body, B2.body, ..., Bn.body]
-- entire requested range is filled with block bodies,[null, null, B3.body, ..., Bn.body]
-- first two blocks are unavailable (either pruned or not yet downloaded),[null, null, ..., null]
-- requested range is behind the latest known block and all blocks are unavailable,[B1.body, B2.body, B3.body, B4.body]
--B4
is the latest known block and trailingnull
values are trimmed,[]
-- entire requested range is beyond the latest known block,[null, null, B3.body, B4.body]
-- first two blocks are unavailable,B4
is the latest known block.
-
Client software MUST set
withdrawals
field tonull
for bodies of pre-Shanghai blocks. -
This request maps to
BeaconBlocksByRange
in the consensus layerp2p
specification. -
Callers must be careful to not confuse
start
with a slot number, instead mapping the slot to a block number. Callers must also be careful to request non-finalized blocks by hash in order to avoid race conditions around the current view of the canonical chain. -
Callers must be careful to verify the hash of the received blocks when requesting non-finalized parts of the chain since the response is prone to being re-orged.
-
Callers must consider that syncing execution layer client may not serve any block bodies, including those that were supplied by
engine_newPayload
calls.