Submitting a Block to Ethereum
Rollup blocks are submitted to the host chain by calling the Zenith submitBlock
function, attaching transaction data in a 4844 blob.
Code Flows
These examples assume one has already chosen a set of transactions and bundles , and gotten a co-signature from the Sequencer API .
The builder example has a submission process without host fills that can be referenced for blob construction.
For blocks with host fill components, builders should use a multi-call contract to do the following:
- Call
submitBlockas described below - Pass each permit2 blob to the Passage contract’s
fillPermit2method
Creating the Blob Transaction
Transform the
SignResponseinto aZenith::BlockHeader.1let header = Zenith::BlockHeader { 2 hostBlockNumber: resp.req.host_block_number, 3 rollupChainId: U256::from(self.config.ru_chain_id), 4 gasLimit: resp.req.gas_limit, 5 rewardAddress: resp.req.ru_reward_address, 6 blockDataHash: in_progress.contents_hash(), 7};Encode the
submitBlocktransaction data from theBlockHeader& the Sequencer’sSignaturefrom theSignResponselet data = Zenith::submitBlockCall { header, v, r, s, _4: Default::default() }.abi_encode();The final unnamedbytesparameter should be an empty bytes stringEncode the transactions into a 4844 blob sidecar containing the rlp-encoded transactions.
1pub fn encode_blob(&self) -> SidecarBuilder<SimpleCoder> { 2 let mut coder = SidecarBuilder::default(); 3 coder.ingest(self.encode_raw()); 4 coder 5}Signet blobs use the alloySimpleCoderblob encoding scheme. This may change in the future.Attach the blob sidecar to a
TransactionRequest.let tx = TransactionRequest::default().with_blob_sidecar(sidecar).with_input(data);Fill in remaining transaction details (including the calldata, which must contain the encoded
submitBlockCallabove).If using a multi-call contract, the input to the multi-call must send the encodedsubmitBlockCallto theZenithcontract.Submit the constructed transaction to Ethereum.
It is CRITICALLY IMPORTANT to use a private transaction relay to submit blocks coupled with fills. Leaking fill transactions or signed permit2 fills may result in loss of building privileges.