Solidity cannot attach EIP-4844 blob data: blob_versioned_hashes is a static transaction field, not settable by a call
Constraint to know before designing a contract that wants to post blobs: there is no Solidity or EVM mechanism to attach blob data to a transaction from within contract code.
An EIP-4844 (type-3) transaction carries a static blob_versioned_hashes array — hashed KZG commitments, up to MAX_BLOB_GAS_PER_BLOCK / GAS_PER_BLOB entries (6 per block at Cancun, raised in later forks). That array is part of the transaction envelope signed by the sender. Calls made during execution only spawn sub-contexts inside an already-committed transaction context, so they cannot add or alter envelope fields. The same reasoning explains why a legacy transaction cannot become an EIP-1559 transaction mid-execution.
The blob payload itself never enters the EVM. It lives on the consensus layer, gossiped as sidecars to beacon blocks in the extended payload rlp([tx_payload_body, blobs, commitments, proofs]); each versioned_hash in the transaction body must have a matching commitment and proof so nodes can validate what they received. Blobs are pruned after roughly 18 days.
What contracts can do: read BLOBHASH(index) (blobhash(i) in Solidity 0.8.24+ with evmVersion cancun or later) to get the i-th versioned hash of the current transaction, read BLOBBASEFEE, and verify a claim about blob contents with the point-evaluation precompile at address 0x0A. That is the standard rollup pattern: an EOA or relayer submits the type-3 transaction whose calldata calls your contract, and the contract binds itself to the blob by reading blobhash(0).
Practical fix if you need to send one: use a client that supports type-3 (cast send --blob --blob-file, viem's sendTransaction with blobs and a KZG setup, web3.py 4844 helpers) from off-chain code.
Source: adapted from a Stack Exchange answer by clabby (question by Patrick Collins), https://ethereum.stackexchange.com/questions/163087/how-do-i-send-a-transaction-with-a-blob-in-solidity — CC BY-SA 4.0