@ethereumjs/tx / Blob4844Tx
Defined in: 4844/tx.ts:64
Typed transaction with a new gas fee market mechanism for transactions that include “blobs” of data
This tx type has two “modes”: the plain canonical format only contains blobVersionedHashes.
If blobs are passed in the tx automatically switches to “Network Wrapper” format and the
networkWrapperVersion will be set or validated.
TransactionInterface<typeof BlobEIP4844>new Blob4844Tx(
txData,opts):Blob4844Tx
Defined in: 4844/tx.ts:120
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.
TxOptions = {}
Blob4844Tx
readonlyaccessList:AccessListBytes
Defined in: 4844/tx.ts:73
optionalblobs:`0x${string}`[]
Defined in: 4844/tx.ts:96
blobVersionedHashes:
`0x${string}`[]
Defined in: 4844/tx.ts:78
readonlycache:TransactionCache={}
Defined in: 4844/tx.ts:104
readonlychainId:bigint
Defined in: 4844/tx.ts:74
readonlycommon:Common
Defined in: 4844/tx.ts:100
readonlydata:Uint8Array
Defined in: 4844/tx.ts:71
readonlygasLimit:bigint
Defined in: 4844/tx.ts:69
optionalkzgCommitments:`0x${string}`[]
Defined in: 4844/tx.ts:97
optionalkzgProofs:`0x${string}`[]
Defined in: 4844/tx.ts:98
readonlymaxFeePerBlobGas:bigint
Defined in: 4844/tx.ts:77
readonlymaxFeePerGas:bigint
Defined in: 4844/tx.ts:76
readonlymaxPriorityFeePerGas:bigint
Defined in: 4844/tx.ts:75
optionalnetworkWrapperVersion:NetworkWrapperType
Defined in: 4844/tx.ts:93
This property is set if the tx is in “Network Wrapper” format.
Possible values:
readonlynonce:bigint
Defined in: 4844/tx.ts:68
readonlyoptionalr:bigint
Defined in: 4844/tx.ts:82
readonlyoptionals:bigint
Defined in: 4844/tx.ts:83
readonlyoptionalto:Address
Defined in: 4844/tx.ts:72
readonlytxOptions:TxOptions
Defined in: 4844/tx.ts:102
TransactionInterface.txOptions
type:
3=TransactionType.BlobEIP4844
Defined in: 4844/tx.ts:65
readonlyoptionalv:bigint
Defined in: 4844/tx.ts:81
readonlyvalue:bigint
Defined in: 4844/tx.ts:70
addSignature(
v,r,s):Blob4844Tx
Defined in: 4844/tx.ts:532
Adds signature values (and optional network wrapper fields) and returns a new transaction.
bigint
Recovery parameter
Signature r value
bigint |
Uint8Array<ArrayBufferLike> |
Signature s value
bigint |
Uint8Array<ArrayBufferLike> |
Blob4844Tx
New Blob4844Tx instance containing the signature
TransactionInterface.addSignature
errorStr():
string
Defined in: 4844/tx.ts:620
Return a compact error string representation of the object
string
Human-readable error summary
getDataGas():
bigint
Defined in: 4844/tx.ts:346
The amount of gas paid for the data in this tx
bigint
TransactionInterface.getDataGas
getEffectivePriorityFee(
baseFee):bigint
Defined in: 4844/tx.ts:339
Returns the minimum of calculated priority fee (from maxFeePerGas and baseFee) and maxPriorityFeePerGas
bigint
Base fee retrieved from block
bigint
getHashedMessageToSign():
Uint8Array
Defined in: 4844/tx.ts:475
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.
Uint8Array
Keccak hash of the unsigned transaction payload
TransactionInterface.getHashedMessageToSign
getIntrinsicGas():
bigint
Defined in: 4844/tx.ts:370
The minimum gas limit which the tx to have to be valid. This covers costs as the standard fee (21000 gas), the data fee (paid for each calldata byte), the optional creation fee (if the transaction creates a contract), and if relevant the gas to be paid for access lists (EIP-2930) and authority lists (EIP-7702).
bigint
TransactionInterface.getIntrinsicGas
getMessageToSign():
Uint8Array
Defined in: 4844/tx.ts:463
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
Uint8Array
Serialized unsigned transaction payload
TransactionInterface.getMessageToSign
getMessageToVerifySignature():
Uint8Array
Defined in: 4844/tx.ts:494
Returns the hashed unsigned transaction that should be used for signature verification.
Uint8Array
Hash of the unsigned transaction payload
TransactionInterface.getMessageToVerifySignature
getSenderAddress():
Address
Defined in: 4844/tx.ts:589
Returns the recovered sender address.
Address
Sender Address
TransactionInterface.getSenderAddress
getSenderPublicKey():
Uint8Array
Defined in: 4844/tx.ts:502
Returns the public key of the sender
Uint8Array
Sender public key
TransactionInterface.getSenderPublicKey
getUpfrontCost(
baseFee):bigint
Defined in: 4844/tx.ts:354
The up front amount that an account must have for this transaction to be valid
bigint = BIGINT_0
The base fee of the block (will be set to 0 if not provided)
bigint
TransactionInterface.getUpfrontCost
getValidationErrors():
string[]
Defined in: 4844/tx.ts:566
Returns validation errors for this transaction, if any.
string[]
Array of validation error messages
TransactionInterface.getValidationErrors
hash():
Uint8Array
Defined in: 4844/tx.ts:486
Computes a sha3-256 hash of the serialized tx.
This method can only be used for signed txs (it throws otherwise). Use Blob4844Tx.getMessageToSign to get a tx hash for the purpose of signing.
Uint8Array
Hash of the serialized signed transaction
isSigned():
boolean
Defined in: 4844/tx.ts:607
Indicates whether the transaction already carries signature values.
boolean
true if signature parts are present
isValid():
boolean
Defined in: 4844/tx.ts:573
boolean
true if the transaction has no validation errors
numBlobs():
number
Defined in: 4844/tx.ts:629
number
the number of blobs included with this transaction
raw():
BlobEIP4844TxValuesArray
Defined in: 4844/tx.ts:387
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 Blob4844Tx.serialize to add a transaction to a block with createBlockFromBytesArray.
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 Blob4844Tx.getMessageToSign.
BlobEIP4844TxValuesArray
serialize():
Uint8Array
Defined in: 4844/tx.ts:416
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.
Uint8Array
TransactionInterface.serialize
serializeNetworkWrapper():
Uint8Array
Defined in: 4844/tx.ts:425
Uint8Array
the serialized form of a blob transaction in the network wrapper format This format is used for gossipping mempool transactions over devp2p or when submitting a transaction via RPC.
sign(
privateKey,extraEntropy):Blob4844Tx
Defined in: 4844/tx.ts:599
Signs the transaction with the provided private key and returns the signed instance.
Uint8Array
32-byte private key used for signing
Optional entropy passed to the signing routine
boolean |
Uint8Array<ArrayBufferLike> |
Blob4844Tx
Newly signed transaction
supports(
capability):boolean
Defined in: 4844/tx.ts:331
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.
number
boolean
toCreationAddress():
never
Defined in: 4844/tx.ts:360
Blob4844Tx cannot create contracts
never
TransactionInterface.toCreationAddress
toJSON():
JSONTx
Defined in: 4844/tx.ts:510
Produces a JSON representation compliant with the execution API.
JSON encoding of the transaction
verifySignature():
boolean
Defined in: 4844/tx.ts:581
Verifies whether the attached signature is valid.
boolean
true if signature verification succeeds