ethereum / web3.py

A python interface for interacting with the Ethereum blockchain and ecosystem.
http://web3py.readthedocs.io
MIT License
4.89k stars 1.67k forks source link

Add `blob_versioned_hashes` for EIP-4844 transactions in `transaction` dict #3392

Closed PatrickAlphaC closed 1 month ago

PatrickAlphaC commented 1 month ago

What feature should we add?

If you create the following:

    transaction = {
        "from": from_address,
        "to": to_address,
        "nonce": w3.eth.get_transaction_count(from_address),
        "type": "0x3",
        "blob_versioned_hashes": [
"0x99dc8862181785c55f63ea8006779f872f3a9ef0ad600250473719fb97a828aa53a99bcebadfacaa537ba5b4c8edb22d"
        ],
    }

signed = w3.eth.account.sign_transaction(transaction, private_key)

Attempting to sign this transaction will result in:

File "/xxx/rlp/sedes/serializable.py", line 51, in validate_args_and_kwargs
    raise TypeError(f"Unknown kwargs: {sorted(unknown_kwargs)}")
TypeError: Unknown kwargs: ['blob_versioned_hashes']

However, according to eip-4844 this should be a supported key in the transaction struct.

fselmo commented 1 month ago

@PatrickAlphaC blob_versioned_hashes mean nothing without blob data. It's used to communicate solely to the execution layer that blob data was sent and stored in the CL so the API is a bit different in that regard. Please refer to the blog post in your previous issue for how to send blob transactions and raise relevant issue in the eth-account repository if the API still doesn't seem to be working.

fselmo commented 1 month ago

if the API still doesn't seem to be working.

And also if you feel like there can be improvements!

fselmo commented 1 month ago

I don't believe this should have raised that particular error with "unkown kwarg", however. Make sure eth-account version includes the Cancun changes in there and that your web3 version supports it. But if you are experiencing any strange issues, the eth-account repository would be the best place to raise them.

PatrickAlphaC commented 1 month ago

I see, thanks!