ethereumjs-monorepo

@ethereumjs/tx / BlobEIP4844Transaction

Class: BlobEIP4844Transaction

Typed transaction with a new gas fee market mechanism for transactions that include “blobs” of data

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new BlobEIP4844Transaction(txData, opts?)

This constructor takes the values, validates them, assigns them and freezes the object.

It is not recommended to use this constructor directly. Instead use the static constructors or factory methods to assist in creating a Transaction object from varying data types.

Parameters

Name Type
txData BlobEIP4844TxData
opts TxOptions

Overrides

BaseTransaction<TransactionType.BlobEIP4844\>.constructor

Defined in

tx/src/eip4844Transaction.ts:104

Properties

AccessListJSON

Readonly AccessListJSON: AccessList

Defined in

tx/src/eip4844Transaction.ts:86


accessList

Readonly accessList: AccessListBytes

Defined in

tx/src/eip4844Transaction.ts:85


blobVersionedHashes

blobVersionedHashes: Uint8Array[]

Defined in

tx/src/eip4844Transaction.ts:92


blobs

Optional blobs: Uint8Array[]

Defined in

tx/src/eip4844Transaction.ts:93


cache

cache: TransactionCache

Inherited from

BaseTransaction.cache

Defined in

tx/src/baseTransaction.ts:54


chainId

Readonly chainId: bigint

Defined in

tx/src/eip4844Transaction.ts:84


common

Readonly common: Common

Overrides

BaseTransaction.common

Defined in

tx/src/eip4844Transaction.ts:91


data

Readonly data: Uint8Array

Inherited from

BaseTransaction.data

Defined in

tx/src/baseTransaction.ts:46


gasLimit

Readonly gasLimit: bigint

Inherited from

BaseTransaction.gasLimit

Defined in

tx/src/baseTransaction.ts:43


kzgCommitments

Optional kzgCommitments: Uint8Array[]

Defined in

tx/src/eip4844Transaction.ts:94


kzgProofs

Optional kzgProofs: Uint8Array[]

Defined in

tx/src/eip4844Transaction.ts:95


maxFeePerBlobGas

Readonly maxFeePerBlobGas: bigint

Defined in

tx/src/eip4844Transaction.ts:89


maxFeePerGas

Readonly maxFeePerGas: bigint

Defined in

tx/src/eip4844Transaction.ts:88


maxPriorityFeePerGas

Readonly maxPriorityFeePerGas: bigint

Defined in

tx/src/eip4844Transaction.ts:87


nonce

Readonly nonce: bigint

Inherited from

BaseTransaction.nonce

Defined in

tx/src/baseTransaction.ts:42


r

Optional Readonly r: bigint

Inherited from

BaseTransaction.r

Defined in

tx/src/baseTransaction.ts:49


s

Optional Readonly s: bigint

Inherited from

BaseTransaction.s

Defined in

tx/src/baseTransaction.ts:50


to

Optional Readonly to: Address

Inherited from

BaseTransaction.to

Defined in

tx/src/baseTransaction.ts:44


v

Optional Readonly v: bigint

Inherited from

BaseTransaction.v

Defined in

tx/src/baseTransaction.ts:48


value

Readonly value: bigint

Inherited from

BaseTransaction.value

Defined in

tx/src/baseTransaction.ts:45

Accessors

type

get type(): TransactionType

Returns the transaction type.

Note: legacy txs will return tx type 0.

Returns

TransactionType

Inherited from

BaseTransaction.type

Defined in

tx/src/baseTransaction.ts:121

Methods

addSignature

addSignature(v, r, s, convertV?): BlobEIP4844Transaction

Parameters

Name Type Default value
v bigint undefined
r bigint | Uint8Array undefined
s bigint | Uint8Array undefined
convertV boolean false

Returns

BlobEIP4844Transaction

Overrides

BaseTransaction.addSignature

Defined in

tx/src/eip4844Transaction.ts:558


errorStr

errorStr(): string

Return a compact error string representation of the object

Returns

string

Overrides

BaseTransaction.errorStr

Defined in

tx/src/eip4844Transaction.ts:594


getBaseFee

getBaseFee(): bigint

The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)

Returns

bigint

Inherited from

BaseTransaction.getBaseFee

Defined in

tx/src/baseTransaction.ts:176


getDataFee

getDataFee(): bigint

The amount of gas paid for the data in this tx

Returns

bigint

Overrides

BaseTransaction.getDataFee

Defined in

tx/src/eip4844Transaction.ts:421


getEffectivePriorityFee

getEffectivePriorityFee(baseFee): bigint

Returns the minimum of calculated priority fee (from maxFeePerGas and baseFee) and maxPriorityFeePerGas

Parameters

Name Type Description
baseFee bigint Base fee retrieved from block

Returns

bigint

Overrides

BaseTransaction.getEffectivePriorityFee

Defined in

tx/src/eip4844Transaction.ts:224


getHashedMessageToSign

getHashedMessageToSign(): Uint8Array

Returns the hashed serialized unsigned tx, which can be used to sign the transaction (e.g. for sending to a hardware wallet).

Note: in contrast to the legacy tx the raw message format is already serialized and doesn’t need to be RLP encoded any more.

Returns

Uint8Array

Overrides

BaseTransaction.getHashedMessageToSign

Defined in

tx/src/eip4844Transaction.ts:518


getMessageToSign

getMessageToSign(): Uint8Array

Returns the raw serialized unsigned tx, which can be used to sign the transaction (e.g. for sending to a hardware wallet).

Note: in contrast to the legacy tx the raw message format is already serialized and doesn’t need to be RLP encoded any more.

const serializedMessage = tx.getMessageToSign() // use this for the HW wallet input

Returns

Uint8Array

Overrides

BaseTransaction.getMessageToSign

Defined in

tx/src/eip4844Transaction.ts:507


getMessageToVerifySignature

getMessageToVerifySignature(): Uint8Array

Returns

Uint8Array

Overrides

BaseTransaction.getMessageToVerifySignature

Defined in

tx/src/eip4844Transaction.ts:532


getSenderAddress

getSenderAddress(): Address

Returns the sender’s address

Returns

Address

Inherited from

BaseTransaction.getSenderAddress

Defined in

tx/src/baseTransaction.ts:279


getSenderPublicKey

getSenderPublicKey(): Uint8Array

Returns the public key of the sender

Returns

Uint8Array

Overrides

BaseTransaction.getSenderPublicKey

Defined in

tx/src/eip4844Transaction.ts:539


getUpfrontCost

getUpfrontCost(baseFee?): bigint

The up front amount that an account must have for this transaction to be valid

Parameters

Name Type Default value Description
baseFee bigint BIGINT_0 The base fee of the block (will be set to 0 if not provided)

Returns

bigint

Overrides

BaseTransaction.getUpfrontCost

Defined in

tx/src/eip4844Transaction.ts:429


getValidationErrors

getValidationErrors(): string[]

Validates the transaction signature and minimum gas requirements.

Returns

string[]

an array of error strings

Inherited from

BaseTransaction.getValidationErrors

Defined in

tx/src/baseTransaction.ts:149


hash

hash(): Uint8Array

Computes a sha3-256 hash of the serialized tx.

This method can only be used for signed txs (it throws otherwise). Use getMessageToSign to get a tx hash for the purpose of signing.

Returns

Uint8Array

Overrides

BaseTransaction.hash

Defined in

tx/src/eip4844Transaction.ts:528


isSigned

isSigned(): boolean

Returns

boolean

Inherited from

BaseTransaction.isSigned

Defined in

tx/src/baseTransaction.ts:254


isValid

isValid(): boolean

Validates the transaction signature and minimum gas requirements.

Returns

boolean

true if the transaction is valid, false otherwise

Inherited from

BaseTransaction.isValid

Defined in

tx/src/baseTransaction.ts:167


numBlobs

numBlobs(): number

Returns

number

the number of blobs included with this transaction

Defined in

tx/src/eip4844Transaction.ts:613


raw

raw(): BlobEIP4844TxValuesArray

Returns a Uint8Array Array of the raw Bytes of the EIP-4844 transaction, in order.

Format: [chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s]`.

Use {@link BlobEIP4844Transaction.serialize} to add a transaction to a block with {@link Block.fromValuesArray}.

For an unsigned tx this method uses the empty Bytes values for the signature parameters v, r and s for encoding. For an EIP-155 compliant representation for external signing use getMessageToSign.

Returns

BlobEIP4844TxValuesArray

Overrides

BaseTransaction.raw

Defined in

tx/src/eip4844Transaction.ts:446


serialize

serialize(): Uint8Array

Returns the serialized encoding of the EIP-4844 transaction.

Format: 0x03 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s]).

Note that in contrast to the legacy tx serialization format this is not valid RLP any more due to the raw tx type preceding and concatenated to the RLP encoding of the values.

Returns

Uint8Array

Overrides

BaseTransaction.serialize

Defined in

tx/src/eip4844Transaction.ts:475


serializeNetworkWrapper

serializeNetworkWrapper(): Uint8Array

Returns

Uint8Array

the serialized form of a blob transaction in the network wrapper format (used for gossipping mempool transactions over devp2p)

Defined in

tx/src/eip4844Transaction.ts:482


sign

sign(privateKey): BlobEIP4844Transaction

Signs a transaction.

Note that the signed tx is returned as a new object, use as follows:

const signedTx = tx.sign(privateKey)

Parameters

Name Type
privateKey Uint8Array

Returns

BlobEIP4844Transaction

Inherited from

BaseTransaction.sign

Defined in

tx/src/baseTransaction.ts:297


supports

supports(capability): boolean

Checks if a tx type defining capability is active on a tx, for example the EIP-1559 fee market mechanism or the EIP-2930 access list feature.

Note that this is different from the tx type itself, so EIP-2930 access lists can very well be active on an EIP-1559 tx for example.

This method can be useful for feature checks if the tx type is unknown (e.g. when instantiated with the tx factory).

See Capabilities in the types module for a reference on all supported capabilities.

Parameters

Name Type
capability Capability

Returns

boolean

Inherited from

BaseTransaction.supports

Defined in

tx/src/baseTransaction.ts:141


toCreationAddress

toCreationAddress(): boolean

If the tx’s to is to the creation address

Returns

boolean

Inherited from

BaseTransaction.toCreationAddress

Defined in

tx/src/baseTransaction.ts:223


toJSON

toJSON(): JsonTx

Returns

JsonTx

Overrides

BaseTransaction.toJSON

Defined in

tx/src/eip4844Transaction.ts:543


verifySignature

verifySignature(): boolean

Determines if the signature is valid

Returns

boolean

Inherited from

BaseTransaction.verifySignature

Defined in

tx/src/baseTransaction.ts:266


fromSerializedBlobTxNetworkWrapper

Static fromSerializedBlobTxNetworkWrapper(serialized, opts?): BlobEIP4844Transaction

Creates a transaction from the network encoding of a blob transaction (with blobs/commitments/proof)

Parameters

Name Type Description
serialized Uint8Array a buffer representing a serialized BlobTransactionNetworkWrapper
opts? TxOptions any TxOptions defined

Returns

BlobEIP4844Transaction

a BlobEIP4844Transaction

Defined in

tx/src/eip4844Transaction.ts:358


fromSerializedTx

Static fromSerializedTx(serialized, opts?): BlobEIP4844Transaction

Instantiate a transaction from the serialized tx.

Format: 0x03 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_data_gas, blob_versioned_hashes, y_parity, r, s])

Parameters

Name Type
serialized Uint8Array
opts TxOptions

Returns

BlobEIP4844Transaction

Defined in

tx/src/eip4844Transaction.ts:259


fromTxData

Static fromTxData(txData, opts?): BlobEIP4844Transaction

Parameters

Name Type
txData BlobEIP4844TxData
opts? TxOptions

Returns

BlobEIP4844Transaction

Defined in

tx/src/eip4844Transaction.ts:192


fromValuesArray

Static fromValuesArray(values, opts?): BlobEIP4844Transaction

Create a transaction from a values array.

Format: [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, signatureYParity, signatureR, signatureS]

Parameters

Name Type
values BlobEIP4844TxValuesArray
opts TxOptions

Returns

BlobEIP4844Transaction

Defined in

tx/src/eip4844Transaction.ts:289


minimalFromNetworkWrapper

Static minimalFromNetworkWrapper(txData, opts?): BlobEIP4844Transaction

Creates the minimal representation of a blob transaction from the network wrapper version. The minimal representation is used when adding transactions to an execution payload/block

Parameters

Name Type Description
txData BlobEIP4844Transaction a BlobEIP4844Transaction containing optional blobs/kzg commitments
opts? TxOptions dictionary of TxOptions

Returns

BlobEIP4844Transaction

the “minimal” representation of a BlobEIP4844Transaction (i.e. transaction object minus blobs and kzg commitments)

Defined in

tx/src/eip4844Transaction.ts:235