This document specifies a subset of the Engine API methods that are required to be implemented for the Merge interop.
Note: Sync API design is yet a draft and considered optional for the interop.
This specification is based on Ethereum JSON-RPC API and inherits the following properties of this standard:
- Supported communication protocols (HTTP and WebSocket)
- Message format and encoding notation
- Error codes improvement proposal
Client software MUST expose Engine API at a port independent from JSON-RPC API. The default port for the Engine API is 8550 for HTTP and 8551 for WebSocket.
The list of error codes introduced by this specification can be found below.
Code | Possible Return message | Description |
---|---|---|
4 | Unknown header | Should be used when a call refers to an unknown header |
5 | Unknown payload | Should be used when the payloadId parameter of engine_getPayload call refers to a payload building process that is unavailable |
Fields having DATA
and QUANTITY
types MUST be encoded according to the HEX value encoding section of Ethereum JSON-RPC API.
Note: Byte order of encoded value having QUANTITY
type is big-endian.
This structure maps on the ExecutionPayload
structure of the beacon chain spec. The fields are encoded as follows:
parentHash
:DATA
, 32 Bytescoinbase
:DATA
, 20 BytesstateRoot
:DATA
, 32 BytesreceiptRoot
:DATA
, 32 ByteslogsBloom
:DATA
, 256 Bytesrandom
: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-2718
Object
- The payload attributes:
parentHash
:DATA
, 32 Bytes - hash of the parent blocktimestamp
:QUANTITY
, 64 Bits - value for thetimestamp
field of the new payloadrandom
:DATA
, 32 Bytes - value for therandom
field of the new payloadfeeRecipient
:DATA
, 20 Bytes - suggested value for thecoinbase
field of the new payload
Object|Error
- Either instance of response object or an error. Response object:
payloadId
:QUANTITY
, 64 Bits - Identifier of the payload building process
-
Given provided field value set client software SHOULD build the initial version of the payload which has an empty transaction set.
-
Client software SHOULD start the process of updating the payload. The strategy of this process is implementation dependent. The default strategy would be to keep the transaction set up-to-date with the state of local mempool.
-
Client software SHOULD stop the updating process either by finishing to serve the
engine_getPayload
call with the samepayloadId
value or whenSECONDS_PER_SLOT
(currently set to 12 in the Mainnet configuration) seconds have passed since the point in time identified by thetimestamp
parameter. -
Client software MUST set the payload field values according to the set of parameters passed in the call to this method with exception for the
feeRecipient
. Thecoinbase
field value MAY deviate from what is specified by thefeeRecipient
parameter. -
Client software SHOULD respond with
2: Action not allowed
error if the sync process is in progress. -
Client software SHOULD respond with
4: Unknown header
error if the parent block is unknown.
payloadId
:QUANTITY
, 64 Bits - Identifier of the payload building process
Object|Error
- Either instance of ExecutionPayload
or an error
-
Given the
payloadId
client software MUST respond with the most recent version of the payload that is available in the corresponding building process at the time of receiving the call. -
The call MUST be responded with
5: Unknown payload
error if the building process identified by thepayloadId
doesn't exist. -
Client software MAY stop the corresponding building process after serving this call.
Object
- Instance ofExecutionPayload
Object
- Response object:
status
:String
- the result of the payload execution:
VALID
- given payload is validINVALID
- given payload is invalidSYNCING
- sync process is in progress
-
Client software MUST validate the payload according to the execution environment rule set with modifications to this rule set defined in the Block Validity section of EIP-3675 and respond with the validation result.
-
Client software MUST defer persisting a valid payload until the corresponding
engine_consensusValidated
message deems the payload valid with respect to the proof-of-stake consensus rules. -
Client software MUST discard the payload if it's deemed invalid.
-
The call MUST be responded with
SYNCING
status while the sync process is in progress and thus the execution cannot yet be validated. -
In the case when the parent block is unknown, client software MUST pull the block from the network and take one of the following actions depending on the parent block properties:
- If the parent block is a PoW block as per EIP-3675 definition, then all missing dependencies of the payload MUST be pulled from the network and validated accordingly. The call MUST be responded according to the validity of the payload and the chain of its ancestors.
- If the parent block is a PoS block as per EIP-3675 definition, then the call MAY be responded with
SYNCING
status and sync process SHOULD be initiated accordingly.
Object
- Payload validity status with respect to the consensus rules:
blockHash
:DATA
, 32 Bytes - block hash value of the payloadstatus
:String: VALID|INVALID
- result of the payload validation with respect to the proof-of-stake consensus rules
None or an error
-
The call of this method with
VALID
status maps on thePOS_CONSENSUS_VALIDATED
event of EIP-3675 and MUST be processed according to the specification defined in the EIP. -
If the status in this call is
INVALID
the payload MUST be discarded disregarding its validity with respect to the execution environment rules. -
Client software MUST respond with
4: Unknown header
error if the payload identified by theblockHash
is unknown.
Object
- The state of the fork choice:
headBlockHash
:DATA
, 32 Bytes - block hash of the head of the canonical chainfinalizedBlockHash
:DATA
, 32 Bytes - block hash of the most recent finalized block
None or an error
-
This method call maps on the
POS_FORKCHOICE_UPDATED
event of EIP-3675 and MUST be processed according to the specification defined in the EIP. -
Client software MUST respond with
4: Unknown block
error if the payload identified by either theheadBlockHash
or thefinalizedBlockHash
is unknown.