txtypes

package
v1.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package txtypes implements spamoor's Ethereum transaction, receipt and block types.

Transaction types are registered at runtime through RegisterTxType, so support for a new EIP is a new file in this package or in a plugin. Encoding, signing, sender recovery and JSON-RPC decoding are implemented here rather than taken from go-ethereum, whose TxData interface cannot be implemented outside its own package.

go-ethereum is still used for crypto primitives, the RLP codec, common value types and the plain data structs aliased below.

Index

Constants

View Source
const (
	FrameTxType = 0x06

	FrameTxIntrinsicCost = 12000
	FrameTxPerFrameCost  = 475
	MaxFrames            = 64
	ExpiryDataLength     = 8

	// Public mempool limits.
	MaxVerifyGas      = 100_000
	MaxVerifyStateGas = 500_000

	// EIP-8250 keyed nonces.
	MaxNonceKeys = 16

	// EIP-8272 recent root verifier frames: each tuple in the frame's data is
	// source_id || uint64 slot || root, and a frame carries at most this many.
	MaxRecentRootReferences = 16
	RecentRootTupleBytes    = 72
)

EIP-8141 frame transaction constants.

View Source
const (
	TxMaxGasLimit            = 16_777_216 // EIP-7825
	TxValueCost              = 6_000      // EIP-2780
	CostPerStateByte         = 1_530      // EIP-8037
	StateBytesPerNewAccount  = 120        // EIP-8037
	StateBytesPerStorageSet  = 64         // EIP-8037
	StandardTokenCost        = 4          // EIP-7976
	TotalCostFloorPerToken   = 16         // EIP-7976
	GasPerBlob               = 131_072    // EIP-4844
	VersionedHashVersionKZG  = 0x01       // EIP-4844
	FrameBlobSidecarVersion1 = 1          // EIP-7594 wrapper version
)

Constants defined by the EIPs frame transactions build on.

View Source
const (
	ApproveNone                = 0x0
	ApprovePayment             = 0x1
	ApproveExecution           = 0x2
	ApproveExecutionAndPayment = 0x3
	ApproveScopeMask           = 0x3
	AtomicBatchFlag            = 0x4
	FrameFlagsMask             = 0x7
)

Frame flags. Bits 0-1 are the approval scope, bit 2 marks an atomic batch.

View Source
const (
	// KeyedNonceFirstUseStateGas is the state gas a never-before-used nonce key costs:
	// one fresh storage slot under NONCE_MANAGER. It is charged from the limits.state
	// of the frame executing the payment-scoped APPROVE and attributed to that frame's
	// receipt. It does not count toward MaxVerifyGas, but the prefix's summed state
	// budgets stay under MaxVerifyStateGas, which is what bounds how many fresh keys a
	// mempool-legal transaction may open.
	KeyedNonceFirstUseStateGas = StateBytesPerStorageSet * CostPerStateByte

	// MaxNonceSeq is EIP-8250's exclusive bound on nonce_seq.
	MaxNonceSeq = uint64(1<<64 - 1)
)

EIP-8250 keyed nonce constants.

View Source
const (
	// RecentRootLength is the number of entries a root source can hold, so a source
	// overwrites itself once every RecentRootLength slots.
	RecentRootLength = 8192

	// RecentRootUsableWindow is the largest current_slot - slot a reference may have.
	RecentRootUsableWindow = 8191

	// RecentRootWriteLength is the exact calldata length the recent root contract
	// accepts: a 32-byte salt followed by a 32-byte root. Anything else reverts.
	RecentRootWriteLength = 64
)

EIP-8272 recent root constants.

View Source
const (
	FrameStatusFailed  = uint64(0)
	FrameStatusSuccess = uint64(1)
	FrameStatusSkipped = uint64(2)
)

Frame receipt status codes. Skipped is new in EIP-8141 and marks a frame that was not executed because an earlier frame in its atomic batch failed.

View Source
const (
	LegacyTxType     = 0x00
	AccessListTxType = 0x01
	DynamicFeeTxType = 0x02
	BlobTxType       = 0x03
	SetCodeTxType    = 0x04
)

Transaction types implemented by this package.

View Source
const (
	ReceiptStatusFailed     = uint64(0)
	ReceiptStatusSuccessful = uint64(1)
)

Receipt status codes.

View Source
const (
	BlobSidecarVersion0 = types.BlobSidecarVersion0
	BlobSidecarVersion1 = types.BlobSidecarVersion1
)

Blob sidecar versions (EIP-4844 / EIP-7594).

View Source
const FrameExtAll = FrameExtKeyedNonces

FrameExtAll enables every envelope extension, the shape current devnets run.

Variables

View Source
var (
	// EntryPoint is the caller of DEFAULT and VERIFY mode frames.
	EntryPoint = common.HexToAddress("0x00000000000000000000000000000000000000aa")

	// ExpiryVerifier is the built-in deadline verifier predeploy.
	ExpiryVerifier = common.HexToAddress("0x0000000000000000000000000000000000008141")

	// NonceManager stores the non-zero keyed nonce sequences of EIP-8250.
	NonceManager = common.HexToAddress("0x0000000000000000000000000000000000008250")

	// RecentRootAddress stores the recent roots of EIP-8272.
	RecentRootAddress = common.HexToAddress("0x0000000000000000000000000000000000008272")

	// LegacyNonceKey selects the sender's ordinary account nonce sequence.
	LegacyNonceKey = uint256.NewInt(0)
)

Protocol-defined addresses.

View Source
var (
	// ErrInvalidFrameTx is the base error for static frame transaction validation.
	ErrInvalidFrameTx = errors.New("invalid frame transaction")

	// ErrMempoolPolicy is returned when a transaction is well-formed but would not
	// propagate through the public mempool.
	ErrMempoolPolicy = errors.New("frame transaction violates public mempool policy")
)
View Source
var (
	// RecentRootEntryDomain separates committed entry hashes from storage keys.
	RecentRootEntryDomain = crypto.Keccak256Hash([]byte("RECENT_ROOT_ENTRY"))

	// RecentRootStorageDomain separates storage keys from committed entry hashes.
	RecentRootStorageDomain = crypto.Keccak256Hash([]byte("RECENT_ROOT_STORAGE"))
)
View Source
var (
	// ErrUnsignableTx is returned when a transaction type provides no way to sign it.
	ErrUnsignableTx = errors.New("transaction type cannot be signed")

	// ErrUnrecoverableSender is returned when a transaction type provides neither an
	// explicit sender nor a recoverable signature.
	ErrUnrecoverableSender = errors.New("transaction type has no recoverable sender")
)
View Source
var (
	// ErrTxTypeNotSupported is returned when a transaction type has no registered
	// implementation.
	ErrTxTypeNotSupported = errors.New("transaction type not supported")

	// ErrInvalidSig is returned when a transaction carries an unrecoverable signature.
	ErrInvalidSig = errors.New("invalid transaction v, r, s values")
)
View Source
var DelegationPrefix = types.DelegationPrefix

DelegationPrefix is the EIP-7702 code prefix marking a delegation indicator.

View Source
var NonceManagerCode = []byte{0x60, 0x00, 0x60, 0x00, 0xfd}

NonceManagerCode is the runtime code installed at NonceManager on activation, a bare revert(0, 0). Ordinary calls to the address are meant to fail; only the protocol writes its storage.

Functions

func AddressToDelegation

func AddressToDelegation(addr common.Address) []byte

AddressToDelegation builds the EIP-7702 delegation indicator code for an address.

func IsTxTypeSupported

func IsTxTypeSupported(txType byte) bool

IsTxTypeSupported reports whether a decoder is registered for txType.

func NonceKeysHash

func NonceKeysHash(keys []*uint256.Int) common.Hash

NonceKeysHash returns EIP-8250's nonce_keys_hash, the value TXPARAM 0x0F reports.

Valid key sets are strictly increasing, so the hash has one canonical form per selected key set.

func NonceManagerSlot

func NonceManagerSlot(sender common.Address, key *uint256.Int) common.Hash

NonceManagerSlot returns the NonceManager storage slot holding the sequence of one keyed nonce domain, keccak256(pad32(sender) || pad32(key)).

The slot is only meaningful for a non-zero key: key zero aliases the sender's ordinary account nonce and is never stored here.

func P256Signer

func P256Signer(qx, qy *big.Int) common.Address

P256Signer returns the address a P256 public key resolves to.

func ParseDelegation

func ParseDelegation(code []byte) (common.Address, bool)

ParseDelegation extracts the delegate address from an EIP-7702 delegation indicator, reporting whether the code is a delegation indicator at all.

func RecentRootEntryHash

func RecentRootEntryHash(sourceID common.Hash, slot uint64, root common.Hash) common.Hash

RecentRootEntryHash returns the value the recent root contract commits for a (source, slot, root) triple. A reference is valid only when the source's storage holds exactly this hash.

func RecentRootIndex

func RecentRootIndex(slot uint64) uint64

RecentRootIndex returns the ring index a slot's entry occupies.

func RecentRootReferenceUsable

func RecentRootReferenceUsable(currentSlot, slot uint64) bool

RecentRootReferenceUsable reports whether a reference to slot may be declared by a transaction executing in currentSlot. A root written during slot S becomes usable in S+1 and stays usable for RecentRootUsableWindow slots.

func RecentRootSlotStorageKey

func RecentRootSlotStorageKey(sourceID common.Hash, slot uint64) common.Hash

RecentRootSlotStorageKey is the common case of RecentRootStorageKey: the key holding whatever a source committed during a given slot.

func RecentRootSourceID

func RecentRootSourceID(source common.Address, salt common.Hash) common.Hash

RecentRootSourceID returns the identifier of a root source, keccak256(address || salt).

A single address addresses as many independent sources as it has salts.

func RecentRootStorageKey

func RecentRootStorageKey(sourceID common.Hash, index uint64) common.Hash

RecentRootStorageKey returns the RecentRootAddress storage key holding a source's entry for a ring index. Use RecentRootIndex to derive the index from a slot.

func RecentRootVerifyData

func RecentRootVerifyData(references []*RecentRootReference) []byte

RecentRootVerifyData packs references as the recent root contract's validation calldata: the concatenation of source_id || uint64_be(slot) || root, with no selector or length prefix. Its length is never 64 bytes, so it cannot be mistaken for a write.

func RecentRootVerifyGas

func RecentRootVerifyGas(count int) uint64

RecentRootVerifyGas returns an execution budget for a recent root verifier frame checking count references.

RECENT_ROOT_CODE is still TBD in the EIP, so this prices what the validation operation must do rather than a known bytecode: the cold target access at frame entry, then per tuple a cold SLOAD, two keccaks and the arithmetic around them, with headroom. The mempool does not count it, so erring high only raises the up-front max cost.

func RecentRootWriteCalldata

func RecentRootWriteCalldata(salt, root common.Hash) []byte

RecentRootWriteCalldata builds the recent root contract's only call: salt || root, exactly RecentRootWriteLength bytes, sent with zero value and not through DELEGATECALL, or the call reverts.

func RegisterReceiptDecoder

func RegisterReceiptDecoder(txType byte, decoder ReceiptDecoder)

RegisterReceiptDecoder installs a receipt decoder for a transaction type.

func RegisterTxType

func RegisterTxType(txType byte, newFn func() TxData)

RegisterTxType makes a transaction type known to the decoder, normally from the type's init function. Registering the same type byte twice panics.

func RegisteredTxTypes

func RegisteredTxTypes() []byte

RegisteredTxTypes returns the type bytes with a registered decoder.

Types

type AccessList

type AccessList = types.AccessList

AccessList is an EIP-2930 access list.

type AccessListTx

type AccessListTx struct {
	ChainID    *big.Int
	Nonce      uint64
	GasPrice   *big.Int
	Gas        uint64
	To         *common.Address `rlp:"nil"` // nil means contract creation
	Value      *big.Int
	Data       []byte
	AccessList AccessList
	V, R, S    *big.Int // signature values
}

AccessListTx is an EIP-2930 transaction.

func (*AccessListTx) CopyTx

func (tx *AccessListTx) CopyTx() TxData

CopyTx returns a deep copy with all fields initialized.

func (*AccessListTx) DecodeJSONTx

func (tx *AccessListTx) DecodeJSONTx(fields *JSONTxFields) error

DecodeJSONTx populates an access list transaction from JSON-RPC fields.

func (*AccessListTx) DecodePayload

func (tx *AccessListTx) DecodePayload(b []byte) error

DecodePayload parses the RLP payload following the type byte.

func (*AccessListTx) EncodeJSONTx

func (tx *AccessListTx) EncodeJSONTx(fields map[string]any)

EncodeJSONTx adds the access list transaction's fields.

func (*AccessListTx) EncodePayload

func (tx *AccessListTx) EncodePayload(w *bytes.Buffer) error

EncodePayload writes the RLP payload following the type byte.

func (*AccessListTx) GetAccessList

func (tx *AccessListTx) GetAccessList() AccessList

GetAccessList returns the EIP-2930 access list.

func (*AccessListTx) GetChainID

func (tx *AccessListTx) GetChainID() *big.Int

GetChainID returns the destination chain id.

func (*AccessListTx) GetData

func (tx *AccessListTx) GetData() []byte

GetData returns the transaction calldata.

func (*AccessListTx) GetGas

func (tx *AccessListTx) GetGas() uint64

GetGas returns the gas limit.

func (*AccessListTx) GetGasFeeCap

func (tx *AccessListTx) GetGasFeeCap() *big.Int

GetGasFeeCap returns the gas price; type 0x01 has no separate fee cap.

func (*AccessListTx) GetGasPrice

func (tx *AccessListTx) GetGasPrice() *big.Int

GetGasPrice returns the wei per gas the sender pays.

func (*AccessListTx) GetGasTipCap

func (tx *AccessListTx) GetGasTipCap() *big.Int

GetGasTipCap returns the gas price; type 0x01 has no separate tip.

func (*AccessListTx) GetNonce

func (tx *AccessListTx) GetNonce() uint64

GetNonce returns the sender account nonce.

func (*AccessListTx) GetSignatureValues

func (tx *AccessListTx) GetSignatureValues() (v, r, s *big.Int)

GetSignatureValues returns the signature values as encoded.

func (*AccessListTx) GetTo

func (tx *AccessListTx) GetTo() *common.Address

GetTo returns the recipient, or nil for contract creation.

func (*AccessListTx) GetValue

func (tx *AccessListTx) GetValue() *big.Int

GetValue returns the transferred amount in wei.

func (*AccessListTx) SetSignatureValues

func (tx *AccessListTx) SetSignatureValues(chainID, v, r, s *big.Int)

SetSignatureValues stores a signature. Typed transactions encode v as the raw y-parity bit.

func (*AccessListTx) SigningHash

func (tx *AccessListTx) SigningHash(chainID *big.Int) common.Hash

SigningHash returns the digest the sender signs.

func (*AccessListTx) TxType

func (tx *AccessListTx) TxType() byte

TxType returns the EIP-2718 type byte.

type AccessListTxData

type AccessListTxData interface {
	GetAccessList() AccessList
}

AccessListTxData is implemented by transaction types carrying an EIP-2930 access list.

type AccessTuple

type AccessTuple = types.AccessTuple

AccessTuple is a single EIP-2930 access list entry.

type AuthListTxData

type AuthListTxData interface {
	GetAuthList() []SetCodeAuthorization
}

AuthListTxData is implemented by transaction types carrying an EIP-7702 authorization list.

type BlobSidecar

type BlobSidecar = types.BlobTxSidecar

BlobSidecar carries the blobs, commitments and proofs of a blob transaction. It is wire-only data and is not covered by the transaction hash.

func NewBlobSidecar

func NewBlobSidecar(version byte, blobs []kzg4844.Blob, commitments []kzg4844.Commitment, proofs []kzg4844.Proof) *BlobSidecar

NewBlobSidecar builds a blob sidecar from its components.

type BlobTx

type BlobTx struct {
	ChainID    *uint256.Int
	Nonce      uint64
	GasTipCap  *uint256.Int // a.k.a. maxPriorityFeePerGas
	GasFeeCap  *uint256.Int // a.k.a. maxFeePerGas
	Gas        uint64
	To         common.Address
	Value      *uint256.Int
	Data       []byte
	AccessList AccessList
	BlobFeeCap *uint256.Int // a.k.a. maxFeePerBlobGas
	BlobHashes []common.Hash

	// Sidecar is optional on the wire but must be set to create a transaction for
	// submission.
	Sidecar *BlobSidecar `rlp:"-"`

	V, R, S *uint256.Int // signature values
}

BlobTx is an EIP-4844 blob transaction.

The sidecar is wire-only data: it is excluded from the canonical encoding and from the transaction hash, and travels only in the network encoding written by EncodeNetworkPayload.

func (*BlobTx) CopyTx

func (tx *BlobTx) CopyTx() TxData

CopyTx returns a deep copy with all fields initialized. The sidecar is shared rather than cloned, matching go-ethereum: sidecars are large and treated as immutable once attached.

func (*BlobTx) DecodeJSONTx

func (tx *BlobTx) DecodeJSONTx(fields *JSONTxFields) error

DecodeJSONTx populates a blob transaction from JSON-RPC fields. Sidecars are not part of the JSON-RPC representation.

func (*BlobTx) DecodePayload

func (tx *BlobTx) DecodePayload(b []byte) error

DecodePayload parses either the canonical payload or one of the two network encodings.

The three forms are distinguished structurally, as go-ethereum does. The canonical form is a list whose first element is the chain id, i.e. a number. The network forms wrap that list, so their first element is itself a list; of those, the v0 form has a list (the blobs) as its second element while the v1 form has the version byte.

func (*BlobTx) EncodeJSONTx

func (tx *BlobTx) EncodeJSONTx(fields map[string]any)

EncodeJSONTx adds the blob transaction's fields. The sidecar is wire-only and has no JSON-RPC representation.

func (*BlobTx) EncodeNetworkPayload

func (tx *BlobTx) EncodeNetworkPayload(w *bytes.Buffer) error

EncodeNetworkPayload writes the payload including the blob sidecar, in the wire form matching the sidecar's version.

func (*BlobTx) EncodePayload

func (tx *BlobTx) EncodePayload(w *bytes.Buffer) error

EncodePayload writes the canonical payload, without the sidecar. This is the form covered by the transaction hash and included in block bodies.

func (*BlobTx) GetAccessList

func (tx *BlobTx) GetAccessList() AccessList

GetAccessList returns the EIP-2930 access list.

func (*BlobTx) GetBlobGasFeeCap

func (tx *BlobTx) GetBlobGasFeeCap() *big.Int

GetBlobGasFeeCap returns the maximum fee per blob gas.

func (*BlobTx) GetBlobHashes

func (tx *BlobTx) GetBlobHashes() []common.Hash

GetBlobHashes returns the blob versioned hashes.

func (*BlobTx) GetBlobSidecar

func (tx *BlobTx) GetBlobSidecar() *BlobSidecar

GetBlobSidecar returns the attached sidecar, or nil.

func (*BlobTx) GetChainID

func (tx *BlobTx) GetChainID() *big.Int

GetChainID returns the destination chain id.

func (*BlobTx) GetData

func (tx *BlobTx) GetData() []byte

GetData returns the transaction calldata.

func (*BlobTx) GetGas

func (tx *BlobTx) GetGas() uint64

GetGas returns the gas limit.

func (*BlobTx) GetGasFeeCap

func (tx *BlobTx) GetGasFeeCap() *big.Int

GetGasFeeCap returns the maximum fee per gas.

func (*BlobTx) GetGasPrice

func (tx *BlobTx) GetGasPrice() *big.Int

GetGasPrice returns the fee cap; blob transactions have no single gas price.

func (*BlobTx) GetGasTipCap

func (tx *BlobTx) GetGasTipCap() *big.Int

GetGasTipCap returns the maximum priority fee per gas.

func (*BlobTx) GetNonce

func (tx *BlobTx) GetNonce() uint64

GetNonce returns the sender account nonce.

func (*BlobTx) GetSignatureValues

func (tx *BlobTx) GetSignatureValues() (v, r, s *big.Int)

GetSignatureValues returns the signature values as encoded.

func (*BlobTx) GetTo

func (tx *BlobTx) GetTo() *common.Address

GetTo returns the recipient. Blob transactions cannot create contracts, so this is never nil.

func (*BlobTx) GetValue

func (tx *BlobTx) GetValue() *big.Int

GetValue returns the transferred amount in wei.

func (*BlobTx) SetBlobSidecar

func (tx *BlobTx) SetBlobSidecar(sidecar *BlobSidecar)

SetBlobSidecar attaches a sidecar.

func (*BlobTx) SetSignatureValues

func (tx *BlobTx) SetSignatureValues(chainID, v, r, s *big.Int)

SetSignatureValues stores a signature. Typed transactions encode v as the raw y-parity bit.

func (*BlobTx) SigningHash

func (tx *BlobTx) SigningHash(chainID *big.Int) common.Hash

SigningHash returns the digest the sender signs.

func (*BlobTx) TxType

func (tx *BlobTx) TxType() byte

TxType returns the EIP-2718 type byte.

type BlobTxData

type BlobTxData interface {
	GetBlobHashes() []common.Hash
	GetBlobGasFeeCap() *big.Int
	GetBlobSidecar() *BlobSidecar
	SetBlobSidecar(sidecar *BlobSidecar)
}

BlobTxData is implemented by transaction types that can carry EIP-4844 blobs.

type Block

type Block struct {
	Header

	Transactions []*Transaction
}

Block is a block header together with its transactions.

func (*Block) NumberU64

func (b *Block) NumberU64() uint64

NumberU64 returns the block number.

func (*Block) UnmarshalJSON

func (b *Block) UnmarshalJSON(input []byte) error

UnmarshalJSON decodes a block including its full transaction objects. Transactions of unregistered types are kept as UnknownTx rather than dropped, so transaction indices stay aligned with the block's receipts.

type Bloom

type Bloom = types.Bloom

Bloom is a receipt's 2048-bit log bloom filter.

type DynamicFeeTx

type DynamicFeeTx struct {
	ChainID    *big.Int
	Nonce      uint64
	GasTipCap  *big.Int // a.k.a. maxPriorityFeePerGas
	GasFeeCap  *big.Int // a.k.a. maxFeePerGas
	Gas        uint64
	To         *common.Address `rlp:"nil"` // nil means contract creation
	Value      *big.Int
	Data       []byte
	AccessList AccessList
	V, R, S    *big.Int // signature values
}

DynamicFeeTx is an EIP-1559 transaction.

func (*DynamicFeeTx) CopyTx

func (tx *DynamicFeeTx) CopyTx() TxData

CopyTx returns a deep copy with all fields initialized.

func (*DynamicFeeTx) DecodeJSONTx

func (tx *DynamicFeeTx) DecodeJSONTx(fields *JSONTxFields) error

DecodeJSONTx populates a dynamic fee transaction from JSON-RPC fields.

func (*DynamicFeeTx) DecodePayload

func (tx *DynamicFeeTx) DecodePayload(b []byte) error

DecodePayload parses the RLP payload following the type byte.

func (*DynamicFeeTx) EncodeJSONTx

func (tx *DynamicFeeTx) EncodeJSONTx(fields map[string]any)

EncodeJSONTx adds the dynamic fee transaction's fields.

func (*DynamicFeeTx) EncodePayload

func (tx *DynamicFeeTx) EncodePayload(w *bytes.Buffer) error

EncodePayload writes the RLP payload following the type byte.

func (*DynamicFeeTx) GetAccessList

func (tx *DynamicFeeTx) GetAccessList() AccessList

GetAccessList returns the EIP-2930 access list.

func (*DynamicFeeTx) GetChainID

func (tx *DynamicFeeTx) GetChainID() *big.Int

GetChainID returns the destination chain id.

func (*DynamicFeeTx) GetData

func (tx *DynamicFeeTx) GetData() []byte

GetData returns the transaction calldata.

func (*DynamicFeeTx) GetGas

func (tx *DynamicFeeTx) GetGas() uint64

GetGas returns the gas limit.

func (*DynamicFeeTx) GetGasFeeCap

func (tx *DynamicFeeTx) GetGasFeeCap() *big.Int

GetGasFeeCap returns the maximum fee per gas.

func (*DynamicFeeTx) GetGasPrice

func (tx *DynamicFeeTx) GetGasPrice() *big.Int

GetGasPrice returns the fee cap. EIP-1559 transactions have no single gas price; the fee cap is the value a sender is charged against in the worst case.

func (*DynamicFeeTx) GetGasTipCap

func (tx *DynamicFeeTx) GetGasTipCap() *big.Int

GetGasTipCap returns the maximum priority fee per gas.

func (*DynamicFeeTx) GetNonce

func (tx *DynamicFeeTx) GetNonce() uint64

GetNonce returns the sender account nonce.

func (*DynamicFeeTx) GetSignatureValues

func (tx *DynamicFeeTx) GetSignatureValues() (v, r, s *big.Int)

GetSignatureValues returns the signature values as encoded.

func (*DynamicFeeTx) GetTo

func (tx *DynamicFeeTx) GetTo() *common.Address

GetTo returns the recipient, or nil for contract creation.

func (*DynamicFeeTx) GetValue

func (tx *DynamicFeeTx) GetValue() *big.Int

GetValue returns the transferred amount in wei.

func (*DynamicFeeTx) SetSignatureValues

func (tx *DynamicFeeTx) SetSignatureValues(chainID, v, r, s *big.Int)

SetSignatureValues stores a signature. Typed transactions encode v as the raw y-parity bit.

func (*DynamicFeeTx) SigningHash

func (tx *DynamicFeeTx) SigningHash(chainID *big.Int) common.Hash

SigningHash returns the digest the sender signs.

func (*DynamicFeeTx) TxType

func (tx *DynamicFeeTx) TxType() byte

TxType returns the EIP-2718 type byte.

type ECDSASignedTx

type ECDSASignedTx interface {
	// SigningHash returns the digest the sender signs.
	SigningHash(chainID *big.Int) common.Hash

	// GetSignatureValues returns the signature values as encoded.
	GetSignatureValues() (v, r, s *big.Int)

	// SetSignatureValues stores a signature on the transaction.
	SetSignatureValues(chainID, v, r, s *big.Int)
}

ECDSASignedTx is implemented by transaction types authenticated by a single secp256k1 signature carried in v/r/s fields (types 0x00 - 0x04).

type ExplicitSenderTx

type ExplicitSenderTx interface {
	// GetSender returns the transaction's declared sender.
	GetSender() common.Address

	// SignPayload signs the transaction's internal signature material with key.
	SignPayload(chainID *big.Int, key *ecdsa.PrivateKey) error
}

ExplicitSenderTx is implemented by transaction types that carry their sender as an explicit field rather than deriving it from a signature. Their signature material is internal to the payload, so they sign themselves.

type Frame

type Frame struct {
	Mode   FrameMode
	Flags  uint8
	Target *common.Address `rlp:"nil"` // nil resolves to tx.sender
	Limits FrameLimits
	Value  *uint256.Int
	Data   []byte
}

Frame is a single call in a frame transaction.

func DeployFrame

func DeployFrame(factory common.Address, data []byte, limits FrameLimits) *Frame

DeployFrame builds a DEFAULT frame that deploys the sender's account code, typically by calling a deterministic factory. It must be the first frame.

func ExpiryFrame

func ExpiryFrame(deadline uint64, executionGas uint64) *Frame

ExpiryFrame builds a VERIFY frame calling the expiry verifier predeploy, which reverts once the deadline has passed. It may only be the first frame, and nodes drop the transaction from the mempool once the deadline is in the past.

func OnlyVerifyFrame

func OnlyVerifyFrame(limits FrameLimits) *Frame

OnlyVerifyFrame builds a VERIFY frame that approves execution but not payment, leaving payment to a following pay frame.

func PayFrame

func PayFrame(paymaster common.Address, data []byte, limits FrameLimits) *Frame

PayFrame builds a VERIFY frame in which a paymaster approves payment.

func PostOpFrame

func PostOpFrame(target common.Address, data []byte, limits FrameLimits) *Frame

PostOpFrame builds a DEFAULT frame that runs after the user operations, used by paymasters for settlement.

func PostTxFrame

func PostTxFrame(target common.Address, data []byte, limits FrameLimits) *Frame

PostTxFrame builds an EIP-7906 POST_TX assertion frame.

Not to be confused with PostOpFrame: that is a DEFAULT frame a paymaster uses to settle up, this is a STATICCALL-semantics assertion that may not APPROVE and whose failure reverts the whole execution body. POST_TX frames must be a trailing suffix of the frame list.

func RecentRootVerifyFrame

func RecentRootVerifyFrame(references []*RecentRootReference, executionGas uint64) *Frame

RecentRootVerifyFrame builds an EIP-8272 recent root verifier frame: a VERIFY frame calling the recent root contract with the packed references, which reverts unless every one is a root its source committed within the usable window.

In a public-mempool transaction it sits directly after the optional expiry frame and before everything else; its execution budget is excluded from the MaxVerifyGas cap.

func SelfVerifyFrame

func SelfVerifyFrame(limits FrameLimits) *Frame

SelfVerifyFrame builds a VERIFY frame that approves both execution and payment for the sender. It is the single-frame validation prefix used by self-relayed transactions.

func UserOpFrame

func UserOpFrame(target *common.Address, value *uint256.Int, data []byte, limits FrameLimits) *Frame

UserOpFrame builds a SENDER frame: the user operation, executed with tx.sender as the caller. A nil target resolves to the sender itself.

func (*Frame) ApprovalScope

func (f *Frame) ApprovalScope() uint8

ApprovalScope returns the approval scope bits of the frame's flags.

func (*Frame) Copy

func (f *Frame) Copy() *Frame

Copy returns a deep copy of the frame.

func (*Frame) ExpiryDeadline

func (f *Frame) ExpiryDeadline() (uint64, bool)

ExpiryDeadline returns the deadline encoded in an expiry verifier frame's data.

func (*Frame) IsAtomicBatch

func (f *Frame) IsAtomicBatch() bool

IsAtomicBatch reports whether the frame is batched with the frames that follow.

func (*Frame) IsExpiryVerifier

func (f *Frame) IsExpiryVerifier() bool

IsExpiryVerifier reports whether the frame is an expiry verifier frame. Any VERIFY frame targeting EXPIRY_VERIFIER is one, whatever its flags; the flags are then constrained by the frame's own validity rules.

func (*Frame) IsRecentRootVerifier

func (f *Frame) IsRecentRootVerifier() bool

IsRecentRootVerifier reports whether the frame is an EIP-8272 recent root verifier frame: a VERIFY frame targeting RECENT_ROOT_ADDRESS with zero flags, value and state budget, whose data is one to MaxRecentRootReferences whole tuples.

A VERIFY frame at that target which misses one of the conditions is still a valid frame; it merely is not the canonical one, so the public mempool does not treat it as a protocol verifier.

func (*Frame) ResolvedTarget

func (f *Frame) ResolvedTarget(sender common.Address) common.Address

ResolvedTarget returns the frame's target, resolving a nil target to sender.

func (*Frame) Species

func (f *Frame) Species(sender common.Address) FrameSpecies

Species classifies the frame for mempool prefix matching.

func (*Frame) WithAtomicBatch

func (f *Frame) WithAtomicBatch() *Frame

WithAtomicBatch marks the frame as batched with the frames that follow it. All frames in a batch succeed or all of them revert.

type FrameExtensions

type FrameExtensions uint8

FrameExtensions records which envelope extensions a frame transaction uses.

EIP-8250 amends EIP-8141's payload, so a chain may run either shape. The set has to travel with the transaction: it decides the wire layout, and it distinguishes a chain without keyed nonces from one whose transaction happened to use key zero.

EIP-8272 is not an envelope extension: it verifies recent roots through a canonical VERIFY frame, so a chain running it changes nothing about the payload layout.

const (
	// FrameExtKeyedNonces is EIP-8250: nonce becomes nonce_keys, nonce_seq.
	FrameExtKeyedNonces FrameExtensions = 1 << iota
)

Envelope extensions.

func (FrameExtensions) Has

func (e FrameExtensions) Has(want FrameExtensions) bool

Has reports whether every extension in want is present.

func (FrameExtensions) String

func (e FrameExtensions) String() string

String names the active extensions.

type FrameFees

type FrameFees struct {
	GasTipCap  *uint256.Int
	GasFeeCap  *uint256.Int
	BlobFeeCap *uint256.Int
}

FrameFees holds a frame transaction's EIP-1559 and blob fee parameters.

type FrameLimits

type FrameLimits struct {
	Execution uint64
	State     uint64
}

FrameLimits is a frame's two-dimensional gas budget.

func DefaultCodeVerifyLimits

func DefaultCodeVerifyLimits(senderExists bool) FrameLimits

DefaultCodeVerifyLimits returns a validation frame budget sized for an account with no deployed code.

The default code draws no execution gas of its own: the frame's only execution charge is the resolved target's EIP-2929 account access, and the sender is warm from the start of the transaction. State gas is only needed when the sender account does not exist yet, in which case APPROVE charges for creating it.

type FrameMode

type FrameMode uint8

FrameMode is a frame's execution context.

const (
	FrameModeDefault FrameMode = 0 // caller is ENTRY_POINT
	FrameModeVerify  FrameMode = 1 // STATICCALL semantics, must not revert
	FrameModeSender  FrameMode = 2 // caller is tx.sender, may carry value

	// FrameModePostTx is EIP-7906's assertion mode: STATICCALL semantics with no
	// APPROVE exception, restricted to a trailing suffix of the frame list. Its
	// failure reverts the whole execution body rather than one atomic batch.
	FrameModePostTx FrameMode = 3
)

Frame modes.

type FrameReceipt

type FrameReceipt struct {
	Status       uint64
	ExecutionGas uint64
	StateGas     uint64
	Logs         []*Log
}

FrameReceipt is the result of executing one frame.

func (*FrameReceipt) Skipped

func (r *FrameReceipt) Skipped() bool

Skipped reports whether the frame was skipped by an atomic batch rollback.

func (*FrameReceipt) Successful

func (r *FrameReceipt) Successful() bool

Successful reports whether the frame executed successfully.

type FrameReceiptExtra

type FrameReceiptExtra struct {
	Payer  common.Address
	Frames []*FrameReceipt
}

FrameReceiptExtra is the frame-transaction-specific part of a receipt.

EIP-8141 receipts carry no transaction-level status: the only statuses they hold are the per-frame ones, and a single status has to be derived from them.

func (*FrameReceiptExtra) DerivedStatus

func (e *FrameReceiptExtra) DerivedStatus() uint64

DerivedStatus returns the transaction status derived from the frame statuses: a transaction succeeded when no executed frame failed.

func (*FrameReceiptExtra) DurableFrames

func (e *FrameReceiptExtra) DurableFrames(tx *FrameTx) []bool

DurableFrames reports, per frame, whether that frame's state changes survived the transaction.

A frame receipt's status says whether the frame executed successfully, not whether its effects lasted. Two rules discard the effects of frames that report success:

  • an atomic batch that fails is unrolled, so the frames before the failure inside it lose their state changes and logs while keeping their status;
  • a failing POST_TX frame (EIP-7906) reverts the entire execution body, so every frame after the validation prefix loses its effects.

Frames of the validation prefix are always durable: their changes are committed even when the body reverts.

func (*FrameReceiptExtra) EncodeReceiptJSON

func (e *FrameReceiptExtra) EncodeReceiptJSON(fields map[string]any)

EncodeReceiptJSON adds the frame-specific receipt fields, using the key names the decoder reads back.

func (*FrameReceiptExtra) FailedFrame

func (e *FrameReceiptExtra) FailedFrame() int

FailedFrame returns the index of the first frame that failed, or -1.

func (*FrameReceiptExtra) PostTxReverted

func (e *FrameReceiptExtra) PostTxReverted(tx *FrameTx) bool

PostTxReverted reports whether a POST_TX frame failed, which under EIP-7906 reverts the whole execution body rather than one atomic batch.

The receipt alone cannot answer this: frame modes live on the transaction, so the transaction has to be supplied.

func (*FrameReceiptExtra) ReceiptTxType

func (e *FrameReceiptExtra) ReceiptTxType() byte

ReceiptTxType returns the transaction type this content belongs to.

func (*FrameReceiptExtra) TotalExecutionGas

func (e *FrameReceiptExtra) TotalExecutionGas() uint64

TotalExecutionGas returns the execution gas used across all frames.

func (*FrameReceiptExtra) TotalStateGas

func (e *FrameReceiptExtra) TotalStateGas() uint64

TotalStateGas returns the state gas attributed across all frames after refills.

type FrameSigScheme

type FrameSigScheme uint8

FrameSigScheme identifies how a signature entry's raw bytes are interpreted.

const (
	SigSchemeArbitrary FrameSigScheme = 0x0
	SigSchemeSecp256k1 FrameSigScheme = 0x1
	SigSchemeP256      FrameSigScheme = 0x2
)

Signature schemes and their verification costs.

type FrameSignature

type FrameSignature struct {
	Scheme    FrameSigScheme
	Signer    []byte // 20-byte address, or empty for tx.sender
	Msg       []byte // empty for the canonical signature hash, or a 32-byte digest
	Signature []byte
}

FrameSignature is one entry of a frame transaction's signature list.

func ArbitrarySignature

func ArbitrarySignature(witness []byte) *FrameSignature

ArbitrarySignature builds an ARBITRARY witness entry. The protocol does not validate it; contracts read it with SIGDATACOPY.

func SenderSignature

func SenderSignature() *FrameSignature

SenderSignature builds an unsigned SECP256K1 entry authorizing the canonical signature hash on the sender's behalf. The default account code requires this entry at index 0 when the verify frame approves execution, and at index 1 otherwise.

func SignerSignature

func SignerSignature(signer common.Address) *FrameSignature

SignerSignature builds an unsigned SECP256K1 entry for an explicit signer.

func (*FrameSignature) Copy

func (s *FrameSignature) Copy() *FrameSignature

Copy returns a deep copy of the signature entry.

func (*FrameSignature) ResolvedSigner

func (s *FrameSignature) ResolvedSigner(sender common.Address) (common.Address, bool)

ResolvedSigner returns the entry's signer, resolving an empty signer to sender. It reports false for ARBITRARY entries, which have no protocol-assigned signer.

func (*FrameSignature) VerificationGas

func (s *FrameSignature) VerificationGas() (uint64, error)

VerificationGas returns the entry's protocol signature verification cost.

type FrameSpecies

type FrameSpecies string

FrameSpecies classifies a frame for public mempool validation.

const (
	SpeciesSelfVerify   FrameSpecies = "self_verify"   // VERIFY, flags 0x3
	SpeciesOnlyVerify   FrameSpecies = "only_verify"   // VERIFY, flags 0x2
	SpeciesPay          FrameSpecies = "pay"           // VERIFY, flags 0x1
	SpeciesExpiryVerify FrameSpecies = "expiry_verify" // VERIFY, flags 0x0, target EXPIRY_VERIFIER
	SpeciesDeploy       FrameSpecies = "deploy"        // DEFAULT, flags 0x0
	SpeciesUserOp       FrameSpecies = "user_op"       // SENDER
	SpeciesPostOp       FrameSpecies = "post_op"       // DEFAULT with flags
	SpeciesPostTx       FrameSpecies = "post_tx"       // POST_TX (EIP-7906)
	SpeciesOther        FrameSpecies = "other"

	// SpeciesRecentRootVerify is EIP-8272's canonical frame: VERIFY, flags 0x0, target
	// RECENT_ROOT_ADDRESS, whole tuples as data.
	SpeciesRecentRootVerify FrameSpecies = "recent_root_verify"
)

Frame species recognized by the public mempool rules.

type FrameTx

type FrameTx struct {
	ChainID    *uint256.Int
	NonceKeys  []*uint256.Int
	NonceSeq   uint64
	Sender     common.Address
	Frames     []*Frame
	Signatures []*FrameSignature
	Fees       FrameFees
	BlobHashes []common.Hash

	// Extensions selects the envelope shape. It is not itself encoded.
	Extensions FrameExtensions `rlp:"-"`

	// Sidecar is wire-only data, excluded from the canonical encoding and the hash.
	Sidecar *BlobSidecar `rlp:"-"`
}

FrameTx is an EIP-8141 frame transaction, with the envelope extension of EIP-8250 (keyed nonces).

Its sender is an explicit field rather than something recovered from a signature, and its signature list is validated by the protocol before any frame executes.

EIP-8250 replaces EIP-8141's single nonce with NonceKeys and NonceSeq. NonceKeys of exactly [0] selects the sender's ordinary account nonce, which is what a transaction that does not use independent nonce domains carries.

func NewFrameTx

func NewFrameTx(chainID *uint256.Int, sender common.Address, nonce uint64, fees FrameFees, frames []*Frame, signatures []*FrameSignature) *FrameTx

NewFrameTx assembles a frame transaction from its parts, filling in the zero values the encoder requires.

It builds the envelope shape current devnets run, with both extensions active and the nonce in EIP-8250's [0] key set, which is the sender's ordinary account nonce. Use NewFrameTxWithExtensions for a chain running a different combination.

func NewFrameTxWithExtensions

func NewFrameTxWithExtensions(extensions FrameExtensions, chainID *uint256.Int, sender common.Address, nonce uint64, fees FrameFees, frames []*Frame, signatures []*FrameSignature) *FrameTx

NewFrameTxWithExtensions assembles a frame transaction in a chosen envelope shape.

func (*FrameTx) CalldataFloorGas

func (tx *FrameTx) CalldataFloorGas() uint64

CalldataFloorGas returns the EIP-7976 floor cost of the transaction's data.

func (*FrameTx) CopyTx

func (tx *FrameTx) CopyTx() TxData

CopyTx returns a deep copy with all fields initialized. The sidecar is shared, as for blob transactions.

func (*FrameTx) DecodeJSONTx

func (tx *FrameTx) DecodeJSONTx(fields *JSONTxFields) error

DecodeJSONTx populates a frame transaction from a JSON-RPC transaction object.

Blob sidecars are not part of the JSON-RPC representation.

func (*FrameTx) DecodePayload

func (tx *FrameTx) DecodePayload(b []byte) error

DecodePayload parses either the canonical payload or the EIP-7594 wrapper. The two are told apart by whether the first element is itself a list, as for blob transactions.

func (*FrameTx) EncodeJSONTx

func (tx *FrameTx) EncodeJSONTx(fields map[string]any)

EncodeJSONTx adds the frame transaction's fields, using the key names its decoder reads back. A frame transaction has no single recipient, so "to" is dropped.

func (*FrameTx) EncodeNetworkPayload

func (tx *FrameTx) EncodeNetworkPayload(w *bytes.Buffer) error

EncodeNetworkPayload writes the payload including the blob sidecar, using the EIP-7594 wrapper. Frame transactions have no unversioned wrapper form.

func (*FrameTx) EncodePayload

func (tx *FrameTx) EncodePayload(w *bytes.Buffer) error

EncodePayload writes the canonical payload, without the blob sidecar, in the shape the transaction's extensions select.

func (*FrameTx) ExecutionGas

func (tx *FrameTx) ExecutionGas() uint64

ExecutionGas returns the intrinsic cost plus the declared frame execution budgets, which is the transaction's reservation against the block execution gas dimension.

func (*FrameTx) GetBlobGasFeeCap

func (tx *FrameTx) GetBlobGasFeeCap() *big.Int

GetBlobGasFeeCap returns the maximum fee per blob gas.

func (*FrameTx) GetBlobHashes

func (tx *FrameTx) GetBlobHashes() []common.Hash

GetBlobHashes returns the blob versioned hashes.

func (*FrameTx) GetBlobSidecar

func (tx *FrameTx) GetBlobSidecar() *BlobSidecar

GetBlobSidecar returns the attached sidecar, or nil.

func (*FrameTx) GetChainID

func (tx *FrameTx) GetChainID() *big.Int

GetChainID returns the destination chain id.

func (*FrameTx) GetData

func (tx *FrameTx) GetData() []byte

GetData returns the calldata of the first SENDER frame, or nil.

func (*FrameTx) GetGas

func (tx *FrameTx) GetGas() uint64

GetGas returns the maximum gas the transaction can consume, which is the budget the payer is charged against.

func (*FrameTx) GetGasFeeCap

func (tx *FrameTx) GetGasFeeCap() *big.Int

GetGasFeeCap returns the maximum fee per gas.

func (*FrameTx) GetGasPrice

func (tx *FrameTx) GetGasPrice() *big.Int

GetGasPrice returns the fee cap.

func (*FrameTx) GetGasTipCap

func (tx *FrameTx) GetGasTipCap() *big.Int

GetGasTipCap returns the maximum priority fee per gas.

func (*FrameTx) GetNonce

func (tx *FrameTx) GetNonce() uint64

GetNonce returns the nonce sequence number. For the ordinary [0] key set this is the sender's account nonce, which is what the engine tracks.

func (*FrameTx) GetSender

func (tx *FrameTx) GetSender() common.Address

GetSender returns the transaction's declared sender.

func (*FrameTx) GetStateGas

func (tx *FrameTx) GetStateGas() uint64

GetStateGas returns the sum of the declared frame state gas budgets, which is the transaction's reservation against the EIP-8037 block state gas dimension.

func (*FrameTx) GetTo

func (tx *FrameTx) GetTo() *common.Address

GetTo returns the resolved target of the first SENDER frame, or nil when the transaction has none. A frame transaction has no single recipient; this is the closest equivalent for engine-level accounting and logging.

func (*FrameTx) GetValue

func (tx *FrameTx) GetValue() *big.Int

GetValue returns the sum of all frame values.

func (*FrameTx) HasKeyedNonces

func (tx *FrameTx) HasKeyedNonces() bool

HasKeyedNonces reports whether the transaction uses EIP-8250's keyed nonce fields at all, as opposed to EIP-8141's scalar nonce.

func (*FrameTx) IntrinsicGas

func (tx *FrameTx) IntrinsicGas() uint64

IntrinsicGas returns the transaction's intrinsic cost, which is derivable from the transaction fields alone and charged entirely in the execution dimension.

func (*FrameTx) MaxCost

func (tx *FrameTx) MaxCost(blobBaseFee *big.Int) *big.Int

MaxCost returns the amount the payer is charged up front when payment is approved.

func (*FrameTx) MaxGas

func (tx *FrameTx) MaxGas() uint64

MaxGas returns the maximum gas the transaction can consume across both dimensions.

func (*FrameTx) PostTxIndex

func (tx *FrameTx) PostTxIndex() int

PostTxIndex returns the index of the first POST_TX frame, or -1 when the transaction has none.

func (*FrameTx) SetBlobSidecar

func (tx *FrameTx) SetBlobSidecar(sidecar *BlobSidecar)

SetBlobSidecar attaches a sidecar.

func (*FrameTx) SigHash

func (tx *FrameTx) SigHash() common.Hash

SigHash returns the canonical signature hash.

Signature entries that sign the canonical digest have their own raw bytes elided from the preimage; entries carrying an explicit digest keep theirs.

func (*FrameTx) SignEntry

func (tx *FrameTx) SignEntry(index int, key *ecdsa.PrivateKey) error

SignEntry signs a single signature entry with key.

The digest is the entry's explicit msg when it carries one, and the canonical signature hash otherwise. Because the canonical hash covers every entry's metadata, entries must be fully populated before any of them is signed.

func (*FrameTx) SignEntryP256

func (tx *FrameTx) SignEntryP256(index int, key *ecdsa.PrivateKey) error

SignEntryP256 signs a signature entry with a NIST P-256 key, filling in both the signature and the derived signer address.

func (*FrameTx) SignPayload

func (tx *FrameTx) SignPayload(chainID *big.Int, key *ecdsa.PrivateKey) error

SignPayload signs every unsigned SECP256K1 entry that the key is the signer for.

An entry qualifies when it carries no signature yet and its signer is either empty (resolving to the sender) or the key's own address. Entries for other parties, such as a paymaster's, are signed with SignEntry.

func (*FrameTx) SignatureVerificationGas

func (tx *FrameTx) SignatureVerificationGas() (uint64, error)

SignatureVerificationGas returns the total protocol signature verification cost.

func (*FrameTx) TxType

func (tx *FrameTx) TxType() byte

TxType returns the EIP-2718 type byte.

func (*FrameTx) UsesAccountNonce

func (tx *FrameTx) UsesAccountNonce() bool

UsesAccountNonce reports whether NonceSeq addresses the sender's account nonce, which implements IndependentNonceTx for the engine's nonce tracking.

func (*FrameTx) UsesLegacyNonce

func (tx *FrameTx) UsesLegacyNonce() bool

UsesLegacyNonce reports whether NonceSeq is the sender's ordinary account nonce: either the transaction predates keyed nonces, or it selects only key zero.

func (*FrameTx) ValidateMempoolPrefix

func (tx *FrameTx) ValidateMempoolPrefix() error

ValidateMempoolPrefix checks the public mempool policy of EIP-8141 and EIP-8272: the validation prefix, after the optional leading protocol verifier frames, must match one of the four recognized shapes and stay within the verification gas caps.

A transaction failing this check may still be valid in a block; it just will not propagate through the public mempool.

func (*FrameTx) ValidatePayload

func (tx *FrameTx) ValidatePayload() error

ValidatePayload checks the constraints that are decidable from the transaction fields alone, mirroring the static assertions in EIP-8141.

func (*FrameTx) ValidationPrefixLength

func (tx *FrameTx) ValidationPrefixLength() int

ValidationPrefixLength returns the number of leading frames that make up the validation prefix: the shortest prefix whose successful execution sets the payer. It returns 0 when no frame in the transaction approves payment.

func (*FrameTx) VerifySignatures

func (tx *FrameTx) VerifySignatures() error

VerifySignatures checks every protocol-validated signature entry against the digest it authorizes, which is what a client does before executing any frame.

It is kept separate from ValidatePayload because it recovers public keys, while ValidatePayload only checks what is decidable from the encoded fields.

func (*FrameTx) WithNonceKeys

func (tx *FrameTx) WithNonceKeys(keys []*uint256.Int, seq uint64) *FrameTx

WithNonceKeys selects an EIP-8250 key set and its shared sequence number.

Every selected key must currently sit at seq, and a successful payment approval moves all of them to seq+1 together. Keys must be strictly increasing and the zero key may only appear alone.

type Header struct {
	Hash       common.Hash
	ParentHash common.Hash
	Number     uint64
	Timestamp  uint64
	GasLimit   uint64
	GasUsed    uint64
	BaseFee    *big.Int

	// BlobGasUsed and ExcessBlobGas are EIP-4844 fields, zero before Cancun.
	BlobGasUsed   uint64
	ExcessBlobGas uint64

	// StateGasUsed is the EIP-8037 state gas dimension, zero on chains that do not
	// report it.
	StateGasUsed uint64
}

Header carries the block fields spamoor uses. It is a subset of the consensus header, decoded permissively so unknown fields from a new fork cannot break block processing.

func (*Header) UnmarshalJSON

func (h *Header) UnmarshalJSON(input []byte) error

UnmarshalJSON decodes a header from a JSON-RPC block response.

type IndependentNonceTx

type IndependentNonceTx interface {
	// UsesAccountNonce reports whether GetNonce addresses the sender's account nonce.
	UsesAccountNonce() bool
}

IndependentNonceTx is implemented by transaction types whose nonce does not address the sender's account nonce sequence, such as a frame transaction on a non-zero EIP-8250 key set. Anything tracking transactions by account nonce has to ask before assuming.

type JSONTxData

type JSONTxData interface {
	// DecodeJSONTx populates the transaction from parsed JSON-RPC fields.
	DecodeJSONTx(fields *JSONTxFields) error
}

JSONTxData is implemented by transaction types that can be reconstructed from a JSON-RPC transaction object. Types that do not implement it decode as UnknownTx.

type JSONTxEncoder

type JSONTxEncoder interface {
	// EncodeJSONTx adds the type's fields to the object.
	EncodeJSONTx(fields map[string]any)
}

JSONTxEncoder is implemented by transaction types that can render themselves as a JSON-RPC transaction object. Types that do not implement it marshal with the common fields only.

type JSONTxFields

type JSONTxFields struct {
	Raw json.RawMessage `json:"-"`

	Type                 *hexutil.Uint64        `json:"type"`
	ChainID              *hexutil.Big           `json:"chainId"`
	Nonce                *hexutil.Uint64        `json:"nonce"`
	GasPrice             *hexutil.Big           `json:"gasPrice"`
	MaxPriorityFeePerGas *hexutil.Big           `json:"maxPriorityFeePerGas"`
	MaxFeePerGas         *hexutil.Big           `json:"maxFeePerGas"`
	MaxFeePerBlobGas     *hexutil.Big           `json:"maxFeePerBlobGas"`
	Gas                  *hexutil.Uint64        `json:"gas"`
	To                   *common.Address        `json:"to"`
	Value                *hexutil.Big           `json:"value"`
	Input                *hexutil.Bytes         `json:"input"`
	AccessList           *AccessList            `json:"accessList"`
	BlobVersionedHashes  []common.Hash          `json:"blobVersionedHashes"`
	AuthorizationList    []SetCodeAuthorization `json:"authorizationList"`
	V                    *hexutil.Big           `json:"v"`
	YParity              *hexutil.Uint64        `json:"yParity"`
	R                    *hexutil.Big           `json:"r"`
	S                    *hexutil.Big           `json:"s"`

	From *common.Address `json:"from"`
	Hash *common.Hash    `json:"hash"`
}

JSONTxFields holds the transaction fields returned by the standard JSON-RPC methods. Fields are pointers so absent can be told from zero; Raw carries the original object for types with fields not covered here.

type LegacyTx

type LegacyTx struct {
	Nonce    uint64          // nonce of sender account
	GasPrice *big.Int        // wei per gas
	Gas      uint64          // gas limit
	To       *common.Address `rlp:"nil"` // nil means contract creation
	Value    *big.Int        // wei amount
	Data     []byte          // contract invocation input data
	V, R, S  *big.Int        // signature values
}

LegacyTx is a pre-EIP-2718 transaction.

Field order and RLP tags mirror the consensus encoding exactly; the struct is encoded and decoded as a plain RLP list with no type prefix.

func (*LegacyTx) CopyTx

func (tx *LegacyTx) CopyTx() TxData

CopyTx returns a deep copy with all fields initialized.

func (*LegacyTx) DecodeJSONTx

func (tx *LegacyTx) DecodeJSONTx(fields *JSONTxFields) error

DecodeJSONTx populates a legacy transaction from JSON-RPC fields.

func (*LegacyTx) DecodePayload

func (tx *LegacyTx) DecodePayload(b []byte) error

DecodePayload parses the plain RLP list.

func (*LegacyTx) EncodeJSONTx

func (tx *LegacyTx) EncodeJSONTx(fields map[string]any)

EncodeJSONTx adds the legacy transaction's fields.

func (*LegacyTx) EncodePayload

func (tx *LegacyTx) EncodePayload(w *bytes.Buffer) error

EncodePayload writes the plain RLP list; legacy transactions carry no type prefix.

func (*LegacyTx) GetChainID

func (tx *LegacyTx) GetChainID() *big.Int

GetChainID returns the chain id encoded in the EIP-155 signature, or zero for unprotected transactions.

func (*LegacyTx) GetData

func (tx *LegacyTx) GetData() []byte

GetData returns the transaction calldata.

func (*LegacyTx) GetGas

func (tx *LegacyTx) GetGas() uint64

GetGas returns the gas limit.

func (*LegacyTx) GetGasFeeCap

func (tx *LegacyTx) GetGasFeeCap() *big.Int

GetGasFeeCap returns the gas price; legacy transactions have no separate fee cap.

func (*LegacyTx) GetGasPrice

func (tx *LegacyTx) GetGasPrice() *big.Int

GetGasPrice returns the wei per gas the sender pays.

func (*LegacyTx) GetGasTipCap

func (tx *LegacyTx) GetGasTipCap() *big.Int

GetGasTipCap returns the gas price; legacy transactions have no separate tip.

func (*LegacyTx) GetNonce

func (tx *LegacyTx) GetNonce() uint64

GetNonce returns the sender account nonce.

func (*LegacyTx) GetSignatureValues

func (tx *LegacyTx) GetSignatureValues() (v, r, s *big.Int)

GetSignatureValues returns the signature values as encoded.

func (*LegacyTx) GetTo

func (tx *LegacyTx) GetTo() *common.Address

GetTo returns the recipient, or nil for contract creation.

func (*LegacyTx) GetValue

func (tx *LegacyTx) GetValue() *big.Int

GetValue returns the transferred amount in wei.

func (*LegacyTx) SetSignatureValues

func (tx *LegacyTx) SetSignatureValues(chainID, v, r, s *big.Int)

SetSignatureValues stores a signature, applying the EIP-155 v offset when chainID is set and the pre-155 offset otherwise.

func (*LegacyTx) SigningHash

func (tx *LegacyTx) SigningHash(chainID *big.Int) common.Hash

SigningHash returns the EIP-155 signing digest, or the pre-155 digest when chainID is nil or zero.

func (*LegacyTx) TxType

func (tx *LegacyTx) TxType() byte

TxType returns the EIP-2718 type byte.

type Log

type Log = types.Log

Log is an EVM log record as returned in receipts.

type NetworkEncodedTx

type NetworkEncodedTx interface {
	// EncodeNetworkPayload writes the payload as it is sent to eth_sendRawTransaction
	// and gossiped in PooledTransactions.
	EncodeNetworkPayload(w *bytes.Buffer) error
}

NetworkEncodedTx is implemented by transaction types whose wire encoding differs from the canonical (block/hash) encoding, such as blob transactions carrying a sidecar.

type Receipt

type Receipt struct {
	Type              uint8
	PostState         []byte
	Status            uint64
	CumulativeGasUsed uint64
	Bloom             Bloom
	Logs              []*Log
	TxHash            common.Hash
	ContractAddress   common.Address
	GasUsed           uint64
	EffectiveGasPrice *big.Int
	BlobGasUsed       uint64
	BlobGasPrice      *big.Int
	BlockHash         common.Hash
	BlockNumber       *big.Int
	TransactionIndex  uint

	// Extra carries type-specific receipt content, or nil when the type has none.
	Extra ReceiptExtra
}

Receipt is the result of executing a transaction. Field names and types mirror go-ethereum's types.Receipt. Type-specific content lives in Extra, decoded by the receipt decoder registered for the transaction type.

func FromGethReceipt

func FromGethReceipt(receipt *types.Receipt) *Receipt

FromGethReceipt converts a go-ethereum receipt into a spamoor receipt.

func (*Receipt) FrameExtra

func (r *Receipt) FrameExtra() *FrameReceiptExtra

FrameExtra returns the frame-specific content of a receipt, or nil.

func (*Receipt) MarshalJSON

func (r *Receipt) MarshalJSON() ([]byte, error)

MarshalJSON renders the receipt as a JSON-RPC receipt object.

This is the inverse of UnmarshalJSON. Without it the default encoder would emit Go field names, which the decoder cannot read back.

func (*Receipt) Successful

func (r *Receipt) Successful() bool

Successful reports whether the transaction executed successfully.

func (*Receipt) ToGethReceipt

func (r *Receipt) ToGethReceipt() *types.Receipt

ToGethReceipt converts a spamoor receipt into a go-ethereum receipt. Type-specific extensions have no representation there and are dropped.

func (*Receipt) UnmarshalJSON

func (r *Receipt) UnmarshalJSON(input []byte) error

UnmarshalJSON decodes a receipt from a JSON-RPC response.

type ReceiptDecoder

type ReceiptDecoder func(receipt *Receipt, raw json.RawMessage) error

ReceiptDecoder parses the type-specific part of a receipt from the raw JSON-RPC response. It may also fill in generic fields the type does not report directly, such as deriving a status.

type ReceiptExtra

type ReceiptExtra interface {
	// ReceiptTxType returns the transaction type this content belongs to.
	ReceiptTxType() byte
}

ReceiptExtra is type-specific receipt content.

type ReceiptExtraEncoder

type ReceiptExtraEncoder interface {
	// EncodeReceiptJSON adds the type's fields to the object.
	EncodeReceiptJSON(fields map[string]any)
}

ReceiptExtraEncoder is implemented by type-specific receipt content that can render itself back into a JSON-RPC receipt object.

type RecentRootReference

type RecentRootReference struct {
	SourceID common.Hash
	Slot     uint64
	Root     common.Hash
}

RecentRootReference is one tuple of an EIP-8272 recent root verifier frame: a root a source committed during a slot.

func ParseRecentRootVerifyData

func ParseRecentRootVerifyData(data []byte) ([]*RecentRootReference, error)

ParseRecentRootVerifyData unpacks validation calldata into its references. It rejects what the contract rejects: empty data, a length that is not whole tuples, or more than MaxRecentRootReferences of them.

func (*RecentRootReference) Copy

Copy returns a copy of the reference.

type SetCodeAuthorization

type SetCodeAuthorization = types.SetCodeAuthorization

SetCodeAuthorization is an EIP-7702 authorization tuple.

func SignAuthorization

func SignAuthorization(auth SetCodeAuthorization, key *ecdsa.PrivateKey) (SetCodeAuthorization, error)

SignAuthorization signs an EIP-7702 authorization tuple.

type SetCodeTx

type SetCodeTx struct {
	ChainID    *uint256.Int
	Nonce      uint64
	GasTipCap  *uint256.Int // a.k.a. maxPriorityFeePerGas
	GasFeeCap  *uint256.Int // a.k.a. maxFeePerGas
	Gas        uint64
	To         common.Address
	Value      *uint256.Int
	Data       []byte
	AccessList AccessList
	AuthList   []SetCodeAuthorization

	V, R, S *uint256.Int // signature values
}

SetCodeTx is an EIP-7702 transaction.

func (*SetCodeTx) CopyTx

func (tx *SetCodeTx) CopyTx() TxData

CopyTx returns a deep copy with all fields initialized.

func (*SetCodeTx) DecodeJSONTx

func (tx *SetCodeTx) DecodeJSONTx(fields *JSONTxFields) error

DecodeJSONTx populates a set code transaction from JSON-RPC fields.

func (*SetCodeTx) DecodePayload

func (tx *SetCodeTx) DecodePayload(b []byte) error

DecodePayload parses the RLP payload following the type byte.

func (*SetCodeTx) EncodeJSONTx

func (tx *SetCodeTx) EncodeJSONTx(fields map[string]any)

EncodeJSONTx adds the set code transaction's fields.

func (*SetCodeTx) EncodePayload

func (tx *SetCodeTx) EncodePayload(w *bytes.Buffer) error

EncodePayload writes the RLP payload following the type byte.

func (*SetCodeTx) GetAccessList

func (tx *SetCodeTx) GetAccessList() AccessList

GetAccessList returns the EIP-2930 access list.

func (*SetCodeTx) GetAuthList

func (tx *SetCodeTx) GetAuthList() []SetCodeAuthorization

GetAuthList returns the EIP-7702 authorization list.

func (*SetCodeTx) GetChainID

func (tx *SetCodeTx) GetChainID() *big.Int

GetChainID returns the destination chain id.

func (*SetCodeTx) GetData

func (tx *SetCodeTx) GetData() []byte

GetData returns the transaction calldata.

func (*SetCodeTx) GetGas

func (tx *SetCodeTx) GetGas() uint64

GetGas returns the gas limit.

func (*SetCodeTx) GetGasFeeCap

func (tx *SetCodeTx) GetGasFeeCap() *big.Int

GetGasFeeCap returns the maximum fee per gas.

func (*SetCodeTx) GetGasPrice

func (tx *SetCodeTx) GetGasPrice() *big.Int

GetGasPrice returns the fee cap; type 0x04 has no single gas price.

func (*SetCodeTx) GetGasTipCap

func (tx *SetCodeTx) GetGasTipCap() *big.Int

GetGasTipCap returns the maximum priority fee per gas.

func (*SetCodeTx) GetNonce

func (tx *SetCodeTx) GetNonce() uint64

GetNonce returns the sender account nonce.

func (*SetCodeTx) GetSignatureValues

func (tx *SetCodeTx) GetSignatureValues() (v, r, s *big.Int)

GetSignatureValues returns the signature values as encoded.

func (*SetCodeTx) GetTo

func (tx *SetCodeTx) GetTo() *common.Address

GetTo returns the recipient. Set code transactions cannot create contracts, so this is never nil.

func (*SetCodeTx) GetValue

func (tx *SetCodeTx) GetValue() *big.Int

GetValue returns the transferred amount in wei.

func (*SetCodeTx) SetSignatureValues

func (tx *SetCodeTx) SetSignatureValues(chainID, v, r, s *big.Int)

SetSignatureValues stores a signature. Typed transactions encode v as the raw y-parity bit.

func (*SetCodeTx) SigningHash

func (tx *SetCodeTx) SigningHash(chainID *big.Int) common.Hash

SigningHash returns the digest the sender signs.

func (*SetCodeTx) TxType

func (tx *SetCodeTx) TxType() byte

TxType returns the EIP-2718 type byte.

type StateGasTxData

type StateGasTxData interface {
	GetStateGas() uint64
}

StateGasTxData is implemented by transaction types that declare an EIP-8037 state gas budget separately from their execution gas budget.

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

Transaction wraps a TxData with the caches and derived values the engine needs.

The zero value is not usable; construct with NewTx or one of the decoders.

func DecodeTx

func DecodeTx(b []byte) (*Transaction, error)

DecodeTx parses a transaction from its canonical or network encoding.

func FromGethTx

func FromGethTx(tx *types.Transaction) (*Transaction, error)

FromGethTx converts a go-ethereum transaction into a spamoor transaction. Blob sidecars are preserved.

func NewTx

func NewTx(inner TxData) *Transaction

NewTx creates a transaction from its consensus content.

func SignTx

func SignTx(tx *Transaction, chainID *big.Int, key *ecdsa.PrivateKey) (*Transaction, error)

SignTx signs a transaction with key and returns a new signed transaction.

The signing scheme is chosen from the capability the transaction type implements: ECDSASignedTx types get a secp256k1 signature over their signing hash, while ExplicitSenderTx types sign their own internal signature material.

func UnmarshalJSONTx

func UnmarshalJSONTx(raw json.RawMessage) (*Transaction, error)

UnmarshalJSONTx decodes a transaction from a JSON-RPC transaction object. The hash and sender reported by the node are adopted verbatim, which keeps block processing correct for types this build decodes imperfectly and avoids a signature recovery per transaction.

func (*Transaction) AccessList

func (tx *Transaction) AccessList() AccessList

AccessList returns the EIP-2930 access list, or nil if the type has none.

func (*Transaction) AuthList

func (tx *Transaction) AuthList() []SetCodeAuthorization

AuthList returns the EIP-7702 authorization list, or nil if the type has none.

func (*Transaction) BlobGasFeeCap

func (tx *Transaction) BlobGasFeeCap() *big.Int

BlobGasFeeCap returns the maximum fee per blob gas, or nil if the type has none.

func (*Transaction) BlobHashes

func (tx *Transaction) BlobHashes() []common.Hash

BlobHashes returns the EIP-4844 blob versioned hashes, or nil if the type has none.

func (*Transaction) BlobTxSidecar

func (tx *Transaction) BlobTxSidecar() *BlobSidecar

BlobTxSidecar returns the attached blob sidecar, or nil when the transaction carries no blobs or was decoded from its canonical (sidecar-less) form.

func (*Transaction) ChainId

func (tx *Transaction) ChainId() *big.Int

ChainId returns the transaction's chain id. Named to match go-ethereum so that call sites migrating from core/types do not need to change.

func (*Transaction) Copy

func (tx *Transaction) Copy() *Transaction

Copy returns a deep copy of the transaction without its caches.

func (*Transaction) Cost

func (tx *Transaction) Cost() *big.Int

Cost returns the maximum wei the transaction can consume: gas budget times fee cap plus value. Blob fees are charged from a separate market and are not included.

func (*Transaction) Data

func (tx *Transaction) Data() []byte

Data returns the transaction calldata.

func (*Transaction) From

func (tx *Transaction) From(chainID *big.Int) (common.Address, error)

From returns the transaction sender: one supplied by SetFrom, the explicit sender field of types that carry one, or secp256k1 recovery from the signature. Cached.

func (*Transaction) Gas

func (tx *Transaction) Gas() uint64

Gas returns the gas budget the sender is charged against.

func (*Transaction) GasFeeCap

func (tx *Transaction) GasFeeCap() *big.Int

GasFeeCap returns the maximum fee per gas.

func (*Transaction) GasPrice

func (tx *Transaction) GasPrice() *big.Int

GasPrice returns the gas price for legacy transactions, or the fee cap otherwise.

func (*Transaction) GasTipCap

func (tx *Transaction) GasTipCap() *big.Int

GasTipCap returns the maximum priority fee per gas.

func (*Transaction) Hash

func (tx *Transaction) Hash() common.Hash

Hash returns the transaction hash, which covers the canonical encoding only. It is computed on first use and cached.

func (*Transaction) Inner

func (tx *Transaction) Inner() TxData

Inner returns the underlying type-specific data. Callers type-assert it to reach fields that are not part of the common accessor set.

func (*Transaction) MarshalBinary

func (tx *Transaction) MarshalBinary() ([]byte, error)

MarshalBinary returns the canonical EIP-2718 encoding, covered by the transaction hash and included in blocks. Blob sidecars are excluded; use MarshalNetwork to submit or gossip a transaction.

func (*Transaction) MarshalJSON

func (tx *Transaction) MarshalJSON() ([]byte, error)

MarshalJSON renders the transaction as a JSON-RPC transaction object.

The common fields are filled from the accessor set; the type contributes the rest through JSONTxEncoder, mirroring how DecodeJSONTx reads them back.

func (*Transaction) MarshalNetwork

func (tx *Transaction) MarshalNetwork() ([]byte, error)

MarshalNetwork returns the encoding used for eth_sendRawTransaction and transaction gossip. For types with no separate network form it is identical to MarshalBinary.

func (*Transaction) Nonce

func (tx *Transaction) Nonce() uint64

Nonce returns the sender account nonce.

func (*Transaction) RawSignatureValues

func (tx *Transaction) RawSignatureValues() (v, r, s *big.Int)

RawSignatureValues returns the signature values of an ECDSA-signed transaction. Types that authenticate differently return nil values.

func (*Transaction) SetBlobTxSidecar

func (tx *Transaction) SetBlobTxSidecar(sidecar *BlobSidecar)

SetBlobTxSidecar attaches a blob sidecar. It resets the size cache but not the hash cache, as the sidecar is not covered by the transaction hash.

func (*Transaction) SetFrom

func (tx *Transaction) SetFrom(from common.Address)

SetFrom records the transaction's sender, letting decoders supply the sender reported by the node instead of recovering it.

func (*Transaction) Size

func (tx *Transaction) Size() uint64

Size returns the length of the network encoding in bytes.

func (*Transaction) StateGas

func (tx *Transaction) StateGas() uint64

StateGas returns the EIP-8037 state gas budget declared by the transaction, or 0 for types that do not declare one separately.

func (*Transaction) To

func (tx *Transaction) To() *common.Address

To returns the recipient, or nil for contract creation.

func (*Transaction) ToGethTx

func (tx *Transaction) ToGethTx() (*types.Transaction, error)

ToGethTx converts a spamoor transaction into a go-ethereum transaction. Transaction types go-ethereum cannot represent return an error rather than a degraded value.

func (*Transaction) Type

func (tx *Transaction) Type() uint8

Type returns the EIP-2718 transaction type.

func (*Transaction) UnmarshalBinary

func (tx *Transaction) UnmarshalBinary(b []byte) error

UnmarshalBinary parses a transaction from its canonical or network encoding.

func (*Transaction) UnmarshalJSON

func (tx *Transaction) UnmarshalJSON(input []byte) error

UnmarshalJSON decodes a transaction from a JSON-RPC transaction object.

Transaction carries only unexported fields, so without this the standard decoder would quietly leave the receiver empty and every later method call would panic.

func (*Transaction) UsesAccountNonce

func (tx *Transaction) UsesAccountNonce() bool

UsesAccountNonce reports whether the transaction is sequenced by its sender's account nonce. When it is false, Nonce returns a sequence number from an unrelated domain and comparing it against the account nonce is meaningless.

func (*Transaction) Value

func (tx *Transaction) Value() *big.Int

Value returns the transferred amount in wei.

type TxData

type TxData interface {
	// TxType returns the EIP-2718 type byte.
	TxType() byte

	// CopyTx returns a deep copy with all fields initialized.
	CopyTx() TxData

	// Get-prefixed because implementations carry these names as exported fields.
	GetChainID() *big.Int
	GetNonce() uint64
	GetGas() uint64
	GetGasPrice() *big.Int
	GetGasFeeCap() *big.Int
	GetGasTipCap() *big.Int
	GetTo() *common.Address
	GetValue() *big.Int
	GetData() []byte

	// EncodePayload writes the canonical EIP-2718 payload, i.e. everything after the
	// type byte. Legacy transactions write their plain RLP list.
	EncodePayload(w *bytes.Buffer) error

	// DecodePayload parses a canonical payload produced by EncodePayload. Types whose
	// network encoding differs (blob sidecars, EIP-7594 wrappers) should accept both
	// forms here so that UnmarshalBinary works for either.
	DecodePayload(b []byte) error
}

TxData is the consensus content of a single transaction.

Every method is exported so transaction types can be implemented outside this package and registered with RegisterTxType. The accessors cover the shape common to all types; anything beyond it is expressed through the optional interfaces below. Types with no single natural value for an accessor return a derived one.

type UnknownTx

type UnknownTx struct {
	Type      byte
	ChainID   *big.Int
	Nonce     uint64
	GasPrice  *big.Int
	GasFeeCap *big.Int
	GasTipCap *big.Int
	Gas       uint64
	To        *common.Address
	Value     *big.Int
	Data      []byte
}

UnknownTx represents a transaction of a type this build cannot decode. It keeps the generic fields the node reports so such transactions still take part in block accounting; only type-specific introspection is unavailable.

It cannot be encoded or signed and exists only as the result of decoding chain data.

func (*UnknownTx) CopyTx

func (tx *UnknownTx) CopyTx() TxData

CopyTx returns a deep copy with all fields initialized.

func (*UnknownTx) DecodePayload

func (tx *UnknownTx) DecodePayload(_ []byte) error

DecodePayload always fails: an unknown type has no payload structure to parse.

func (*UnknownTx) EncodeJSONTx

func (tx *UnknownTx) EncodeJSONTx(fields map[string]any)

EncodeJSONTx adds the fee fields an unknown type reported. Its type-specific content was never decoded, so nothing else can be rendered.

func (*UnknownTx) EncodePayload

func (tx *UnknownTx) EncodePayload(_ *bytes.Buffer) error

EncodePayload always fails: the wire bytes are not recoverable from the JSON-RPC representation of an unknown type.

func (*UnknownTx) GetChainID

func (tx *UnknownTx) GetChainID() *big.Int

GetChainID returns the chain id reported by the node.

func (*UnknownTx) GetData

func (tx *UnknownTx) GetData() []byte

GetData returns the transaction calldata.

func (*UnknownTx) GetGas

func (tx *UnknownTx) GetGas() uint64

GetGas returns the gas limit.

func (*UnknownTx) GetGasFeeCap

func (tx *UnknownTx) GetGasFeeCap() *big.Int

GetGasFeeCap returns the maximum fee per gas.

func (*UnknownTx) GetGasPrice

func (tx *UnknownTx) GetGasPrice() *big.Int

GetGasPrice returns the gas price.

func (*UnknownTx) GetGasTipCap

func (tx *UnknownTx) GetGasTipCap() *big.Int

GetGasTipCap returns the maximum priority fee per gas.

func (*UnknownTx) GetNonce

func (tx *UnknownTx) GetNonce() uint64

GetNonce returns the sender account nonce.

func (*UnknownTx) GetTo

func (tx *UnknownTx) GetTo() *common.Address

GetTo returns the recipient, or nil.

func (*UnknownTx) GetValue

func (tx *UnknownTx) GetValue() *big.Int

GetValue returns the transferred amount in wei.

func (*UnknownTx) TxType

func (tx *UnknownTx) TxType() byte

TxType returns the EIP-2718 type byte reported by the node.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL