Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/Transaction / EIP1559

EIP1559

Classes

TransactionEIP1559

Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:54 Factory function for creating EIP-1559 Transaction instances

Constructors

Constructor
new TransactionEIP1559(tx): TransactionEIP1559
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:54 Factory function for creating EIP-1559 Transaction instances
Parameters
tx
any
Returns
TransactionEIP1559

Properties

getEffectiveGasPrice()
getEffectiveGasPrice: (tx, baseFee) => bigint
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:92 Calculate effective gas price given base fee.
Parameters
tx
TransactionEIP1559Type Transaction
baseFee
bigint Block base fee
Returns
bigint Effective gas price
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { getEffectiveGasPrice } from './primitives/Transaction/EIP1559/getEffectiveGasPrice.js';
const effectivePrice = getEffectiveGasPrice(tx, 20n);
getSender()
getSender: (tx) => AddressType
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:88 Get sender address from transaction signature (EIP-1559). Recovers the sender address from transaction signature components (r, s, yParity). Returns a BrandedAddress (20 bytes). Assumes transaction uses branded types with validated signature components.
Parameters
tx
TransactionEIP1559Type Signed transaction with BrandedAddress fields
Returns
AddressType Sender address (20 bytes, branded)
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
If signature recovery fails
Example
import { getSender } from './primitives/Transaction/EIP1559/getSender.js';
const sender = getSender(tx); // Returns BrandedAddress
getSigningHash()
getSigningHash: (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:86
Parameters
tx
TransactionEIP1559Type
Returns
Uint8Array
hash()
hash: (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:85
Parameters
tx
TransactionEIP1559Type
Returns
Uint8Array
serialize()
serialize: (tx) => Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:83 Serialize EIP-1559 transaction to RLP encoded bytes.
Parameters
tx
TransactionEIP1559Type Transaction to serialize
Returns
Uint8Array<ArrayBufferLike> RLP encoded transaction with type byte prefix
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { serialize } from './primitives/Transaction/EIP1559/serialize.js';
const encoded = serialize(tx);
verifySignature()
verifySignature: (tx) => boolean
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:90
Parameters
tx
TransactionEIP1559Type
Returns
boolean
deserialize()
static deserialize: (bytes) => TransactionEIP1559Prototype
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:73
Parameters
bytes
Uint8Array
Returns
TransactionEIP1559Prototype
getEffectiveGasPrice()
static getEffectiveGasPrice: (tx, baseFee) => bigint
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:79 Calculate effective gas price given base fee.
Parameters
tx
TransactionEIP1559Type Transaction
baseFee
bigint Block base fee
Returns
bigint Effective gas price
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { getEffectiveGasPrice } from './primitives/Transaction/EIP1559/getEffectiveGasPrice.js';
const effectivePrice = getEffectiveGasPrice(tx, 20n);
getSender()
static getSender: (tx) => AddressType
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:77 Get sender address from transaction signature (EIP-1559). Recovers the sender address from transaction signature components (r, s, yParity). Returns a BrandedAddress (20 bytes). Assumes transaction uses branded types with validated signature components.
Parameters
tx
TransactionEIP1559Type Signed transaction with BrandedAddress fields
Returns
AddressType Sender address (20 bytes, branded)
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
If signature recovery fails
Example
import { getSender } from './primitives/Transaction/EIP1559/getSender.js';
const sender = getSender(tx); // Returns BrandedAddress
getSigningHash()
static getSigningHash: (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:76
Parameters
tx
TransactionEIP1559Type
Returns
Uint8Array
hash()
static hash: (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:75
Parameters
tx
TransactionEIP1559Type
Returns
Uint8Array
prototype
static prototype: object
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:82
serialize()
static serialize: (tx) => Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:74 Serialize EIP-1559 transaction to RLP encoded bytes.
Parameters
tx
TransactionEIP1559Type Transaction to serialize
Returns
Uint8Array<ArrayBufferLike> RLP encoded transaction with type byte prefix
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { serialize } from './primitives/Transaction/EIP1559/serialize.js';
const encoded = serialize(tx);
verifySignature()
static verifySignature: (tx) => boolean
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:78
Parameters
tx
TransactionEIP1559Type
Returns
boolean

Interfaces

TransactionEIP1559Constructor()

Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:20
TransactionEIP1559Constructor(tx): TransactionEIP1559Prototype
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:21

Parameters

tx
accessList
AccessList
chainId
bigint
data
Uint8Array
gasLimit
bigint
maxFeePerGas
bigint
maxPriorityFeePerGas
bigint
nonce
bigint
r
Uint8Array
s
Uint8Array
to
AddressType | null
value
bigint
yParity
number

Returns

TransactionEIP1559Prototype

Properties

getEffectiveGasPrice()
getEffectiveGasPrice: (tx, baseFee) => bigint
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:42 Calculate effective gas price given base fee.
Parameters
tx
TransactionEIP1559Type Transaction
baseFee
bigint Block base fee
Returns
bigint Effective gas price
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { getEffectiveGasPrice } from './primitives/Transaction/EIP1559/getEffectiveGasPrice.js';
const effectivePrice = getEffectiveGasPrice(tx, 20n);
getSender()
getSender: (tx) => AddressType
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:40 Get sender address from transaction signature (EIP-1559). Recovers the sender address from transaction signature components (r, s, yParity). Returns a BrandedAddress (20 bytes). Assumes transaction uses branded types with validated signature components.
Parameters
tx
TransactionEIP1559Type Signed transaction with BrandedAddress fields
Returns
AddressType Sender address (20 bytes, branded)
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
If signature recovery fails
Example
import { getSender } from './primitives/Transaction/EIP1559/getSender.js';
const sender = getSender(tx); // Returns BrandedAddress
getSigningHash()
getSigningHash: (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:39
Parameters
tx
TransactionEIP1559Type
Returns
Uint8Array
hash()
hash: (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:38
Parameters
tx
TransactionEIP1559Type
Returns
Uint8Array
prototype
prototype: TransactionEIP1559Prototype
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:35
serialize()
serialize: (tx) => Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:37 Serialize EIP-1559 transaction to RLP encoded bytes.
Parameters
tx
TransactionEIP1559Type Transaction to serialize
Returns
Uint8Array<ArrayBufferLike> RLP encoded transaction with type byte prefix
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { serialize } from './primitives/Transaction/EIP1559/serialize.js';
const encoded = serialize(tx);
verifySignature()
verifySignature: (tx) => boolean
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:41
Parameters
tx
TransactionEIP1559Type
Returns
boolean

Methods

deserialize()
deserialize(bytes): TransactionEIP1559Prototype
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Constructor.ts:36
Parameters
bytes
Uint8Array
Returns
TransactionEIP1559Prototype

Type Aliases

BrandedTransactionEIP1559

BrandedTransactionEIP1559 = TransactionEIP1559Type
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:26

TransactionEIP1559Type

TransactionEIP1559Type = object
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:8 EIP-1559 Transaction type

Properties

[brand]
readonly [brand]: "TransactionEIP1559"
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:9
accessList
accessList: AccessList
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:19
chainId
chainId: bigint
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:11
data
data: Uint8Array
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:18
gasLimit
gasLimit: bigint
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:15
maxFeePerGas
maxFeePerGas: bigint
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:14
maxPriorityFeePerGas
maxPriorityFeePerGas: bigint
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:13
nonce
nonce: bigint
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:12
r
r: Uint8Array
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:21
s
s: Uint8Array
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:22
to
to: AddressType | null
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:16
type
type: EIP1559
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:10
value
value: bigint
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:17
yParity
yParity: number
Defined in: src/primitives/Transaction/EIP1559/TransactionEIP1559Type.ts:20

Variables

getSigningHash()

const getSigningHash: (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:21

Parameters

tx
TransactionEIP1559Type

Returns

Uint8Array

hash()

const hash: (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:22

Parameters

tx
TransactionEIP1559Type

Returns

Uint8Array

verifySignature()

const verifySignature: (tx) => boolean
Defined in: src/primitives/Transaction/EIP1559/EIP1559.js:23

Parameters

tx
TransactionEIP1559Type

Returns

boolean

Functions

deserialize()

deserialize(data): TransactionEIP1559Type
Defined in: src/primitives/Transaction/EIP1559/deserialize.js:20 Deserialize RLP encoded EIP-1559 transaction.

Parameters

data
Uint8Array<ArrayBufferLike> RLP encoded transaction with type byte prefix

Returns

TransactionEIP1559Type Deserialized transaction

See

https://voltaire.tevm.sh/primitives/transaction for Transaction documentation

Since

0.0.0

Throws

If transaction format is invalid

Example

import { deserialize } from './primitives/Transaction/EIP1559/deserialize.js';
const tx = deserialize(encodedBytes);

getEffectiveGasPrice()

getEffectiveGasPrice(tx, baseFee): bigint
Defined in: src/primitives/Transaction/EIP1559/getEffectiveGasPrice.js:16 Calculate effective gas price given base fee.

Parameters

tx
TransactionEIP1559Type Transaction
baseFee
bigint Block base fee

Returns

bigint Effective gas price

See

https://voltaire.tevm.sh/primitives/transaction for Transaction documentation

Since

0.0.0

Throws

Never throws

Example

import { getEffectiveGasPrice } from './primitives/Transaction/EIP1559/getEffectiveGasPrice.js';
const effectivePrice = getEffectiveGasPrice(tx, 20n);

getSender()

getSender(tx): AddressType
Defined in: src/primitives/Transaction/EIP1559/getSender.js:22 Get sender address from transaction signature (EIP-1559). Recovers the sender address from transaction signature components (r, s, yParity). Returns a BrandedAddress (20 bytes). Assumes transaction uses branded types with validated signature components.

Parameters

tx
TransactionEIP1559Type Signed transaction with BrandedAddress fields

Returns

AddressType Sender address (20 bytes, branded)

See

https://voltaire.tevm.sh/primitives/transaction for Transaction documentation

Since

0.0.0

Throws

If signature recovery fails

Example

import { getSender } from './primitives/Transaction/EIP1559/getSender.js';
const sender = getSender(tx); // Returns BrandedAddress

GetSigningHash()

GetSigningHash(deps): (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/getSigningHash.js:34 Factory: Get signing hash for EIP-1559 transaction. Computes the Keccak256 hash of the RLP-encoded transaction fields that need to be signed. The transaction uses BrandedAddress for to field, assumed to be validated (20 bytes). Returns a HashType (32 bytes).

Parameters

deps
Crypto dependencies
keccak256
(data) => Uint8Array Keccak256 hash function
rlpEncode
(data) => Uint8Array RLP encode function

Returns

Function that computes signing hash
(tx): Uint8Array
Parameters
tx
TransactionEIP1559Type
Returns
Uint8Array

See

https://voltaire.tevm.sh/primitives/transaction for Transaction documentation

Since

0.0.0

Throws

Never throws

Example

import { GetSigningHash } from './primitives/Transaction/EIP1559/getSigningHash.js';
import { hash as keccak256 } from '../../../crypto/Keccak256/hash.js';
import { encode as rlpEncode } from '../../Rlp/encode.js';
const getSigningHash = GetSigningHash({ keccak256, rlpEncode });
const signingHash = getSigningHash(tx);

Hash()

Hash(deps): (tx) => Uint8Array
Defined in: src/primitives/Transaction/EIP1559/hash.js:22 Factory: Compute transaction hash.

Parameters

deps
Crypto dependencies
keccak256
(data) => Uint8Array Keccak256 hash function

Returns

Function that computes transaction hash
(tx): Uint8Array
Parameters
tx
TransactionEIP1559Type
Returns
Uint8Array

See

https://voltaire.tevm.sh/primitives/transaction for Transaction documentation

Since

0.0.0

Throws

Never throws

Example

import { Hash } from './primitives/Transaction/EIP1559/hash.js';
import { hash as keccak256 } from '../../../crypto/Keccak256/hash.js';
const hash = Hash({ keccak256 });
const txHash = hash(tx);

serialize()

serialize(tx): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/EIP1559/serialize.js:23 Serialize EIP-1559 transaction to RLP encoded bytes.

Parameters

tx
TransactionEIP1559Type Transaction to serialize

Returns

Uint8Array<ArrayBufferLike> RLP encoded transaction with type byte prefix

See

https://voltaire.tevm.sh/primitives/transaction for Transaction documentation

Since

0.0.0

Throws

Never throws

Example

import { serialize } from './primitives/Transaction/EIP1559/serialize.js';
const encoded = serialize(tx);

VerifySignature()

VerifySignature(deps): (tx) => boolean
Defined in: src/primitives/Transaction/EIP1559/verifySignature.js:43 Factory: Verify transaction signature. Verifies that the transaction signature is valid. This checks that:
  1. The signature components (r, s) are well-formed
  2. The yParity/v is valid
  3. A public key can be recovered from the signature
Note: This does NOT verify the transaction was signed by a specific address. It only validates the signature is cryptographically valid and can recover a sender address. To verify against an expected sender, use getSender() and compare the result.

Parameters

deps
Crypto dependencies
keccak256
(data) => Uint8Array Keccak256 hash function
rlpEncode
(data) => Uint8Array RLP encode function
secp256k1RecoverPublicKey
any secp256k1 public key recovery

Returns

Function that verifies signature
(tx): boolean
Parameters
tx
TransactionEIP1559Type
Returns
boolean

See

https://voltaire.tevm.sh/primitives/transaction for Transaction documentation

Since

0.0.0

Throws

Never throws - returns false on error

Example

import { VerifySignature } from './primitives/Transaction/EIP1559/verifySignature.js';
import { hash as keccak256 } from '../../../crypto/Keccak256/hash.js';
import { encode as rlpEncode } from '../../Rlp/encode.js';
import { recoverPublicKey } from '../../../crypto/Secp256k1/index.js';
const verifySignature = VerifySignature({
  keccak256,
  rlpEncode,
  secp256k1RecoverPublicKey: recoverPublicKey
});
const isValid = verifySignature(tx);