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

Legacy

Classes

TransactionLegacy

Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:78 Factory function for creating Legacy Transaction instances

Constructors

Constructor
new TransactionLegacy(tx): TransactionLegacy
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:78 Factory function for creating Legacy Transaction instances
Parameters
tx
any
Returns
TransactionLegacy

Properties

getChainId()
getChainId: (this) => bigint | null
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:106 Extract chain ID from v value (EIP-155).
Parameters
this
TransactionLegacyType
Returns
bigint | null Chain ID if EIP-155, null if pre-EIP-155
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { getChainId } from './primitives/Transaction/Legacy/getChainId.js';
const chainId = getChainId.call(tx);
getSender()
getSender: (this) => AddressType
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:110 Get sender address from transaction signature (Legacy). Recovers the sender address from transaction signature components (r, s, v). Returns a BrandedAddress (20 bytes). Handles both EIP-155 (chainId in v) and pre-EIP-155 signatures. Assumes transaction uses branded types with validated signature components.
Parameters
this
TransactionLegacyType
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/Legacy/getSender.js';
const sender = getSender.call(tx);
getSigningHash()
getSigningHash: (this) => Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:108
Parameters
this
TransactionLegacyType
Returns
Uint8Array
hash()
hash: (this) => Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:105
Parameters
this
TransactionLegacyType
Returns
Uint8Array
serialize()
serialize: (this) => Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:104 Serialize legacy transaction to RLP encoded bytes.
Parameters
this
TransactionLegacyType
Returns
Uint8Array<ArrayBufferLike> RLP encoded transaction
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { serialize } from './primitives/Transaction/Legacy/serialize.js';
const rlpBytes = serialize.call(tx);
verifySignature()
verifySignature: (this) => boolean
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:111
Parameters
this
TransactionLegacyType
Returns
boolean
deserialize()
static deserialize: (bytes) => TransactionLegacyPrototype
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:94
Parameters
bytes
Uint8Array
Returns
TransactionLegacyPrototype
prototype
static prototype: object
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:103

Methods

getChainId()
static getChainId(tx): bigint | null
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:97
Parameters
tx
any
Returns
bigint | null
getSender()
static getSender(tx): AddressType
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:99
Parameters
tx
any
Returns
AddressType
getSigningHash()
static getSigningHash(tx): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:98
Parameters
tx
any
Returns
Uint8Array<ArrayBufferLike>
hash()
static hash(tx): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:96
Parameters
tx
any
Returns
Uint8Array<ArrayBufferLike>
serialize()
static serialize(tx): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:95
Parameters
tx
any
Returns
Uint8Array<ArrayBufferLike>
verifySignature()
static verifySignature(tx): boolean
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:100
Parameters
tx
any
Returns
boolean

Interfaces

TransactionLegacyConstructor()

Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:19
TransactionLegacyConstructor(tx): TransactionLegacyPrototype
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:20

Parameters

tx
data
Uint8Array
gasLimit
bigint
gasPrice
bigint
nonce
bigint
r
Uint8Array
s
Uint8Array
to
AddressType | null
v
bigint
value
bigint

Returns

TransactionLegacyPrototype

Properties

getChainId()
getChainId: (this) => bigint | null
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:35 Extract chain ID from v value (EIP-155).
Parameters
this
TransactionLegacyType
Returns
bigint | null Chain ID if EIP-155, null if pre-EIP-155
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { getChainId } from './primitives/Transaction/Legacy/getChainId.js';
const chainId = getChainId.call(tx);
getSender()
getSender: (this) => AddressType
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:37 Get sender address from transaction signature (Legacy). Recovers the sender address from transaction signature components (r, s, v). Returns a BrandedAddress (20 bytes). Handles both EIP-155 (chainId in v) and pre-EIP-155 signatures. Assumes transaction uses branded types with validated signature components.
Parameters
this
TransactionLegacyType
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/Legacy/getSender.js';
const sender = getSender.call(tx);
getSigningHash()
getSigningHash: (this) => Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:36
Parameters
this
TransactionLegacyType
Returns
Uint8Array
hash()
hash: (this) => Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:34
Parameters
this
TransactionLegacyType
Returns
Uint8Array
prototype
prototype: TransactionLegacyPrototype
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:31
serialize()
serialize: (this) => Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:33 Serialize legacy transaction to RLP encoded bytes.
Parameters
this
TransactionLegacyType
Returns
Uint8Array<ArrayBufferLike> RLP encoded transaction
See
https://voltaire.tevm.sh/primitives/transaction for Transaction documentation
Since
0.0.0
Throws
Never throws
Example
import { serialize } from './primitives/Transaction/Legacy/serialize.js';
const rlpBytes = serialize.call(tx);
verifySignature()
verifySignature: (this) => boolean
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:38
Parameters
this
TransactionLegacyType
Returns
boolean

Methods

deserialize()
deserialize(bytes): TransactionLegacyPrototype
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyConstructor.ts:32
Parameters
bytes
Uint8Array
Returns
TransactionLegacyPrototype

Type Aliases

BrandedTransactionLegacy

BrandedTransactionLegacy = TransactionLegacyType
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:25

Deprecated

Use TransactionLegacyType instead

TransactionLegacyType

TransactionLegacyType = object
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:8 Branded Legacy Transaction type

Properties

[brand]
readonly [brand]: "TransactionLegacy"
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:9
data
data: Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:16
gasLimit
gasLimit: bigint
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:13
gasPrice
gasPrice: bigint
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:12
nonce
nonce: bigint
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:11
r
r: Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:18
s
s: Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:19
to
to: AddressType | null
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:14
type
type: Legacy
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:10
v
v: bigint
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:17
value
value: bigint
Defined in: src/primitives/Transaction/Legacy/TransactionLegacyType.ts:15

Variables

getSigningHash()

const getSigningHash: (this) => Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:42

Parameters

this
TransactionLegacyType

Returns

Uint8Array

hash()

const hash: (this) => Uint8Array
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:43

Parameters

this
TransactionLegacyType

Returns

Uint8Array

verifySignature()

const verifySignature: (this) => boolean
Defined in: src/primitives/Transaction/Legacy/TransactionLegacy.js:44

Parameters

this
TransactionLegacyType

Returns

boolean

Functions

deserialize()

deserialize(data): TransactionLegacyType
Defined in: src/primitives/Transaction/Legacy/deserialize.js:20 Deserialize RLP encoded legacy transaction.

Parameters

data
Uint8Array<ArrayBufferLike> RLP encoded transaction data

Returns

TransactionLegacyType Deserialized legacy transaction

See

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

Since

0.0.0

Throws

If data is invalid or not a valid legacy transaction

Example

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

getChainId()

getChainId(this): bigint | null
Defined in: src/primitives/Transaction/Legacy/getChainId.js:15 Extract chain ID from v value (EIP-155).

Parameters

this
TransactionLegacyType

Returns

bigint | null Chain ID if EIP-155, null if pre-EIP-155

See

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

Since

0.0.0

Throws

Never throws

Example

import { getChainId } from './primitives/Transaction/Legacy/getChainId.js';
const chainId = getChainId.call(tx);

getSender()

getSender(this): AddressType
Defined in: src/primitives/Transaction/Legacy/getSender.js:24 Get sender address from transaction signature (Legacy). Recovers the sender address from transaction signature components (r, s, v). Returns a BrandedAddress (20 bytes). Handles both EIP-155 (chainId in v) and pre-EIP-155 signatures. Assumes transaction uses branded types with validated signature components.

Parameters

this
TransactionLegacyType

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/Legacy/getSender.js';
const sender = getSender.call(tx);

GetSigningHash()

GetSigningHash(deps): (this) => Uint8Array
Defined in: src/primitives/Transaction/Legacy/getSigningHash.js:31 Factory: Get signing hash for Legacy transaction. Computes the Keccak256 hash of the RLP-encoded transaction fields that need to be signed. Handles both EIP-155 (with chainId) and pre-EIP-155 formats. The transaction uses BrandedAddress for to field, assumed to be validated (20 bytes or null). 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
(this): Uint8Array
Parameters
this
TransactionLegacyType
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/Legacy/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.call(tx);

Hash()

Hash(deps): (this) => Uint8Array
Defined in: src/primitives/Transaction/Legacy/hash.js:22 Factory: Compute transaction hash (keccak256 of serialized transaction).

Parameters

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

Returns

Function that computes transaction hash
(this): Uint8Array
Parameters
this
TransactionLegacyType
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/Legacy/hash.js';
import { hash as keccak256 } from '../../../crypto/Keccak256/hash.js';
const hash = Hash({ keccak256 });
const txHash = hash.call(tx);

serialize()

serialize(this): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Transaction/Legacy/serialize.js:18 Serialize legacy transaction to RLP encoded bytes.

Parameters

this
TransactionLegacyType

Returns

Uint8Array<ArrayBufferLike> RLP encoded transaction

See

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

Since

0.0.0

Throws

Never throws

Example

import { serialize } from './primitives/Transaction/Legacy/serialize.js';
const rlpBytes = serialize.call(tx);

VerifySignature()

VerifySignature(deps): (this) => boolean
Defined in: src/primitives/Transaction/Legacy/verifySignature.js:44 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 v value is valid (for pre-EIP-155 or EIP-155 format)
  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
(this): boolean
Parameters
this
TransactionLegacyType
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/Legacy/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.call(tx);