Documentation ¶
Overview ¶
Package types contains data types related to Ethereum consensus.
Index ¶
- Constants
- Variables
- func AddressToDelegation(addr libcommon.Address) []byte
- func Bloom9(data []byte) []byte
- func BloomLookup(bin Bloom, topic bytesBacked) bool
- func CalcUncleHash(uncles []*Header) libcommon.Hash
- func DecodeSSZ(data []byte, dest codec.Deserializable) error
- func DeriveChainId(v *uint256.Int) *uint256.Int
- func DeriveSha(list DerivableList) libcommon.Hash
- func EncodeSSZ(w io.Writer, obj codec.Serializable) error
- func LogsBloom(logs []*Log) []byte
- func MarshalTransactionsBinary(txs Transactions) ([][]byte, error)
- func ParseDelegation(code []byte) (libcommon.Address, bool)
- func RawRlpHash(rawRlpData rlp.RawValue) (h libcommon.Hash)
- func RecoverSignerFromRLP(rlp []byte, yParity uint8, r uint256.Int, s uint256.Int) (*libcommon.Address, error)
- func TxCountToTxAmount(txsLen int) uint32
- func TypedTransactionMarshalledAsRlpString(data []byte) bool
- func UnwrapTxPlayloadRlp(blobTxRlp []byte) ([]byte, error)
- type AccessList
- type AccessListTx
- func (tx *AccessListTx) AsMessage(s Signer, _ *big.Int, rules *chain.Rules) (Message, error)
- func (tx *AccessListTx) DecodeRLP(s *rlp.Stream) error
- func (tx *AccessListTx) EncodeRLP(w io.Writer) error
- func (tx *AccessListTx) EncodingSize() int
- func (tx *AccessListTx) GetAccessList() AccessList
- func (tx *AccessListTx) GetChainID() *uint256.Int
- func (tx *AccessListTx) Hash() libcommon.Hash
- func (tx *AccessListTx) MarshalBinary(w io.Writer) error
- func (tx *AccessListTx) MarshalJSON() ([]byte, error)
- func (tx *AccessListTx) Protected() bool
- func (tx *AccessListTx) RawSignatureValues() (*uint256.Int, *uint256.Int, *uint256.Int)
- func (tx *AccessListTx) Sender(signer Signer) (libcommon.Address, error)
- func (tx *AccessListTx) SigningHash(chainID *big.Int) libcommon.Hash
- func (tx *AccessListTx) Type() byte
- func (tx *AccessListTx) UnmarshalJSON(input []byte) error
- func (tx *AccessListTx) Unwrap() Transaction
- func (tx *AccessListTx) WithSignature(signer Signer, sig []byte) (Transaction, error)
- type AccessTuple
- type AuRaSeal
- type Authorization
- type BaseTxnID
- type BinaryTransactions
- type Blob
- type BlobKzgs
- type BlobTx
- func (stx *BlobTx) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Message, error)
- func (stx *BlobTx) DecodeRLP(s *rlp.Stream) error
- func (stx *BlobTx) EncodeRLP(w io.Writer) error
- func (stx *BlobTx) EncodingSize() int
- func (stx *BlobTx) GetBlobGas() uint64
- func (stx *BlobTx) GetBlobHashes() []libcommon.Hash
- func (stx *BlobTx) Hash() libcommon.Hash
- func (stx *BlobTx) MarshalBinary(w io.Writer) error
- func (tx *BlobTx) MarshalJSON() ([]byte, error)
- func (stx *BlobTx) Sender(signer Signer) (libcommon.Address, error)
- func (stx *BlobTx) SigningHash(chainID *big.Int) libcommon.Hash
- func (stx *BlobTx) Type() byte
- type BlobTxWrapper
- func (txw *BlobTxWrapper) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Message, error)
- func (txw *BlobTxWrapper) DecodeRLP(s *rlp.Stream) error
- func (txw *BlobTxWrapper) EncodeRLP(w io.Writer) error
- func (txw *BlobTxWrapper) EncodingSize() int
- func (txw *BlobTxWrapper) GetAccessList() AccessList
- func (txw *BlobTxWrapper) GetBlobGas() uint64
- func (txw *BlobTxWrapper) GetBlobHashes() []libcommon.Hash
- func (txw *BlobTxWrapper) GetChainID() *uint256.Int
- func (txw *BlobTxWrapper) GetData() []byte
- func (txw *BlobTxWrapper) GetEffectiveGasTip(baseFee *uint256.Int) *uint256.Int
- func (txw *BlobTxWrapper) GetFeeCap() *uint256.Int
- func (txw *BlobTxWrapper) GetGas() uint64
- func (txw *BlobTxWrapper) GetNonce() uint64
- func (txw *BlobTxWrapper) GetPrice() *uint256.Int
- func (txw *BlobTxWrapper) GetSender() (libcommon.Address, bool)
- func (txw *BlobTxWrapper) GetTip() *uint256.Int
- func (txw *BlobTxWrapper) GetTo() *libcommon.Address
- func (txw *BlobTxWrapper) GetValue() *uint256.Int
- func (txw *BlobTxWrapper) Hash() libcommon.Hash
- func (txw *BlobTxWrapper) IsContractDeploy() bool
- func (txw *BlobTxWrapper) MarshalBinary(w io.Writer) error
- func (tx *BlobTxWrapper) MarshalJSON() ([]byte, error)
- func (txw *BlobTxWrapper) Protected() bool
- func (txw *BlobTxWrapper) RawSignatureValues() (*uint256.Int, *uint256.Int, *uint256.Int)
- func (txw *BlobTxWrapper) Sender(s Signer) (libcommon.Address, error)
- func (txw *BlobTxWrapper) SetSender(address libcommon.Address)
- func (txw *BlobTxWrapper) SigningHash(chainID *big.Int) libcommon.Hash
- func (txw *BlobTxWrapper) Type() byte
- func (txw *BlobTxWrapper) Unwrap() Transaction
- func (txw *BlobTxWrapper) ValidateBlobTransactionWrapper() error
- func (txw *BlobTxWrapper) WithSignature(signer Signer, sig []byte) (Transaction, error)
- type Blobs
- type Block
- func NewBlock(header *Header, txs []Transaction, uncles []*Header, receipts []*Receipt, ...) *Block
- func NewBlockForAsembling(header *Header, txs []Transaction, uncles []*Header, receipts []*Receipt, ...) *Block
- func NewBlockFromNetwork(header *Header, body *Body) *Block
- func NewBlockFromStorage(hash libcommon.Hash, header *Header, txs []Transaction, uncles []*Header, ...) *Block
- func NewBlockWithHeader(header *Header) *Block
- func (b *Block) BaseFee() *big.Int
- func (b *Block) Bloom() Bloom
- func (b *Block) Body() *Body
- func (b *Block) Coinbase() libcommon.Address
- func (b *Block) Copy() *Block
- func (bb *Block) DecodeRLP(s *rlp.Stream) error
- func (b *Block) Difficulty() *big.Int
- func (bb *Block) EncodeRLP(w io.Writer) error
- func (bb *Block) EncodingSize() int
- func (b *Block) Extra() []byte
- func (b *Block) GasLimit() uint64
- func (b *Block) GasUsed() uint64
- func (b *Block) Hash() libcommon.Hash
- func (b *Block) HashCheck(fullCheck bool) error
- func (b *Block) Header() *Header
- func (b *Block) HeaderNoCopy() *Header
- func (b *Block) MixDigest() libcommon.Hash
- func (b *Block) Nonce() BlockNonce
- func (b *Block) NonceU64() uint64
- func (b *Block) Number() *big.Int
- func (b *Block) NumberU64() uint64
- func (b *Block) ParentBeaconBlockRoot() *libcommon.Hash
- func (b *Block) ParentHash() libcommon.Hash
- func (b *Block) RawBody() *RawBody
- func (b *Block) ReceiptHash() libcommon.Hash
- func (b *Block) RequestsHash() *libcommon.Hash
- func (b *Block) Root() libcommon.Hash
- func (b *Block) SanityCheck() error
- func (b *Block) SendersToTxs(senders []libcommon.Address)
- func (b *Block) Size() libcommon.StorageSize
- func (b *Block) Time() uint64
- func (b *Block) Transaction(hash libcommon.Hash) Transaction
- func (b *Block) Transactions() Transactions
- func (b *Block) TxHash() libcommon.Hash
- func (b *Block) UncleHash() libcommon.Hash
- func (b *Block) Uncles() []*Header
- func (b *Block) WithSeal(header *Header) *Block
- func (b *Block) Withdrawals() Withdrawals
- func (b *Block) WithdrawalsHash() *libcommon.Hash
- type BlockNonce
- type BlockWithReceipts
- type Blocks
- type Bloom
- type Body
- type BodyForStorage
- type CommonTx
- func (ct *CommonTx) GetBlobGas() uint64
- func (ct *CommonTx) GetBlobHashes() []libcommon.Hash
- func (ct *CommonTx) GetData() []byte
- func (ct *CommonTx) GetGas() uint64
- func (ct *CommonTx) GetNonce() uint64
- func (ct *CommonTx) GetSender() (libcommon.Address, bool)
- func (ct *CommonTx) GetTo() *libcommon.Address
- func (ct *CommonTx) GetValue() *uint256.Int
- func (ct *CommonTx) IsContractDeploy() bool
- func (ct *CommonTx) Protected() bool
- func (ct *CommonTx) SetSender(addr libcommon.Address)
- type DerivableList
- type DynamicFeeTransaction
- func (tx *DynamicFeeTransaction) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Message, error)
- func (tx *DynamicFeeTransaction) DecodeRLP(s *rlp.Stream) error
- func (tx *DynamicFeeTransaction) EncodeRLP(w io.Writer) error
- func (tx *DynamicFeeTransaction) EncodingSize() int
- func (tx *DynamicFeeTransaction) GetAccessList() AccessList
- func (tx *DynamicFeeTransaction) GetChainID() *uint256.Int
- func (tx *DynamicFeeTransaction) GetEffectiveGasTip(baseFee *uint256.Int) *uint256.Int
- func (tx *DynamicFeeTransaction) GetFeeCap() *uint256.Int
- func (tx *DynamicFeeTransaction) GetPrice() *uint256.Int
- func (tx *DynamicFeeTransaction) GetTip() *uint256.Int
- func (tx *DynamicFeeTransaction) Hash() libcommon.Hash
- func (tx *DynamicFeeTransaction) MarshalBinary(w io.Writer) error
- func (tx *DynamicFeeTransaction) MarshalJSON() ([]byte, error)
- func (tx *DynamicFeeTransaction) RawSignatureValues() (*uint256.Int, *uint256.Int, *uint256.Int)
- func (tx *DynamicFeeTransaction) Sender(signer Signer) (libcommon.Address, error)
- func (tx *DynamicFeeTransaction) SigningHash(chainID *big.Int) libcommon.Hash
- func (tx *DynamicFeeTransaction) Type() byte
- func (tx *DynamicFeeTransaction) UnmarshalJSON(input []byte) error
- func (tx *DynamicFeeTransaction) Unwrap() Transaction
- func (tx *DynamicFeeTransaction) WithSignature(signer Signer, sig []byte) (Transaction, error)
- type ErigonLog
- type ErigonLogs
- type FlatRequest
- type FlatRequests
- type Genesis
- type GenesisAccount
- type GenesisAlloc
- type GenesisMismatchError
- type Header
- func (h *Header) DecodeRLP(s *rlp.Stream) error
- func (h *Header) EncodeRLP(w io.Writer) error
- func (h *Header) EncodingSize() int
- func (h *Header) Hash() (hash libcommon.Hash)
- func (h Header) MarshalJSON() ([]byte, error)
- func (h *Header) SanityCheck() error
- func (h *Header) Size() libcommon.StorageSize
- func (h *Header) UnmarshalJSON(input []byte) error
- type JsonAuthorization
- type KZGCommitment
- type KZGProof
- type KZGProofs
- type LegacyTx
- func (tx *LegacyTx) AsMessage(s Signer, _ *big.Int, _ *chain.Rules) (Message, error)
- func (tx *LegacyTx) DecodeRLP(s *rlp.Stream) error
- func (tx *LegacyTx) EncodeRLP(w io.Writer) error
- func (tx *LegacyTx) EncodingSize() int
- func (tx *LegacyTx) GetAccessList() AccessList
- func (tx *LegacyTx) GetChainID() *uint256.Int
- func (tx *LegacyTx) GetEffectiveGasTip(baseFee *uint256.Int) *uint256.Int
- func (tx *LegacyTx) GetFeeCap() *uint256.Int
- func (tx *LegacyTx) GetPrice() *uint256.Int
- func (tx *LegacyTx) GetTip() *uint256.Int
- func (tx *LegacyTx) Hash() libcommon.Hash
- func (tx *LegacyTx) MarshalBinary(w io.Writer) error
- func (tx *LegacyTx) MarshalJSON() ([]byte, error)
- func (tx *LegacyTx) Protected() bool
- func (tx *LegacyTx) RawSignatureValues() (*uint256.Int, *uint256.Int, *uint256.Int)
- func (tx *LegacyTx) Sender(signer Signer) (libcommon.Address, error)
- func (tx *LegacyTx) SigningHash(chainID *big.Int) libcommon.Hash
- func (tx *LegacyTx) Type() byte
- func (tx *LegacyTx) UnmarshalJSON(input []byte) error
- func (tx *LegacyTx) Unwrap() Transaction
- func (tx *LegacyTx) WithSignature(signer Signer, sig []byte) (Transaction, error)
- type Log
- type LogForStorage
- type Logs
- func (logs Logs) CointainTopics(addrMap map[libcommon.Address]struct{}, topicsMap map[libcommon.Hash]struct{}, ...) Logs
- func (logs Logs) Copy() Logs
- func (logs Logs) Filter(addrMap map[libcommon.Address]struct{}, topics [][]libcommon.Hash, ...) Logs
- func (logs Logs) FilterOld(addresses map[libcommon.Address]struct{}, topics [][]libcommon.Hash) Logs
- type Message
- func (m Message) AccessList() AccessList
- func (m Message) Authorizations() []Authorization
- func (m Message) BlobGas() uint64
- func (m Message) BlobHashes() []libcommon.Hash
- func (m *Message) ChangeGas(globalGasCap, desiredGas uint64)
- func (m Message) CheckNonce() bool
- func (m Message) Data() []byte
- func (m Message) FeeCap() *uint256.Int
- func (m Message) From() libcommon.Address
- func (m Message) Gas() uint64
- func (m Message) GasPrice() *uint256.Int
- func (m Message) IsFree() bool
- func (m Message) MaxFeePerBlobGas() *uint256.Int
- func (m Message) Nonce() uint64
- func (m *Message) SetAuthorizations(authorizations []Authorization)
- func (m *Message) SetCheckNonce(checkNonce bool)
- func (m *Message) SetIsFree(isFree bool)
- func (m Message) Tip() *uint256.Int
- func (m Message) To() *libcommon.Address
- func (m Message) Value() *uint256.Int
- type RawBlock
- type RawBody
- type Receipt
- func (r *Receipt) Copy() *Receipt
- func (r *Receipt) DecodeRLP(s *rlp.Stream) error
- func (r *Receipt) DeriveFieldsV3ForSingleReceipt(txnIdx int, blockHash libcommon.Hash, blockNum uint64, txn Transaction, ...) error
- func (r Receipt) EncodeRLP(w io.Writer) error
- func (r *Receipt) MarshalBinary() ([]byte, error)
- func (r Receipt) MarshalJSON() ([]byte, error)
- func (r *Receipt) String() string
- func (r *Receipt) UnmarshalBinary(b []byte) error
- func (r *Receipt) UnmarshalJSON(input []byte) error
- type ReceiptForStorage
- type Receipts
- type ReceiptsForStorage
- type SetCodeTransaction
- func (tx *SetCodeTransaction) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Message, error)
- func (tx *SetCodeTransaction) DecodeRLP(s *rlp.Stream) error
- func (tx *SetCodeTransaction) EncodeRLP(w io.Writer) error
- func (tx *SetCodeTransaction) EncodingSize() int
- func (tx *SetCodeTransaction) GetAuthorizations() []Authorization
- func (tx *SetCodeTransaction) GetBlobHashes() []libcommon.Hash
- func (tx *SetCodeTransaction) Hash() libcommon.Hash
- func (tx *SetCodeTransaction) MarshalBinary(w io.Writer) error
- func (tx *SetCodeTransaction) Sender(signer Signer) (libcommon.Address, error)
- func (tx *SetCodeTransaction) SigningHash(chainID *big.Int) libcommon.Hash
- func (tx *SetCodeTransaction) Type() byte
- func (tx *SetCodeTransaction) UnmarshalJSON(input []byte) error
- func (tx *SetCodeTransaction) Unwrap() Transaction
- func (tx *SetCodeTransaction) WithSignature(signer Signer, sig []byte) (Transaction, error)
- type Signer
- func (sg Signer) ChainID() *uint256.Int
- func (sg Signer) Equal(other Signer) bool
- func (sg Signer) Sender(tx Transaction) (libcommon.Address, error)
- func (sg Signer) SenderWithContext(context *secp256k1.Context, txn Transaction) (libcommon.Address, error)
- func (sg Signer) SignatureValues(txn Transaction, sig []byte) (R, S, V *uint256.Int, err error)
- func (sg Signer) String() string
- type StateSyncData
- type Transaction
- func DecodeRLPTransaction(s *rlp.Stream, blobTxnsAreWrappedWithBlobs bool) (Transaction, error)
- func DecodeTransaction(data []byte) (Transaction, error)
- func DecodeTransactions(txs [][]byte) ([]Transaction, error)
- func DecodeWrappedTransaction(data []byte) (Transaction, error)
- func MustSignNewTx(prv *ecdsa.PrivateKey, s Signer, txn Transaction) Transaction
- func SignNewTx(prv *ecdsa.PrivateKey, s Signer, txn Transaction) (Transaction, error)
- func SignTx(txn Transaction, s Signer, prv *ecdsa.PrivateKey) (Transaction, error)
- func UnmarshalBlobTxJSON(input []byte) (Transaction, error)
- func UnmarshalTransactionFromBinary(data []byte, blobTxnsAreWrappedWithBlobs bool) (Transaction, error)
- func UnmarshalTransactionFromJSON(input []byte) (Transaction, error)
- type TransactionMisc
- type Transactions
- type TransactionsGroupedBySender
- type TxByNonce
- type Withdrawal
- type Withdrawals
Constants ¶
const ( // BloomByteLength represents the number of bytes used in a header log bloom. BloomByteLength = 256 // BloomBitLength represents the number of bits used in a header log bloom. BloomBitLength = 8 * BloomByteLength )
const ( // ReceiptStatusFailed is the status code of a transaction if execution failed. ReceiptStatusFailed = uint64(0) // ReceiptStatusSuccessful is the status code of a transaction if execution succeeded. ReceiptStatusSuccessful = uint64(1) )
const ( LegacyTxType = iota AccessListTxType DynamicFeeTxType BlobTxType SetCodeTxType )
Transaction types.
const ConsolidationRequestDataLen = 116 // addr + sourcePubkey + targetPubkey
const ConsolidationRequestType byte = 0x02
const DelegateDesignationCodeSize = 23
const DepositRequestDataLen = 192 // BLSPubKeyLen + WithdrawalCredentialsLen + 8 + BLSSigLen + 8
const DepositRequestType byte = 0x00
const (
LEN_48 = 48 // KZGCommitment & KZGProof sizes
)
const WithdrawalRequestDataLen = 76 // addr + pubkey + amt
const WithdrawalRequestType byte = 0x01
Variables ¶
var ( EmptyRootHash = libcommon.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421") EmptyRequestsHash = libcommon.HexToHash("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") // sha256.Sum256([]byte("")) EmptyUncleHash = rlpHash([]*Header(nil)) ExtraVanityLength = 32 // Fixed number of extra-data prefix bytes reserved for signer vanity ExtraSealLength = 65 // Fixed number of extra-data suffix bytes reserved for signer seal )
var ( ErrInvalidSig = errors.New("invalid transaction v, r, s values") ErrUnexpectedProtection = errors.New("transaction type does not supported EIP-155 protected signatures") ErrInvalidTxType = errors.New("transaction type not valid in this context") ErrTxTypeNotSupported = errors.New("transaction type not supported") )
var ErrGenesisNoConfig = errors.New("genesis has no chain configuration")
var ErrInvalidChainId = errors.New("invalid chain id for signer")
var ErrNilToFieldTx = errors.New("Tx: field 'To' can not be 'nil'")
var KnownRequestTypes = []byte{DepositRequestType, WithdrawalRequestType, ConsolidationRequestType}
var NanoBlackList = []libcommon.Address{ libcommon.HexToAddress("0x489A8756C18C0b8B24EC2a2b9FF3D4d447F79BEc"), libcommon.HexToAddress("0xFd6042Df3D74ce9959922FeC559d7995F3933c55"), libcommon.HexToAddress("0xdb789Eb5BDb4E559beD199B8b82dED94e1d056C9"), }
This is introduced because of the Tendermint IAVL Merkle Proof verification exploitation.
Functions ¶
func AddressToDelegation ¶
AddressToDelegation adds the delegation prefix to the specified address.
func BloomLookup ¶
BloomLookup is a convenience-method to check presence int he bloom filter
func CalcUncleHash ¶
func DeriveChainId ¶
deriveChainID derives the chain id from the given v parameter
func DeriveSha ¶
func DeriveSha(list DerivableList) libcommon.Hash
func MarshalTransactionsBinary ¶
func MarshalTransactionsBinary(txs Transactions) ([][]byte, error)
func ParseDelegation ¶
ParseDelegation tries to parse the address from a delegation slice.
func RecoverSignerFromRLP ¶
func TxCountToTxAmount ¶
TxCountToTxAmount converts number of transactions in block to TxAmount
func UnwrapTxPlayloadRlp ¶
Removes everything but the payload body from blob tx and prepends 0x3 at the beginning - no copy Doesn't change non-blob tx
Types ¶
type AccessList ¶
type AccessList []AccessTuple
AccessList is an EIP-2930 access list.
func (AccessList) StorageKeys ¶
func (al AccessList) StorageKeys() int
StorageKeys returns the total number of storage keys in the access list.
type AccessListTx ¶
type AccessListTx struct { LegacyTx ChainID *uint256.Int AccessList AccessList // EIP-2930 access list }
AccessListTx is the data of EIP-2930 access list transactions.
func (*AccessListTx) EncodeRLP ¶
func (tx *AccessListTx) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder
func (*AccessListTx) EncodingSize ¶
func (tx *AccessListTx) EncodingSize() int
EncodingSize returns the RLP encoding size of the whole transaction envelope
func (*AccessListTx) GetAccessList ¶
func (tx *AccessListTx) GetAccessList() AccessList
func (*AccessListTx) GetChainID ¶
func (tx *AccessListTx) GetChainID() *uint256.Int
func (*AccessListTx) Hash ¶
func (tx *AccessListTx) Hash() libcommon.Hash
Hash computes the hash (but not for signatures!)
func (*AccessListTx) MarshalBinary ¶
func (tx *AccessListTx) MarshalBinary(w io.Writer) error
MarshalBinary returns the canonical encoding of the transaction. For legacy transactions, it returns the RLP encoding. For EIP-2718 typed transactions, it returns the type and payload.
func (*AccessListTx) MarshalJSON ¶
func (tx *AccessListTx) MarshalJSON() ([]byte, error)
func (*AccessListTx) Protected ¶
func (tx *AccessListTx) Protected() bool
func (*AccessListTx) RawSignatureValues ¶
func (*AccessListTx) Sender ¶
func (tx *AccessListTx) Sender(signer Signer) (libcommon.Address, error)
func (*AccessListTx) SigningHash ¶
func (tx *AccessListTx) SigningHash(chainID *big.Int) libcommon.Hash
func (*AccessListTx) Type ¶
func (tx *AccessListTx) Type() byte
func (*AccessListTx) UnmarshalJSON ¶
func (tx *AccessListTx) UnmarshalJSON(input []byte) error
func (*AccessListTx) Unwrap ¶
func (tx *AccessListTx) Unwrap() Transaction
func (*AccessListTx) WithSignature ¶
func (tx *AccessListTx) WithSignature(signer Signer, sig []byte) (Transaction, error)
type AccessTuple ¶
type AccessTuple struct { Address libcommon.Address `json:"address"` StorageKeys []libcommon.Hash `json:"storageKeys"` }
AccessTuple is the element type of an access list.
type AuRaSeal ¶
type AuRaSeal struct { AuthorityRound struct { Step math.HexOrDecimal64 `json:"step"` Signature hexutility.Bytes `json:"signature"` } `json:"authorityRound"` }
func NewAuraSeal ¶
func (AuRaSeal) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*AuRaSeal) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type Authorization ¶
type Authorization struct { ChainID uint256.Int Address libcommon.Address Nonce uint64 YParity uint8 R uint256.Int S uint256.Int }
func (*Authorization) RecoverSigner ¶
type BaseTxnID ¶
type BaseTxnID uint64
BaseTxnID represents internal auto-incremented transaction number in block, may be different across the nodes e.g. block has 3 transactions, then txAmount = 3+2/*systemTx*/ = 5 therefore:
0 - base tx/systemBegin 1 - tx0 2 - tx1 3 - tx2 4 - systemEnd System transactions are used to write history of state changes done by consensus (not by eth-transactions) - for example "miner rewards"
func (BaseTxnID) First ¶
First non-system txn number in block as if baseTxnID is first original transaction in block
func (BaseTxnID) FirstSystemTx ¶
FirstSystemTx returns first system txn number in block
func (BaseTxnID) LastSystemTx ¶
LastSystemTx returns last system txn number in block. result+1 will be baseID of next block a.k.a. beginning system txn number Supposed that txAmount includes 2 system txns.
type BinaryTransactions ¶
type BinaryTransactions [][]byte
RLP-marshalled legacy transactions and binary-marshalled (not wrapped into an RLP string) typed (EIP-2718) transactions
func (BinaryTransactions) EncodeIndex ¶
func (t BinaryTransactions) EncodeIndex(i int, w *bytes.Buffer)
func (BinaryTransactions) Len ¶
func (t BinaryTransactions) Len() int
type BlobKzgs ¶
type BlobKzgs []KZGCommitment
type BlobTx ¶
type BlobTx struct { DynamicFeeTransaction MaxFeePerBlobGas *uint256.Int BlobVersionedHashes []libcommon.Hash }
func (*BlobTx) EncodingSize ¶
func (*BlobTx) GetBlobGas ¶
func (*BlobTx) GetBlobHashes ¶
func (*BlobTx) MarshalJSON ¶
type BlobTxWrapper ¶
func (*BlobTxWrapper) EncodingSize ¶
func (txw *BlobTxWrapper) EncodingSize() int
We deliberately encode only the transaction payload because the only case we need to serialize blobs/commitments/proofs is when we reply to GetPooledTransactions (and that's handled by the txpool).
func (*BlobTxWrapper) GetAccessList ¶
func (txw *BlobTxWrapper) GetAccessList() AccessList
func (*BlobTxWrapper) GetBlobGas ¶
func (txw *BlobTxWrapper) GetBlobGas() uint64
func (*BlobTxWrapper) GetBlobHashes ¶
func (txw *BlobTxWrapper) GetBlobHashes() []libcommon.Hash
func (*BlobTxWrapper) GetChainID ¶
func (txw *BlobTxWrapper) GetChainID() *uint256.Int
func (*BlobTxWrapper) GetData ¶
func (txw *BlobTxWrapper) GetData() []byte
func (*BlobTxWrapper) GetEffectiveGasTip ¶
func (txw *BlobTxWrapper) GetEffectiveGasTip(baseFee *uint256.Int) *uint256.Int
func (*BlobTxWrapper) GetFeeCap ¶
func (txw *BlobTxWrapper) GetFeeCap() *uint256.Int
func (*BlobTxWrapper) GetGas ¶
func (txw *BlobTxWrapper) GetGas() uint64
func (*BlobTxWrapper) GetNonce ¶
func (txw *BlobTxWrapper) GetNonce() uint64
func (*BlobTxWrapper) GetPrice ¶
func (txw *BlobTxWrapper) GetPrice() *uint256.Int
func (*BlobTxWrapper) GetTip ¶
func (txw *BlobTxWrapper) GetTip() *uint256.Int
func (*BlobTxWrapper) GetTo ¶
func (txw *BlobTxWrapper) GetTo() *libcommon.Address
func (*BlobTxWrapper) GetValue ¶
func (txw *BlobTxWrapper) GetValue() *uint256.Int
func (*BlobTxWrapper) Hash ¶
func (txw *BlobTxWrapper) Hash() libcommon.Hash
func (*BlobTxWrapper) IsContractDeploy ¶
func (txw *BlobTxWrapper) IsContractDeploy() bool
func (*BlobTxWrapper) MarshalBinary ¶
func (txw *BlobTxWrapper) MarshalBinary(w io.Writer) error
func (*BlobTxWrapper) MarshalJSON ¶
func (tx *BlobTxWrapper) MarshalJSON() ([]byte, error)
func (*BlobTxWrapper) Protected ¶
func (txw *BlobTxWrapper) Protected() bool
func (*BlobTxWrapper) RawSignatureValues ¶
func (*BlobTxWrapper) Sender ¶
func (txw *BlobTxWrapper) Sender(s Signer) (libcommon.Address, error)
func (*BlobTxWrapper) SetSender ¶
func (txw *BlobTxWrapper) SetSender(address libcommon.Address)
func (*BlobTxWrapper) SigningHash ¶
func (txw *BlobTxWrapper) SigningHash(chainID *big.Int) libcommon.Hash
func (*BlobTxWrapper) Unwrap ¶
func (txw *BlobTxWrapper) Unwrap() Transaction
func (*BlobTxWrapper) ValidateBlobTransactionWrapper ¶
func (txw *BlobTxWrapper) ValidateBlobTransactionWrapper() error
validateBlobTransactionWrapper implements validate_blob_transaction_wrapper from EIP-4844
func (*BlobTxWrapper) WithSignature ¶
func (txw *BlobTxWrapper) WithSignature(signer Signer, sig []byte) (Transaction, error)
type Blobs ¶
type Blobs []Blob
func (Blobs) ComputeCommitmentsAndProofs ¶
func (blobs Blobs) ComputeCommitmentsAndProofs() (commitments []KZGCommitment, versionedHashes []libcommon.Hash, proofs []KZGProof, err error)
Return KZG commitments, versioned hashes and the proofs that correspond to these blobs
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block represents an entire block in the Ethereum blockchain.
func NewBlock ¶
func NewBlock(header *Header, txs []Transaction, uncles []*Header, receipts []*Receipt, withdrawals []*Withdrawal) *Block
NewBlock creates a new block. The input data is copied, changes to header and to the field values will not affect the block.
The values of TxHash, UncleHash, ReceiptHash, Bloom, and WithdrawalHash in the header are ignored and set to the values derived from the given txs, uncles, receipts, and withdrawals.
func NewBlockForAsembling ¶
func NewBlockForAsembling(header *Header, txs []Transaction, uncles []*Header, receipts []*Receipt, withdrawals []*Withdrawal) *Block
NewBlockForAsembling - creating new block - which allow mutation of fileds. Use it for block-assembly
func NewBlockFromNetwork ¶
NewBlockFromNetwork like NewBlock but used to create Block object when assembled from devp2p network messages when there is no reason to copy parts, or re-calculate headers fields.
func NewBlockFromStorage ¶
func NewBlockFromStorage(hash libcommon.Hash, header *Header, txs []Transaction, uncles []*Header, withdrawals []*Withdrawal) *Block
NewBlockFromStorage like NewBlock but used to create Block object when read it from DB in this case no reason to copy parts, or re-calculate headers fields - they are all stored in DB
func NewBlockWithHeader ¶
NewBlockWithHeader creates a block with the given header data. The header data is copied, changes to header and to the field values will not affect the block.
func (*Block) Difficulty ¶
func (*Block) EncodingSize ¶
func (*Block) Hash ¶
Hash returns the keccak256 hash of b's header. The hash is computed on the first call and cached thereafter.
func (*Block) HashCheck ¶
HashCheck checks that transactions, receipts, uncles, and withdrawals hashes are correct.
func (*Block) HeaderNoCopy ¶
func (*Block) Nonce ¶
func (b *Block) Nonce() BlockNonce
func (*Block) ParentBeaconBlockRoot ¶
func (*Block) ParentHash ¶
func (*Block) RawBody ¶
RawBody creates a RawBody based on the block. It is not very efficient, so will probably be removed in favour of RawBlock. Also it panics
func (*Block) ReceiptHash ¶
func (*Block) RequestsHash ¶
func (*Block) SanityCheck ¶
SanityCheck can be used to prevent that unbounded fields are stuffed with junk data to add processing overhead
func (*Block) SendersToTxs ¶
func (*Block) Size ¶
func (b *Block) Size() libcommon.StorageSize
Size returns the true RLP encoded storage size of the block, either by encoding and returning it, or returning a previously cached value.
func (*Block) Transaction ¶
func (b *Block) Transaction(hash libcommon.Hash) Transaction
func (*Block) Transactions ¶
func (b *Block) Transactions() Transactions
func (*Block) WithSeal ¶
WithSeal returns a new block with the data from b but the header replaced with the sealed one.
func (*Block) Withdrawals ¶
func (b *Block) Withdrawals() Withdrawals
func (*Block) WithdrawalsHash ¶
type BlockNonce ¶
type BlockNonce [8]byte
A BlockNonce is a 64-bit hash which proves (combined with the mix-hash) that a sufficient amount of computation has been carried out on a block.
func EncodeNonce ¶
func EncodeNonce(i uint64) BlockNonce
EncodeNonce converts the given integer to a block nonce.
func (BlockNonce) MarshalText ¶
func (n BlockNonce) MarshalText() ([]byte, error)
MarshalText encodes n as a hex string with 0x prefix.
func (BlockNonce) Uint64 ¶
func (n BlockNonce) Uint64() uint64
Uint64 returns the integer value of a block nonce.
func (*BlockNonce) UnmarshalText ¶
func (n *BlockNonce) UnmarshalText(input []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type BlockWithReceipts ¶
type BlockWithReceipts struct { Block *Block Receipts Receipts Requests FlatRequests }
type Bloom ¶
type Bloom [BloomByteLength]byte
Bloom represents a 2048 bit bloom filter.
func BytesToBloom ¶
BytesToBloom converts a byte slice to a bloom filter. It panics if b is not of suitable size.
func CreateBloom ¶
func (Bloom) Big ¶
Big converts b to a big integer. Note: Converting a bloom filter to a big.Int and then calling GetBytes does not return the same bytes, since big.Int will trim leading zeroes
func (Bloom) MarshalText ¶
MarshalText encodes b as a hex string with 0x prefix.
func (*Bloom) SetBytes ¶
SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.
func (*Bloom) UnmarshalText ¶
UnmarshalText b as a hex string with 0x prefix.
type Body ¶
type Body struct { Transactions []Transaction Uncles []*Header Withdrawals []*Withdrawal }
Body is a simple (mutable, non-safe) data container for storing and moving a block's data contents (transactions and uncles) together.
func (Body) EncodingSize ¶
func (*Body) SendersFromTxs ¶
Copy transaction senders from transactions to the body
func (*Body) SendersToTxs ¶
Copy transaction senders from body into the transactions
type BodyForStorage ¶
type BodyForStorage struct { BaseTxnID BaseTxnID TxCount uint32 Uncles []*Header Withdrawals []*Withdrawal }
type CommonTx ¶
type CommonTx struct { TransactionMisc Nonce uint64 // nonce of sender account Gas uint64 // gas limit To *libcommon.Address `rlp:"nil"` // nil means contract creation Value *uint256.Int // wei amount Data []byte // contract invocation input data V, R, S uint256.Int // signature values }
func (*CommonTx) GetBlobGas ¶
func (*CommonTx) GetBlobHashes ¶
func (*CommonTx) IsContractDeploy ¶
type DynamicFeeTransaction ¶
type DynamicFeeTransaction struct { CommonTx ChainID *uint256.Int Tip *uint256.Int FeeCap *uint256.Int AccessList AccessList }
func NewEIP1559Transaction ¶
func NewEIP1559Transaction(chainID uint256.Int, nonce uint64, to libcommon.Address, amount *uint256.Int, gasLimit uint64, gasPrice *uint256.Int, gasTip *uint256.Int, gasFeeCap *uint256.Int, data []byte) *DynamicFeeTransaction
NewEIP1559Transaction creates an unsigned eip1559 transaction.
func (*DynamicFeeTransaction) AsMessage ¶
func (tx *DynamicFeeTransaction) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Message, error)
AsMessage returns the transaction as a core.Message.
func (*DynamicFeeTransaction) DecodeRLP ¶
func (tx *DynamicFeeTransaction) DecodeRLP(s *rlp.Stream) error
func (*DynamicFeeTransaction) EncodeRLP ¶
func (tx *DynamicFeeTransaction) EncodeRLP(w io.Writer) error
func (*DynamicFeeTransaction) EncodingSize ¶
func (tx *DynamicFeeTransaction) EncodingSize() int
func (*DynamicFeeTransaction) GetAccessList ¶
func (tx *DynamicFeeTransaction) GetAccessList() AccessList
func (*DynamicFeeTransaction) GetChainID ¶
func (tx *DynamicFeeTransaction) GetChainID() *uint256.Int
func (*DynamicFeeTransaction) GetEffectiveGasTip ¶
func (tx *DynamicFeeTransaction) GetEffectiveGasTip(baseFee *uint256.Int) *uint256.Int
func (*DynamicFeeTransaction) GetFeeCap ¶
func (tx *DynamicFeeTransaction) GetFeeCap() *uint256.Int
func (*DynamicFeeTransaction) GetPrice ¶
func (tx *DynamicFeeTransaction) GetPrice() *uint256.Int
func (*DynamicFeeTransaction) GetTip ¶
func (tx *DynamicFeeTransaction) GetTip() *uint256.Int
func (*DynamicFeeTransaction) Hash ¶
func (tx *DynamicFeeTransaction) Hash() libcommon.Hash
Hash computes the hash (but not for signatures!)
func (*DynamicFeeTransaction) MarshalBinary ¶
func (tx *DynamicFeeTransaction) MarshalBinary(w io.Writer) error
MarshalBinary returns the canonical encoding of the transaction. For legacy transactions, it returns the RLP encoding. For EIP-2718 typed transactions, it returns the type and payload.
func (*DynamicFeeTransaction) MarshalJSON ¶
func (tx *DynamicFeeTransaction) MarshalJSON() ([]byte, error)
func (*DynamicFeeTransaction) RawSignatureValues ¶
func (*DynamicFeeTransaction) Sender ¶
func (tx *DynamicFeeTransaction) Sender(signer Signer) (libcommon.Address, error)
func (*DynamicFeeTransaction) SigningHash ¶
func (tx *DynamicFeeTransaction) SigningHash(chainID *big.Int) libcommon.Hash
func (*DynamicFeeTransaction) Type ¶
func (tx *DynamicFeeTransaction) Type() byte
accessors for innerTx.
func (*DynamicFeeTransaction) UnmarshalJSON ¶
func (tx *DynamicFeeTransaction) UnmarshalJSON(input []byte) error
func (*DynamicFeeTransaction) Unwrap ¶
func (tx *DynamicFeeTransaction) Unwrap() Transaction
func (*DynamicFeeTransaction) WithSignature ¶
func (tx *DynamicFeeTransaction) WithSignature(signer Signer, sig []byte) (Transaction, error)
type ErigonLog ¶
type ErigonLog struct { Address libcommon.Address `json:"address" gencodec:"required" codec:"1"` Topics []libcommon.Hash `json:"topics" gencodec:"required" codec:"2"` Data []byte `json:"data" gencodec:"required" codec:"3"` BlockNumber uint64 `json:"blockNumber" codec:"-"` TxHash libcommon.Hash `json:"transactionHash" gencodec:"required" codec:"-"` TxIndex uint `json:"transactionIndex" codec:"-"` BlockHash libcommon.Hash `json:"blockHash" codec:"-"` Index uint `json:"logIndex" codec:"-"` Removed bool `json:"removed" codec:"-"` Timestamp uint64 `json:"timestamp" codec:"-"` }
func (ErigonLog) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*ErigonLog) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type ErigonLogs ¶
type ErigonLogs []*ErigonLog
type FlatRequest ¶
FlatRequest carries serialized (flat) request data from any known Request type The RequestData slice can contain collated data for more than one request of the same type
func (*FlatRequest) Encode ¶
func (f *FlatRequest) Encode() []byte
Encodes flat encoding of request the way it should be serialized
func (*FlatRequest) RequestType ¶
func (f *FlatRequest) RequestType() byte
Returns the request type of the underlying request
type FlatRequests ¶
type FlatRequests []FlatRequest
func (FlatRequests) Hash ¶
func (r FlatRequests) Hash() *libcommon.Hash
func (FlatRequests) Len ¶
func (r FlatRequests) Len() int
type Genesis ¶
type Genesis struct { Config *chain.Config `json:"config"` Nonce uint64 `json:"nonce"` Timestamp uint64 `json:"timestamp"` ExtraData []byte `json:"extraData"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` Mixhash libcommon.Hash `json:"mixHash"` Coinbase libcommon.Address `json:"coinbase"` Alloc GenesisAlloc `json:"alloc" gencodec:"required"` AuRaSeal *AuRaSeal `json:"seal"` // These fields are used for consensus tests. Please don't use them // in actual genesis blocks. Number uint64 `json:"number"` GasUsed uint64 `json:"gasUsed"` ParentHash libcommon.Hash `json:"parentHash"` // Header fields added in London and later hard forks BaseFee *big.Int `json:"baseFeePerGas"` // EIP-1559 BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844 ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844 ParentBeaconBlockRoot *libcommon.Hash `json:"parentBeaconBlockRoot"` // EIP-4788 RequestsHash *libcommon.Hash `json:"requestsHash"` // EIP-7685 }
Genesis specifies the header fields, state of a genesis block. It also defines hard fork switch-over blocks through the chain configuration.
func (*Genesis) ConfigOrDefault ¶
func (Genesis) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Genesis) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type GenesisAccount ¶
type GenesisAccount struct { Constructor []byte `json:"constructor,omitempty"` // deployment code Code []byte `json:"code,omitempty"` // final contract code Storage map[libcommon.Hash]libcommon.Hash `json:"storage,omitempty"` Balance *big.Int `json:"balance" gencodec:"required"` Nonce uint64 `json:"nonce,omitempty"` PrivateKey []byte `json:"secretKey,omitempty"` // for tests }
GenesisAccount is an account in the state of the genesis block. Either use "constructor" for deployment code or "code" directly for the final code.
func (GenesisAccount) MarshalJSON ¶
func (g GenesisAccount) MarshalJSON() ([]byte, error)
MarshalJSON marshals as JSON.
func (*GenesisAccount) UnmarshalJSON ¶
func (g *GenesisAccount) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals from JSON.
type GenesisAlloc ¶
type GenesisAlloc map[libcommon.Address]GenesisAccount
GenesisAlloc specifies the initial state that is part of the genesis block.
func DecodeGenesisAlloc ¶
func DecodeGenesisAlloc(i interface{}) (GenesisAlloc, error)
func (*GenesisAlloc) UnmarshalJSON ¶
func (ga *GenesisAlloc) UnmarshalJSON(data []byte) error
type GenesisMismatchError ¶
GenesisMismatchError is raised when trying to overwrite an existing genesis block with an incompatible one.
func (*GenesisMismatchError) Error ¶
func (e *GenesisMismatchError) Error() string
type Header ¶
type Header struct { ParentHash libcommon.Hash `json:"parentHash" gencodec:"required"` UncleHash libcommon.Hash `json:"sha3Uncles" gencodec:"required"` Coinbase libcommon.Address `json:"miner"` Root libcommon.Hash `json:"stateRoot" gencodec:"required"` TxHash libcommon.Hash `json:"transactionsRoot" gencodec:"required"` ReceiptHash libcommon.Hash `json:"receiptsRoot" gencodec:"required"` Bloom Bloom `json:"logsBloom" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Time uint64 `json:"timestamp" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` MixDigest libcommon.Hash `json:"mixHash"` // prevRandao after EIP-4399 Nonce BlockNonce `json:"nonce"` // AuRa extensions (alternative to MixDigest & Nonce) AuRaStep uint64 AuRaSeal []byte BaseFee *big.Int `json:"baseFeePerGas"` // EIP-1559 WithdrawalsHash *libcommon.Hash `json:"withdrawalsRoot"` // EIP-4895 // BlobGasUsed & ExcessBlobGas were added by EIP-4844 and are ignored in legacy headers. BlobGasUsed *uint64 `json:"blobGasUsed"` ExcessBlobGas *uint64 `json:"excessBlobGas"` ParentBeaconBlockRoot *libcommon.Hash `json:"parentBeaconBlockRoot"` // EIP-4788 RequestsHash *libcommon.Hash `json:"requestsHash"` // EIP-7685 // The verkle proof is ignored in legacy headers Verkle bool VerkleProof []byte VerkleKeyVals []verkle.KeyValuePair // contains filtered or unexported fields }
Header represents a block header in the Ethereum blockchain. DESCRIBED: docs/programmers_guide/guide.md#organising-ethereum-state-into-a-merkle-tree
func CopyHeader ¶
CopyHeader creates a deep copy of a block header to prevent side effects from modifying a header variable.
func NewEmptyHeaderForAssembling ¶
func NewEmptyHeaderForAssembling() *Header
NewEmptyHeaderForAssembling - returns mutable header object - for assembling/sealing/etc... when sealing done - `block.WithSeal(header)` called - which producing new block with immutable `Header` by default all headers are immutable
func (*Header) EncodingSize ¶
func (*Header) Hash ¶
Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding.
func (Header) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Header) SanityCheck ¶
SanityCheck checks a few basic things -- these checks are way beyond what any 'sane' production values should hold, and can mainly be used to prevent that the unbounded fields are stuffed with junk data to add processing overhead
func (*Header) Size ¶
func (h *Header) Size() libcommon.StorageSize
Size returns the approximate memory used by all internal contents. It is used to approximate and limit the memory consumption of various caches.
func (*Header) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type JsonAuthorization ¶
type JsonAuthorization struct { ChainID hexutil.Big `json:"chainId"` Address libcommon.Address `json:"address"` Nonce hexutil.Uint64 `json:"nonce"` YParity hexutil.Uint64 `json:"yParity"` R hexutil.Big `json:"r"` S hexutil.Big `json:"s"` }
func (JsonAuthorization) FromAuthorization ¶
func (a JsonAuthorization) FromAuthorization(authorization Authorization) JsonAuthorization
func (JsonAuthorization) ToAuthorization ¶
func (a JsonAuthorization) ToAuthorization() (Authorization, error)
type KZGCommitment ¶
func (KZGCommitment) ComputeVersionedHash ¶
func (c KZGCommitment) ComputeVersionedHash() libcommon.Hash
type LegacyTx ¶
LegacyTx is the transaction data of regular Ethereum transactions.
func NewContractCreation ¶
func NewContractCreation(nonce uint64, amount *uint256.Int, gasLimit uint64, gasPrice *uint256.Int, data []byte) *LegacyTx
NewContractCreation creates an unsigned legacy transaction. Deprecated: use NewTx instead.
func NewTransaction ¶
func NewTransaction(nonce uint64, to libcommon.Address, amount *uint256.Int, gasLimit uint64, gasPrice *uint256.Int, data []byte) *LegacyTx
NewTransaction creates an unsigned legacy transaction. Deprecated: use NewTx instead.
func (*LegacyTx) EncodingSize ¶
func (*LegacyTx) GetAccessList ¶
func (tx *LegacyTx) GetAccessList() AccessList
func (*LegacyTx) GetChainID ¶
func (*LegacyTx) GetEffectiveGasTip ¶
func (*LegacyTx) MarshalJSON ¶
func (*LegacyTx) RawSignatureValues ¶
func (*LegacyTx) UnmarshalJSON ¶
func (*LegacyTx) Unwrap ¶
func (tx *LegacyTx) Unwrap() Transaction
func (*LegacyTx) WithSignature ¶
func (tx *LegacyTx) WithSignature(signer Signer, sig []byte) (Transaction, error)
type Log ¶
type Log struct { // Consensus fields: // address of the contract that generated the event Address libcommon.Address `json:"address" gencodec:"required" codec:"1"` // list of topics provided by the contract. Topics []libcommon.Hash `json:"topics" gencodec:"required" codec:"2"` // supplied by the contract, usually ABI-encoded Data []byte `json:"data" gencodec:"required" codec:"3"` // Derived fields. These fields are filled in by the node // but not secured by consensus. // block in which the transaction was included BlockNumber uint64 `json:"blockNumber" codec:"-"` // hash of the transaction TxHash libcommon.Hash `json:"transactionHash" gencodec:"required" codec:"-"` // index of the transaction in the block TxIndex uint `json:"transactionIndex" codec:"-"` // hash of the block in which the transaction was included BlockHash libcommon.Hash `json:"blockHash" codec:"-"` // index of the log in the block Index uint `json:"logIndex" codec:"-"` // The Removed field is true if this log was reverted due to a chain reorganisation. // You must pay attention to this field if you receive logs through a filter query. Removed bool `json:"removed" codec:"-"` }
Log represents a contract log event. These events are generated by the LOG opcode and stored/indexed by the node.
func (*Log) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type LogForStorage ¶
type LogForStorage Log
LogForStorage is a wrapper around a Log that flattens and parses the entire content of a log including non-consensus fields.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is a fully derived transaction and implements core.Message
func NewMessage ¶
func (Message) AccessList ¶
func (m Message) AccessList() AccessList
func (Message) Authorizations ¶
func (m Message) Authorizations() []Authorization
func (Message) BlobHashes ¶
func (Message) CheckNonce ¶
func (Message) MaxFeePerBlobGas ¶
func (*Message) SetAuthorizations ¶
func (m *Message) SetAuthorizations(authorizations []Authorization)
func (*Message) SetCheckNonce ¶
type RawBody ¶
type RawBody struct { Transactions [][]byte Uncles []*Header Withdrawals []*Withdrawal }
RawBody is semi-parsed variant of Body, where transactions are still unparsed RLP strings It is useful in the situations when actual transaction context is not important, for example when downloading Block bodies from other peers or serving them to other peers
func (RawBody) EncodingSize ¶
type Receipt ¶
type Receipt struct { // Consensus fields: These fields are defined by the Yellow Paper Type uint8 `json:"type,omitempty"` PostState []byte `json:"root" codec:"1"` Status uint64 `json:"status" codec:"2"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"` Bloom Bloom `json:"logsBloom" gencodec:"required"` Logs Logs `json:"logs" gencodec:"required"` // Implementation fields: These fields are added by geth when processing a transaction. // They are stored in the chain database. TxHash libcommon.Hash `json:"transactionHash" gencodec:"required"` ContractAddress libcommon.Address `json:"contractAddress"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` // Inclusion information: These fields provide information about the inclusion of the // transaction corresponding to this receipt. BlockHash libcommon.Hash `json:"blockHash,omitempty"` BlockNumber *big.Int `json:"blockNumber,omitempty"` TransactionIndex uint `json:"transactionIndex"` FirstLogIndexWithinBlock uint32 `json:"-"` // field which used to store in db and re-calc }
Receipt represents the results of a transaction. DESCRIBED: docs/programmers_guide/guide.md#organising-ethereum-state-into-a-merkle-tree
func NewReceipt ¶
NewReceipt creates a barebone transaction receipt, copying the init fields. Deprecated: create receipts using a struct literal instead.
func (*Receipt) DecodeRLP ¶
DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.
func (*Receipt) DeriveFieldsV3ForSingleReceipt ¶
func (r *Receipt) DeriveFieldsV3ForSingleReceipt(txnIdx int, blockHash libcommon.Hash, blockNum uint64, txn Transaction, prevCumulativeGasUsed uint64) error
DeriveFields fills the receipts with their computed fields based on consensus data and contextual infos like containing block and transactions.
func (Receipt) EncodeRLP ¶
EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt into an RLP stream. If no post state is present, byzantium fork is assumed.
func (*Receipt) MarshalBinary ¶
MarshalBinary returns the consensus encoding of the receipt.
func (Receipt) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*Receipt) UnmarshalBinary ¶
UnmarshalBinary decodes the consensus encoding of receipts. It supports legacy RLP receipts and EIP-2718 typed receipts.
func (*Receipt) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type ReceiptForStorage ¶
type ReceiptForStorage Receipt
ReceiptForStorage is a wrapper around a Receipt with RLP serialization that omits the Bloom field and deserialization that re-computes it.
type Receipts ¶
type Receipts []*Receipt
Receipts implements DerivableList for receipts.
func (Receipts) DeriveFields ¶
func (r Receipts) DeriveFields(hash libcommon.Hash, number uint64, txs Transactions, senders []libcommon.Address) error
DeriveFields fills the receipts with their computed fields based on consensus data and contextual infos like containing block and transactions.
func (Receipts) EncodeIndex ¶
EncodeIndex encodes the i'th receipt to w.
type ReceiptsForStorage ¶
type ReceiptsForStorage []*ReceiptForStorage
type SetCodeTransaction ¶
type SetCodeTransaction struct { DynamicFeeTransaction Authorizations []Authorization }
func (*SetCodeTransaction) EncodingSize ¶
func (tx *SetCodeTransaction) EncodingSize() int
func (*SetCodeTransaction) GetAuthorizations ¶
func (tx *SetCodeTransaction) GetAuthorizations() []Authorization
func (*SetCodeTransaction) GetBlobHashes ¶
func (tx *SetCodeTransaction) GetBlobHashes() []libcommon.Hash
func (*SetCodeTransaction) Hash ¶
func (tx *SetCodeTransaction) Hash() libcommon.Hash
func (*SetCodeTransaction) MarshalBinary ¶
func (tx *SetCodeTransaction) MarshalBinary(w io.Writer) error
func (*SetCodeTransaction) Sender ¶
func (tx *SetCodeTransaction) Sender(signer Signer) (libcommon.Address, error)
func (*SetCodeTransaction) SigningHash ¶
func (tx *SetCodeTransaction) SigningHash(chainID *big.Int) libcommon.Hash
func (*SetCodeTransaction) Type ¶
func (tx *SetCodeTransaction) Type() byte
func (*SetCodeTransaction) UnmarshalJSON ¶
func (tx *SetCodeTransaction) UnmarshalJSON(input []byte) error
func (*SetCodeTransaction) Unwrap ¶
func (tx *SetCodeTransaction) Unwrap() Transaction
func (*SetCodeTransaction) WithSignature ¶
func (tx *SetCodeTransaction) WithSignature(signer Signer, sig []byte) (Transaction, error)
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer encapsulates transaction signature handling. The name of this type is slightly misleading because Signers don't actually sign, they're just for validating and processing of signatures.
Note that this interface is not a stable API and may change at any time to accommodate new protocol rules.
func LatestSigner ¶
LatestSigner returns the 'most permissive' Signer available for the given chain configuration. Specifically, this enables support of EIP-155 replay protection and EIP-2930 access list transactions when their respective forks are scheduled to occur at any block number in the chain config.
Use this in transaction-handling code where the current block number is unknown. If you have the current block number available, use MakeSigner instead.
func LatestSignerForChainID ¶
LatestSignerForChainID returns the 'most permissive' Signer available. Specifically, this marks support for EIP-155 replay protection, EIP-2718 typed transactions and EIP-1559 dynamic fee transaction types if chainID is non-nil.
Use this in transaction-handling code where the current block number and fork configuration are unknown. If you have a ChainConfig, use LatestSigner instead. If you have a ChainConfig and know the current block number, use MakeSigner instead.
func MakeFrontierSigner ¶
func MakeFrontierSigner() *Signer
func MakeSigner ¶
MakeSigner returns a Signer based on the given chain config and block number.
func (Signer) Sender ¶
func (sg Signer) Sender(tx Transaction) (libcommon.Address, error)
Sender returns the sender address of the transaction.
func (Signer) SenderWithContext ¶
func (sg Signer) SenderWithContext(context *secp256k1.Context, txn Transaction) (libcommon.Address, error)
SenderWithContext returns the sender address of the transaction.
func (Signer) SignatureValues ¶
SignatureValues returns the raw R, S, V values corresponding to the given signature.
type StateSyncData ¶
type StateSyncData struct { ID uint64 Contract libcommon.Address Data string TxHash libcommon.Hash }
StateSyncData represents state received from Ethereum Blockchain
type Transaction ¶
type Transaction interface { Type() byte GetChainID() *uint256.Int GetNonce() uint64 GetPrice() *uint256.Int GetTip() *uint256.Int GetEffectiveGasTip(baseFee *uint256.Int) *uint256.Int GetFeeCap() *uint256.Int GetBlobHashes() []libcommon.Hash GetGas() uint64 GetBlobGas() uint64 GetValue() *uint256.Int GetTo() *libcommon.Address AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Message, error) WithSignature(signer Signer, sig []byte) (Transaction, error) Hash() libcommon.Hash SigningHash(chainID *big.Int) libcommon.Hash GetData() []byte GetAccessList() AccessList Protected() bool RawSignatureValues() (*uint256.Int, *uint256.Int, *uint256.Int) EncodingSize() int EncodeRLP(w io.Writer) error DecodeRLP(s *rlp.Stream) error MarshalBinary(w io.Writer) error // Sender returns the address derived from the signature (V, R, S) using secp256k1 // elliptic curve and an error if it failed deriving or upon an incorrect // signature. // // Sender may cache the address, allowing it to be used regardless of // signing method. The cache is invalidated if the cached signer does // not match the signer used in the current call. Sender(Signer) (libcommon.Address, error) GetSender() (libcommon.Address, bool) SetSender(libcommon.Address) IsContractDeploy() bool Unwrap() Transaction // If this is a network wrapper, returns the unwrapped txn. Otherwise returns itself. // contains filtered or unexported methods }
Transaction is an Ethereum transaction.
func DecodeRLPTransaction ¶
func DecodeRLPTransaction(s *rlp.Stream, blobTxnsAreWrappedWithBlobs bool) (Transaction, error)
func DecodeTransaction ¶
func DecodeTransaction(data []byte) (Transaction, error)
DecodeTransaction decodes a transaction either in RLP or canonical format
func DecodeTransactions ¶
func DecodeTransactions(txs [][]byte) ([]Transaction, error)
func DecodeWrappedTransaction ¶
func DecodeWrappedTransaction(data []byte) (Transaction, error)
DecodeWrappedTransaction as similar to DecodeTransaction, but type-3 (blob) transactions are expected to be wrapped with blobs/commitments/proofs. See https://eips.ethereum.org/EIPS/eip-4844#networking
func MustSignNewTx ¶
func MustSignNewTx(prv *ecdsa.PrivateKey, s Signer, txn Transaction) Transaction
MustSignNewTx creates a transaction and signs it. This panics if the transaction cannot be signed.
func SignNewTx ¶
func SignNewTx(prv *ecdsa.PrivateKey, s Signer, txn Transaction) (Transaction, error)
SignNewTx creates a transaction and signs it.
func SignTx ¶
func SignTx(txn Transaction, s Signer, prv *ecdsa.PrivateKey) (Transaction, error)
SignTx signs the transaction using the given signer and private key.
func UnmarshalBlobTxJSON ¶
func UnmarshalBlobTxJSON(input []byte) (Transaction, error)
func UnmarshalTransactionFromBinary ¶
func UnmarshalTransactionFromBinary(data []byte, blobTxnsAreWrappedWithBlobs bool) (Transaction, error)
Parse transaction without envelope.
func UnmarshalTransactionFromJSON ¶
func UnmarshalTransactionFromJSON(input []byte) (Transaction, error)
type TransactionMisc ¶
type TransactionMisc struct {
// contains filtered or unexported fields
}
TransactionMisc is collection of miscellaneous fields for transaction that is supposed to be embedded into concrete implementations of different transaction types
type Transactions ¶
type Transactions []Transaction
Transactions implements DerivableList for transactions.
func CopyTxs ¶
func CopyTxs(in Transactions) Transactions
func TxDifference ¶
func TxDifference(a, b Transactions) Transactions
TxDifference returns a new set which is the difference between a and b.
func (Transactions) EncodeIndex ¶
func (s Transactions) EncodeIndex(i int, w *bytes.Buffer)
EncodeIndex encodes the i'th transaction to w. Note that this does not check for errors because we assume that *Transaction will only ever contain valid txs that were either constructed by decoding or via public API in this package.
type TransactionsGroupedBySender ¶
type TransactionsGroupedBySender []Transactions
TransactionsGroupedBySender - lists of transactions grouped by sender
type TxByNonce ¶
type TxByNonce Transactions
TxByNonce implements the sort interface to allow sorting a list of transactions by their nonces. This is usually only useful for sorting transactions from a single account, otherwise a nonce comparison doesn't make much sense.
type Withdrawal ¶
type Withdrawal struct { Index uint64 `json:"index"` // monotonically increasing identifier issued by consensus layer Validator uint64 `json:"validatorIndex"` // index of validator associated with withdrawal Address libcommon.Address `json:"address"` // target address for withdrawn ether Amount uint64 `json:"amount"` // value of withdrawal in GWei }
Withdrawal represents a validator withdrawal from the consensus layer. See EIP-4895: Beacon chain push withdrawals as operations.
func (*Withdrawal) Clone ¶
func (*Withdrawal) Clone() clonable.Clonable
func (*Withdrawal) EncodingSize ¶
func (obj *Withdrawal) EncodingSize() int
func (Withdrawal) MarshalJSON ¶
func (w Withdrawal) MarshalJSON() ([]byte, error)
MarshalJSON marshals as JSON.
func (*Withdrawal) UnmarshalJSON ¶
func (w *Withdrawal) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals from JSON.
type Withdrawals ¶
type Withdrawals []*Withdrawal
Withdrawals implements DerivableList for withdrawals.
func (Withdrawals) EncodeIndex ¶
func (s Withdrawals) EncodeIndex(i int, w *bytes.Buffer)
EncodeIndex encodes the i'th withdrawal to w. Note that this does not check for errors because we assume that *Withdrawal will only ever contain valid withdrawals that were either constructed by decoding or via public API in this package.
func (Withdrawals) Len ¶
func (s Withdrawals) Len() int
Source Files ¶
- access_list_tx.go
- authorization.go
- blacklist.go
- blob_tx.go
- blob_tx_wrapper.go
- block.go
- bloom9.go
- dynamic_fee_tx.go
- eip7685_requests.go
- gen_aura_seal.go
- gen_erigon_log_json.go
- gen_genesis.go
- gen_genesis_account.go
- gen_header_json.go
- gen_log_json.go
- gen_receipt_json.go
- gen_withdrawal_json.go
- genesis.go
- hashing.go
- legacy_tx.go
- log.go
- receipt.go
- set_code_tx.go
- state_data.go
- transaction.go
- transaction_marshalling.go
- transaction_signing.go
- withdrawal.go