ethtypes

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Overview

The ethtypes library provides a collection of common Ethereum types implemented in Go. These types are essential for building various tools and modules within the Ethereum ecosystem. The library aims to standardize and simplify the development process by offering a consistent set of types that can be reused across different projects.

Usage

To use ethtypes in your project, simply pull it in with:

go get -u github.com/sig-0/ethtypes

To view examples on using the library, please refer to the relevant Go doc.

Documentation

Overview

Package ethtypes provides a collection of common Ethereum types implemented in Go. These types are essential for building various tools and modules within the Ethereum ecosystem. The library aims to standardize and simplify the development process by offering a consistent set of types that can be reused across different projects.

Index

Constants

View Source
const (
	TransactionLegacy = iota
	Transaction1559
	Transaction2930
)

Variables

View Source
var ZeroAddress = Address{}

ZeroAddress represents a placeholder address value that contains all zero bytes

View Source
var ZeroHash = Hash{}

ZeroHash represents a placeholder hash value that contains all zero bytes

Functions

This section is empty.

Types

type AccessListEntry

type AccessListEntry struct {
	StorageKeys []Hash
	Address     Address
	GasUsed     uint64
}

type Address

type Address [addressSize]byte

func BytesToAddress

func BytesToAddress(address []byte) Address

BytesToAddress converts the specified address bytes into an Address representation (20B)

func StringToAddress

func StringToAddress(input string) Address

StringToAddress converts the specified address string into an Address representation

func (Address) ToBytes

func (a Address) ToBytes() []byte

ToBytes converts the specific address to a bytes representation

func (Address) ToString

func (a Address) ToString() string

ToString converts the specific address to a string representation (checksummed)

type Block

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

type Bloom

type Bloom [bloomSize]byte

func (Bloom) ToBytes

func (b Bloom) ToBytes() []byte

type Hash

type Hash [hashSize]byte

func BytesToHash

func BytesToHash(hash []byte) Hash

BytesToHash converts the specified hash bytes into a Hash representation (32B)

func StringToHash

func StringToHash(input string) Hash

StringToHash converts the specified hash string into a Hash representation

func (Hash) ToBytes

func (h Hash) ToBytes() []byte

ToBytes converts the specific hash to a bytes representation

func (Hash) ToString

func (h Hash) ToString() string

ToString converts the specific hash to a string hex representation

type Header struct {
	ParentHash       Hash
	UncleHash        Hash
	Beneficiary      Address
	StateRoot        Hash
	TransactionsRoot Hash
	ReceiptsRoot     Hash
	LogsBloom        Bloom
	Difficulty       uint64
	Number           uint64
	GasLimit         uint64
	GasUsed          uint64
	Time             uint64
	MixDigest        Hash
	Nonce            Nonce
}

type Log

type Log struct {
	Topics  []Hash
	Data    []byte
	Address Address
}

type Nonce

type Nonce [8]byte

type Transaction

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

func (*Transaction) Cost

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

func (*Transaction) GetAccessList

func (t *Transaction) GetAccessList() []*AccessListEntry

func (*Transaction) GetChainID

func (t *Transaction) GetChainID() uint64

func (*Transaction) GetData

func (t *Transaction) GetData() []byte

func (*Transaction) GetGas

func (t *Transaction) GetGas() uint64

func (*Transaction) GetGasPrice

func (t *Transaction) GetGasPrice() *big.Int

func (*Transaction) GetHash

func (t *Transaction) GetHash() Hash

func (*Transaction) GetMaxFeePerGas

func (t *Transaction) GetMaxFeePerGas() *big.Int

func (*Transaction) GetMaxPriorityFeePerGas

func (t *Transaction) GetMaxPriorityFeePerGas() *big.Int

func (*Transaction) GetNonce

func (t *Transaction) GetNonce() uint64

func (*Transaction) GetSigValues

func (t *Transaction) GetSigValues() (v, r, s *big.Int)

func (*Transaction) GetTo

func (t *Transaction) GetTo() Address

GetTo returns the To address of the transaction. If none is set (ex. contract deployment), it returns ZeroAddress

func (*Transaction) GetType

func (t *Transaction) GetType() byte

func (*Transaction) GetValue

func (t *Transaction) GetValue() *big.Int

type TransactionData

type TransactionData interface {
	// contains filtered or unexported methods
}

Directories

Path Synopsis
Package hex provides the common hex manipulation functionality.
Package hex provides the common hex manipulation functionality.
Package keccak provides a utility wrapper for the sha256 legacy keccak implementation.
Package keccak provides a utility wrapper for the sha256 legacy keccak implementation.

Jump to

Keyboard shortcuts

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