types

package
v0.0.0-...-15e8d78 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: GPL-3.0, GPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package types contains data types related to abeychain consensus.

Index

Constants

View Source
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
)
View Source
const (
	// CommitteeStart start pbft consensus
	CommitteeStart = iota
	// CommitteeStop stop pbft consensus
	CommitteeStop
	// CommitteeSwitchover switch pbft committee
	CommitteeSwitchover
	// CommitteeUpdate update committee members and backups
	CommitteeUpdate
	// CommitteeOver notify current pbft committee end fastBlock
	CommitteeOver

	StateUnusedFlag    = 0xa0
	StateUsedFlag      = 0xa1
	StateSwitchingFlag = 0xa2
	StateRemovedFlag   = 0xa3
	StateAppendFlag    = 0xa4
	// health enter type
	TypeFixed  = 0xa1
	TypeWorked = 0xa2
	TypeBack   = 0xa3
)
View Source
const (
	//VoteAgreeAgainst vote sign with against
	VoteAgreeAgainst = iota
	//VoteAgree vote sign with agree
	VoteAgree

	Normal = iota
	FetcherCall
	DownloaderCall
	SFetcherCall
	SDownloaderCall

	PeerSendCall
	FetcherHeadCall
	SFetcherHeadCall
	DownloaderFetchCall
	DownloaderPartCall
	SDownloaderFetchCall
	SDownloaderLoopCall
	SDownloaderPartCall
)
View Source
const (
	// StateStakingOnce can be election only once
	StateStakingOnce uint8 = 1 << iota
	// StateStakingAuto can be election in every epoch
	StateStakingAuto
	StateStakingCancel
	// StateRedeem can be redeem real time (after MaxRedeemHeight block)
	StateRedeem
	// StateRedeemed flag the asset which is staking in the height is redeemed
	StateRedeemed
)
View Source
const (
	OpQueryStaking uint8 = 1 << iota
	OpQueryLocked
	OpQueryCancelable
)
View Source
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)
)

Variables

View Source
var (
	EmptyRootHash  = DeriveSha(Transactions{})
	EmptyUncleHash = CalcUncleHash(nil)
	EmptySignHash  = CalcSignHash(nil)
)
View Source
var (
	// ErrHeightNotYet When the height of the committee is higher than the local height, it is issued.
	ErrHeightNotYet = errors.New("pbft send block height not yet")

	// ErrSnailHeightNotYet Snail height not yet
	ErrSnailHeightNotYet = errors.New("Snail height not yet")

	//ErrSnailBlockNotOnTheCain Snail block not on the cain
	ErrSnailBlockNotOnTheCain = errors.New("Snail block not on the chain")

	//ErrSnailBlockTooSlow Snail block too slow
	ErrSnailBlockTooSlow = errors.New("Snail block too slow")

	ErrPayersign = errors.New("signed_addr not equal tx.data.Payer")
)
View Source
var (
	Base       = new(big.Int).SetUint64(10000)
	InvalidFee = big.NewInt(65535)
	// StakingAddress is defined as Address('truestaking')
	// i.e. contractAddress = 0x000000000000000000747275657374616b696E67
	StakingAddress = common.BytesToAddress([]byte("truestaking"))
	MixEpochCount  = 2
)
View Source
var (
	ErrInvalidParam      = errors.New("Invalid Param")
	ErrOverEpochID       = errors.New("Over epoch id")
	ErrNotSequential     = errors.New("epoch id not sequential")
	ErrInvalidEpochInfo  = errors.New("Invalid epoch info")
	ErrNotFoundEpoch     = errors.New("cann't found the epoch info")
	ErrInvalidStaking    = errors.New("Invalid staking account")
	ErrMatchEpochID      = errors.New("wrong match epoch id in a reward block")
	ErrNotStaking        = errors.New("Not match the staking account")
	ErrNotDelegation     = errors.New("Not match the delegation account")
	ErrNotMatchEpochInfo = errors.New("the epoch info is not match with accounts")
	ErrNotElectionTime   = errors.New("not time to election the next committee")
	ErrAmountOver        = errors.New("the amount more than staking amount")
	ErrDelegationSelf    = errors.New("Cann't delegation myself")
	ErrRedeemAmount      = errors.New("wrong redeem amount")
	ErrForbidAddress     = errors.New("Forbidding Address")
	ErrRepeatPk          = errors.New("repeat PK on staking tx")
)
View Source
var Bloom9 = bloom9
View Source
var (
	ErrInvalidChainId = errors.New("invalid chain id for signer")
)
View Source
var (
	ErrInvalidSig = errors.New("invalid transaction v, r, s values")
)

Functions

func BloomLookup

func BloomLookup(bin Bloom, topic bytesBacked) bool

func CalcSignHash

func CalcSignHash(signs []*PbftSign) common.Hash

func CalcUncleHash

func CalcUncleHash(uncles []*Header) common.Hash

func CopyVotePk

func CopyVotePk(pk []byte) []byte

func DeriveSha

func DeriveSha(list DerivableList) common.Hash

func FetchOneToAbey

func FetchOneToAbey(sas []*SARewardInfos, addr common.Address) map[string]interface{}

func ForbidAddress

func ForbidAddress(addr common.Address) error

func FromBlock

func FromBlock(block *SnailBlock) (begin, end uint64)

func FruitNumber

func FruitNumber(b1, b2 *SnailBlock) bool

func IsUnlocked

func IsUnlocked(eid, height uint64) bool

func LogsBloom

func LogsBloom(logs []*Log) *big.Int

func MergeReward

func MergeReward(map1, map2 map[common.Address]*big.Int) map[common.Address]*big.Int

func MinCalcRedeemHeight

func MinCalcRedeemHeight(eid uint64) uint64

func Number

func Number(b1, b2 *Block) bool

func Payer

func Payer(signer Signer, tx *Transaction) (common.Address, error)

PSender returns the address derived from the signature (PV, PR, PS) using secp256k1 elliptic curve and an error if it failed deriving or upon an incorrect signature.

func RlpHash

func RlpHash(x interface{}) (h common.Hash)

func Sender

func Sender(signer Signer, tx *Transaction) (common.Address, 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.

func SignatureValues

func SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error)

func SnailNumber

func SnailNumber(b1, b2 *SnailBlock) bool

func ToAbey

func ToAbey(val *big.Int) *big.Float

func ToJSON

func ToJSON(ii *ImpawnSummay) map[string]interface{}

func ValidPk

func ValidPk(pk []byte) error

Types

type BalanceChangeContent

type BalanceChangeContent struct {
	AddrWithBalance map[common.Address]*big.Int `json:"addrWithBalance"       gencodec:"required"`
}

type BalanceInfo

type BalanceInfo struct {
	Address common.Address `json:"address"`
	Valid   *big.Int       `json:"valid"`
	Lock    *big.Int       `json:"lock"`
}

func ToBalanceInfos

func ToBalanceInfos(items map[common.Address]*BalanceInfo) []*BalanceInfo

type Block

type Block struct {

	// These fields are used by package abey to track
	// inter-peer block relay.
	ReceivedAt   time.Time
	ReceivedFrom interface{}
	// contains filtered or unexported fields
}

Block represents an entire block in the abeychain blockchain.

func NewBlock

func NewBlock(header *Header, txs []*Transaction, receipts []*Receipt, signs []*PbftSign, infos []*CommitteeMember) *Block

NewBlock creates a new fast block. The input data is copied, changes to header and to the field values will not affect the block.

The values of TxHash, ReceiptHash and Bloom in header are ignored and set to values derived from the given txs and receipts.

func NewBlockWithHeader

func NewBlockWithHeader(header *Header) *Block

NewBlockWithHeader creates a fast 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 NewLesRawBlock

func NewLesRawBlock(header *Header, infos []*CommitteeMember) *Block

func (*Block) AllSigns

func (b *Block) AllSigns() []*PbftSign

func (*Block) AppendSign

func (b *Block) AppendSign(sign *PbftSign)

func (*Block) AppendSigns

func (b *Block) AppendSigns(signs []*PbftSign)

func (*Block) Bloom

func (b *Block) Bloom() Bloom

func (*Block) Body

func (b *Block) Body() *Body

Body returns the non-header content of the block.

func (*Block) Coinbase

func (b *Block) Coinbase() common.Address

func (*Block) CommitteeHash

func (b *Block) CommitteeHash() common.Hash

func (*Block) DecodeRLP

func (b *Block) DecodeRLP(s *rlp.Stream) error

DecodeRLP decodes the abeychain

func (*Block) EncodeRLP

func (b *Block) EncodeRLP(w io.Writer) error

EncodeRLP serializes b into the abeychain RLP block format.

func (*Block) Extra

func (b *Block) Extra() []byte

func (*Block) GasLimit

func (b *Block) GasLimit() uint64

func (*Block) GasUsed

func (b *Block) GasUsed() uint64

func (*Block) GetLeaderSign

func (b *Block) GetLeaderSign() *PbftSign

func (*Block) GetLocalSigns

func (b *Block) GetLocalSigns() (PbftSigns, PbftSigns)

func (*Block) GetSignHash

func (b *Block) GetSignHash() common.Hash

func (*Block) Hash

func (b *Block) Hash() common.Hash

Hash returns the keccak256 hash of b's header. The hash is computed on the first call and cached thereafter.

func (*Block) Header

func (b *Block) Header() *Header

func (*Block) IsAward

func (b *Block) IsAward() bool

func (*Block) IsProposal

func (b *Block) IsProposal() bool

Condition when proposal block award or switch is not nil

func (*Block) IsSwitch

func (b *Block) IsSwitch() bool

func (*Block) Number

func (b *Block) Number() *big.Int

func (*Block) NumberU64

func (b *Block) NumberU64() uint64

func (*Block) ParentHash

func (b *Block) ParentHash() common.Hash

func (*Block) Proposer

func (b *Block) Proposer() common.Address

func (*Block) ReceiptHash

func (b *Block) ReceiptHash() common.Hash

func (*Block) Root

func (b *Block) Root() common.Hash

func (*Block) SetSign

func (b *Block) SetSign(signs []*PbftSign)

func (*Block) SetSignInfosByPrevBlock

func (b *Block) SetSignInfosByPrevBlock(prev *Block)

func (*Block) SignedHash

func (b *Block) SignedHash() common.Hash

func (*Block) Signs

func (b *Block) Signs() []*PbftSign

func (*Block) Size

func (b *Block) Size() common.StorageSize

Size returns the true RLP encoded storage size of the block, either by encoding and returning it, or returning a previsouly cached value.

func (*Block) SnailHash

func (b *Block) SnailHash() common.Hash

func (*Block) SnailNumber

func (b *Block) SnailNumber() *big.Int

func (*Block) SwitchInfos

func (b *Block) SwitchInfos() []*CommitteeMember

func (*Block) Time

func (b *Block) Time() *big.Int

func (*Block) Transaction

func (b *Block) Transaction(hash common.Hash) *Transaction

func (*Block) Transactions

func (b *Block) Transactions() Transactions

func (*Block) TxHash

func (b *Block) TxHash() common.Hash

func (*Block) UncleHash

func (b *Block) UncleHash() common.Hash

func (*Block) UpdateSnailHash

func (b *Block) UpdateSnailHash(h common.Hash)

func (*Block) WithBody

func (b *Block) WithBody(transactions []*Transaction, signs []*PbftSign, infos []*CommitteeMember) *Block

WithBody returns a new block with the given transaction contents.

func (*Block) WithSeal

func (b *Block) WithSeal(header *Header) *Block

WithSeal returns a new block with the data from b but the header replaced with the sealed one. fastchain not use

type BlockBalance

type BlockBalance struct {
	Balance []*BalanceInfo `json:"addrWithBalance"       gencodec:"required"`
}

func (*BlockBalance) ToMap

func (s *BlockBalance) ToMap() map[common.Address]*BalanceInfo

type BlockBy

type BlockBy func(b1, b2 *Block) bool

func (BlockBy) Sort

func (self BlockBy) Sort(blocks Blocks)

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 BlockReward

type BlockReward struct {
	FastHash    common.Hash `json:"FastHash"        gencodec:"required"`
	FastNumber  *big.Int    `json:"FastNumber"      gencodec:"required"`
	SnailHash   common.Hash `json:"SnailHash"        gencodec:"required"`
	SnailNumber *big.Int    `json:"SnailNumber"      gencodec:"required"`
}

BlockReward

type Blocks

type Blocks []*Block

type Bloom

type Bloom [BloomByteLength]byte

Bloom represents a 2048 bit bloom filter.

func BytesToBloom

func BytesToBloom(b []byte) Bloom

BytesToBloom converts a byte slice to a bloom filter. It panics if b is not of suitable size.

func CreateBloom

func CreateBloom(receipts Receipts) Bloom

func (*Bloom) Add

func (b *Bloom) Add(d *big.Int)

Add adds d to the filter. Future calls of Test(d) will return true.

func (Bloom) Big

func (b Bloom) Big() *big.Int

Big converts b to a big integer.

func (Bloom) Bytes

func (b Bloom) Bytes() []byte

func (Bloom) MarshalText

func (b Bloom) MarshalText() ([]byte, error)

MarshalText encodes b as a hex string with 0x prefix.

func (*Bloom) SetBytes

func (b *Bloom) SetBytes(d []byte)

SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.

func (Bloom) Test

func (b Bloom) Test(test *big.Int) bool

func (Bloom) TestBytes

func (b Bloom) TestBytes(test []byte) bool

func (*Bloom) UnmarshalText

func (b *Bloom) UnmarshalText(input []byte) error

UnmarshalText b as a hex string with 0x prefix.

type Body

type Body struct {
	Transactions []*Transaction
	Signs        []*PbftSign
	Infos        []*CommitteeMember
}

Body is a simple (mutable, non-safe) data container for storing and moving a block's data contents (transactions and uncles) together.

func (*Body) GetSwitchInfo

func (b *Body) GetSwitchInfo() []*CommitteeMember

GetSwitchInfo get info for shift committee

func (*Body) SetLeaderSign

func (b *Body) SetLeaderSign(sign *PbftSign)

SetLeaderSign keep the sign on the head for proposal

func (*Body) SetSwitchInfo

func (b *Body) SetSwitchInfo(infos []*CommitteeMember)

SetSwitchInfo set info for shift committee

type ChainReward

type ChainReward struct {
	Height        uint64
	St            uint64
	CoinBase      *RewardInfo      `json:"blockminer"`
	FruitBase     []*RewardInfo    `json:"fruitminer"`
	CommitteeBase []*SARewardInfos `json:"committeeReward"`
}

func CloneChainReward

func CloneChainReward(reward *ChainReward) *ChainReward

func NewChainReward

func NewChainReward(height, tt uint64, coin *RewardInfo, fruits []*RewardInfo, committee []*SARewardInfos) *ChainReward

func (*ChainReward) CoinRewardInfo

func (s *ChainReward) CoinRewardInfo() map[string]interface{}

func (*ChainReward) CommitteeRewardInfo

func (s *ChainReward) CommitteeRewardInfo() map[string]interface{}

func (*ChainReward) FruitRewardInfo

func (s *ChainReward) FruitRewardInfo() map[string]interface{}

type CommitteeInfo

type CommitteeInfo struct {
	Id          *big.Int
	StartHeight *big.Int
	EndHeight   *big.Int
	Members     []*CommitteeMember
	BackMembers []*CommitteeMember
}

func CopyCommitteeInfo

func CopyCommitteeInfo(committeeInfo *CommitteeInfo) *CommitteeInfo

func (*CommitteeInfo) GetAllMembers

func (c *CommitteeInfo) GetAllMembers() []*CommitteeMember

func (*CommitteeInfo) String

func (c *CommitteeInfo) String() string

type CommitteeMember

type CommitteeMember struct {
	Coinbase      common.Address `json:"coinbase`
	CommitteeBase common.Address `json:"committeebase`
	Publickey     []byte
	Flag          uint32
	MType         uint32
}

func NewCommitteeMember

func NewCommitteeMember(coinBase common.Address, publicKey []byte, flag, mType uint32) *CommitteeMember

func (*CommitteeMember) Compared

func (c *CommitteeMember) Compared(d *CommitteeMember) bool

func (*CommitteeMember) String

func (c *CommitteeMember) String() string

func (*CommitteeMember) UnmarshalJSON

func (c *CommitteeMember) UnmarshalJSON(input []byte) error

type CommitteeMembers

type CommitteeMembers []*CommitteeMember

CommitteeMembers committee members

type CommitteeNode

type CommitteeNode struct {
	IP        string
	Port      uint32
	Port2     uint32
	Coinbase  common.Address
	Publickey []byte
}

CommitteeNode contains main info of committee node

func (*CommitteeNode) ConvertCommitteeNodeToTransport

func (cn *CommitteeNode) ConvertCommitteeNodeToTransport() *TransportCommitteeNode

func (*CommitteeNode) String

func (c *CommitteeNode) String() string

type CommitteeNodeTag

type CommitteeNodeTag struct {
	CommitteeID *big.Int
	PubKey      []byte
}

func (*CommitteeNodeTag) Hash

func (c *CommitteeNodeTag) Hash() common.Hash

type DerivableList

type DerivableList interface {
	Len() int
	GetRlp(i int) []byte
}

type ElectionCommittee

type ElectionCommittee struct {
	Members []*CommitteeMember
	Backups []*CommitteeMember
}

ElectionCommittee defines election members result

type ElectionEvent

type ElectionEvent struct {
	Option           uint
	CommitteeID      *big.Int
	CommitteeMembers []*CommitteeMember
	BackupMembers    []*CommitteeMember
	BeginFastNumber  *big.Int
	EndFastNumber    *big.Int
}

type EncryptCommitteeNode

type EncryptCommitteeNode []byte

EncryptCommitteeNode represent a committee member encrypt info which encrypt committeeNode with member Publickey

type EncryptNodeMessage

type EncryptNodeMessage struct {
	CreatedAt   *big.Int
	CommitteeID *big.Int
	Nodes       []EncryptCommitteeNode
	Sign        //sign msg
	// contains filtered or unexported fields
}

EncryptNodeMessage all information of the committee

func (*EncryptNodeMessage) DecodeRLP

func (c *EncryptNodeMessage) DecodeRLP(s *rlp.Stream) error

DecodeRLP decodes the abeychain

func (*EncryptNodeMessage) EncodeRLP

func (c *EncryptNodeMessage) EncodeRLP(w io.Writer) error

EncodeRLP serializes b into the abeychain RLP block format.

func (*EncryptNodeMessage) Hash

func (c *EncryptNodeMessage) Hash() common.Hash

func (*EncryptNodeMessage) HashWithoutSign

func (c *EncryptNodeMessage) HashWithoutSign() common.Hash

func (*EncryptNodeMessage) Size

func (*EncryptNodeMessage) String

func (c *EncryptNodeMessage) String(str string)

type EpochIDInfo

type EpochIDInfo struct {
	EpochID     uint64
	BeginHeight uint64
	EndHeight   uint64
}

func GetEpochFromHeight

func GetEpochFromHeight(hh uint64) *EpochIDInfo

func GetEpochFromID

func GetEpochFromID(eid uint64) *EpochIDInfo

func GetEpochFromRange

func GetEpochFromRange(begin, end uint64) []*EpochIDInfo

func GetFirstEpoch

func GetFirstEpoch() *EpochIDInfo

func GetPreFirstEpoch

func GetPreFirstEpoch() *EpochIDInfo

func (*EpochIDInfo) String

func (e *EpochIDInfo) String() string

type FastBalanceChangeContent

type FastBalanceChangeContent struct {
	AddrWithBalance map[common.Address]*BalanceInfo `json:"addrWithBalance"       gencodec:"required"`
}

type FastChainEvent

type FastChainEvent struct {
	Block *Block
	Hash  common.Hash
	Logs  []*Log
}

type FastChainHeadEvent

type FastChainHeadEvent struct{ Block *Block }

type FastChainSideEvent

type FastChainSideEvent struct {
	Block *Block
}

type FruitEvent

type FruitEvent struct {
	Block *Block
	Hash  common.Hash
	Logs  []*Log
}

FruitEvent for fruit event,seems not used

type Fruits

type Fruits []*SnailBlock

Fruits is a wrapper around a fruit array to implement DerivableList.

func (Fruits) GetRlp

func (fs Fruits) GetRlp(i int) []byte

GetRlp returns the RLP encoding of one fruit from the list.

func (Fruits) Len

func (fs Fruits) Len() int

Len returns the number of fruits in this list.

type FruitsHeaders

type FruitsHeaders []*SnailHeader

Headers is a wrapper around a fruit header array to implement DerivableList.

func (FruitsHeaders) GetRlp

func (fs FruitsHeaders) GetRlp(i int) []byte

GetRlp returns the RLP encoding of one fruit header from the list.

func (FruitsHeaders) Len

func (fs FruitsHeaders) Len() int

Len returns the number of headers in this list.

type GenesisAccount

type GenesisAccount struct {
	Code       []byte                      `json:"code,omitempty"`
	Storage    map[common.Hash]common.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.

func (GenesisAccount) MarshalJSON

func (g GenesisAccount) MarshalJSON() ([]byte, error)

func (*GenesisAccount) UnmarshalJSON

func (g *GenesisAccount) UnmarshalJSON(input []byte) error

type GenesisAlloc

type GenesisAlloc map[common.Address]GenesisAccount

func DecodePrealloc

func DecodePrealloc(data string) GenesisAlloc

func (*GenesisAlloc) UnmarshalJSON

func (ga *GenesisAlloc) UnmarshalJSON(data []byte) error

type GenesisMismatchError

type GenesisMismatchError struct {
	Stored, New common.Hash
}

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 struct {
	ParentHash    common.Hash    `json:"parentHash"       gencodec:"required"`
	Root          common.Hash    `json:"stateRoot"        gencodec:"required"`
	TxHash        common.Hash    `json:"transactionsRoot" gencodec:"required"`
	ReceiptHash   common.Hash    `json:"receiptsRoot"     gencodec:"required"`
	CommitteeHash common.Hash    `json:"committeeRoot"    gencodec:"required"`
	Proposer      common.Address `json:"miner"            gencodec:"required"`
	Bloom         Bloom          `json:"logsBloom"        gencodec:"required"`
	SnailHash     common.Hash    `json:"snailHash"        gencodec:"required"`
	SnailNumber   *big.Int       `json:"snailNumber"      gencodec:"required"`
	Number        *big.Int       `json:"number"           gencodec:"required"`
	GasLimit      uint64         `json:"gasLimit"         gencodec:"required"`
	GasUsed       uint64         `json:"gasUsed"          gencodec:"required"`
	Time          *big.Int       `json:"timestamp"        gencodec:"required"`
	Extra         []byte         `json:"extraData"        gencodec:"required"`
}

Header represents a block header in the true blockchain.

func CopyHeader

func CopyHeader(h *Header) *Header

CopyHeader creates a deep copy of a fast block header to prevent side effects from modifying a header variable.

func (*Header) Hash

func (h *Header) Hash() common.Hash

Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding.

func (Header) MarshalJSON

func (h Header) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Header) Size

func (h *Header) Size() common.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

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

UnmarshalJSON unmarshals from JSON.

type ImpawnSummay

type ImpawnSummay struct {
	LastReward uint64
	Accounts   uint64
	AllAmount  *big.Int
	Infos      []*SummayEpochInfo
}

type LockedItem

type LockedItem struct {
	Amount *big.Int
	Locked bool
}

type LockedValue

type LockedValue struct {
	Value map[uint64]*LockedItem
}

LockedValue,the key of Value is epochid

type Log

type Log struct {
	// Consensus fields:
	// address of the contract that generated the event
	Address common.Address `json:"address" gencodec:"required"`
	// list of topics provided by the contract.
	Topics []common.Hash `json:"topics" gencodec:"required"`
	// supplied by the contract, usually ABI-encoded
	Data []byte `json:"data" gencodec:"required"`

	// 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"`
	// hash of the transaction
	TxHash common.Hash `json:"transactionHash" gencodec:"required"`
	// index of the transaction in the block
	TxIndex uint `json:"transactionIndex" gencodec:"required"`
	// hash of the block in which the transaction was included
	BlockHash common.Hash `json:"blockHash"`
	// index of the log in the receipt
	Index uint `json:"logIndex" gencodec:"required"`

	// 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"`
}

Log represents a contract log event. These events are generated by the LOG opcode and stored/indexed by the node.

func (*Log) DecodeRLP

func (l *Log) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder.

func (*Log) EncodeRLP

func (l *Log) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder.

func (Log) MarshalJSON

func (l Log) MarshalJSON() ([]byte, error)

func (*Log) UnmarshalJSON

func (l *Log) UnmarshalJSON(input []byte) error

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.

func (*LogForStorage) DecodeRLP

func (l *LogForStorage) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder.

func (*LogForStorage) EncodeRLP

func (l *LogForStorage) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder.

type Message

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

Message is a fully derived transaction and implements core.Message

NOTE: In a future PR this will be removed.

func NewMessage

func NewMessage(from common.Address, to *common.Address, payment common.Address, nonce uint64, amount *big.Int, fee *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, checkNonce bool) Message

func (Message) CheckNonce

func (m Message) CheckNonce() bool

func (Message) Data

func (m Message) Data() []byte

func (Message) Fee

func (m Message) Fee() *big.Int

func (Message) From

func (m Message) From() common.Address

func (Message) Gas

func (m Message) Gas() uint64

func (Message) GasPrice

func (m Message) GasPrice() *big.Int

func (Message) Nonce

func (m Message) Nonce() uint64

func (Message) Payment

func (m Message) Payment() common.Address

func (Message) To

func (m Message) To() *common.Address

func (Message) Value

func (m Message) Value() *big.Int

type NewFastBlocksEvent

type NewFastBlocksEvent struct{ FastBlocks []*Block }

NewFastBlocksEvent is posted when a block has been imported.

type NewFruitsEvent

type NewFruitsEvent struct{ Fruits []*SnailBlock }

NewFruitsEvent is posted when a fruit has been imported.

type NewMinedBlockEvent

type NewMinedBlockEvent struct{ Block *SnailBlock }

NewMinedBlockEvent is posted when a block has been imported.

type NewMinedFruitEvent

type NewMinedFruitEvent struct{ Block *SnailBlock }

NewMinedFruitEvent is posted when a block has been Mined.

type NewTxsEvent

type NewTxsEvent struct{ Txs []*Transaction }

NewTxsEvent is posted when a batch of transactions enter the transaction pool.

type NodeInfoEvent

type NodeInfoEvent struct{ NodeInfo *EncryptNodeMessage }

NodeInfoEvent is posted when nodeInfo send

type PbftAgentProxy

type PbftAgentProxy interface {
	FetchFastBlock(committeeId *big.Int, infos []*CommitteeMember) (*Block, error)
	VerifyFastBlock(*Block, bool) (*PbftSign, error)
	BroadcastConsensus(block *Block) error
	GetCurrentHeight() *big.Int
	GetSeedMember() []*CommitteeMember
	GetFastLastProposer() common.Address
}

type PbftServerProxy

type PbftServerProxy interface {
	PutCommittee(committeeInfo *CommitteeInfo) error
	UpdateCommittee(info *CommitteeInfo) error
	PutNodes(id *big.Int, nodes []*CommitteeNode) error
	Notify(id *big.Int, action int) error
	SetCommitteeStop(committeeId *big.Int, stop uint64) error
	GetCommitteeStatus(committeeID *big.Int) map[string]interface{}
	IsLeader(committeeID *big.Int) bool
}

type PbftSign

type PbftSign struct {
	FastHeight *big.Int
	FastHash   common.Hash // fastblock hash
	Result     uint32      // 0--against,1--agree
	Sign       []byte      // sign for fastblock height + hash + result
	// contains filtered or unexported fields
}

func CopyPbftSign

func CopyPbftSign(s *PbftSign) *PbftSign

func (*PbftSign) DecodeRLP

func (c *PbftSign) DecodeRLP(s *rlp.Stream) error

DecodeRLP decodes the abeychain

func (*PbftSign) EncodeRLP

func (p *PbftSign) EncodeRLP(w io.Writer) error

EncodeRLP serializes b into the abeychain RLP block format.

func (*PbftSign) Equal

func (s *PbftSign) Equal(b *PbftSign) bool

func (*PbftSign) Hash

func (h *PbftSign) Hash() common.Hash

Hash returns the block hash of the PbftSign, which is simply the keccak256 hash of its RLP encoding.

func (*PbftSign) HashWithNoSign

func (h *PbftSign) HashWithNoSign() common.Hash

HashWithNoSign returns the hash which PbftSign without sign

func (PbftSign) MarshalJSON

func (p PbftSign) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*PbftSign) String

func (s *PbftSign) String() string

func (*PbftSign) UnmarshalJSON

func (p *PbftSign) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type PbftSignEvent

type PbftSignEvent struct {
	Block    *Block
	PbftSign *PbftSign
}

type PbftSigns

type PbftSigns []*PbftSign

func (PbftSigns) String

func (sinfos PbftSigns) String() string

type PendingLogsEvent

type PendingLogsEvent struct {
	Logs []*Log
}

PendingLogsEvent is posted pre mining and notifies of pending logs.

type PendingStateEvent

type PendingStateEvent struct{}

PendingStateEvent is posted pre mining and notifies of pending state changes.

type RawTransaction

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

func NewRawTransaction

func NewRawTransaction(nonce uint64, to common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *RawTransaction

func NewRawTransactionContract

func NewRawTransactionContract(nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *RawTransaction

func (*RawTransaction) ConvertTransaction

func (rawTransaction *RawTransaction) ConvertTransaction() *Transaction

func (*RawTransaction) DecodeRLP

func (tx *RawTransaction) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder

func (*RawTransaction) EncodeRLP

func (tx *RawTransaction) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder

func (*RawTransaction) Info

func (tx *RawTransaction) Info() string

type Receipt

type Receipt struct {
	// Consensus fields
	PostState         []byte `json:"root"`
	Status            uint64 `json:"status"`
	CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"`
	Bloom             Bloom  `json:"logsBloom"         gencodec:"required"`
	Logs              []*Log `json:"logs"              gencodec:"required"`

	// Implementation fields (don't reorder!)
	TxHash          common.Hash    `json:"transactionHash" gencodec:"required"`
	ContractAddress common.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        common.Hash `json:"blockHash,omitempty"`
	BlockNumber      *big.Int    `json:"blockNumber,omitempty"`
	TransactionIndex uint        `json:"transactionIndex"`
}

Receipt represents the results of a transaction.

func NewReceipt

func NewReceipt(root []byte, failed bool, cumulativeGasUsed uint64) *Receipt

NewReceipt creates a barebone transaction receipt, copying the init fields.

func (*Receipt) DecodeRLP

func (r *Receipt) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt from an RLP stream.

func (*Receipt) EncodeRLP

func (r *Receipt) EncodeRLP(w io.Writer) error

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) MarshalJSON

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

MarshalJSON marshals as JSON.

func (*Receipt) Size

func (r *Receipt) Size() common.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 (*Receipt) UnmarshalJSON

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

UnmarshalJSON unmarshals from JSON.

type ReceiptForStorage

type ReceiptForStorage Receipt

ReceiptForStorage is a wrapper around a Receipt that flattens and parses the entire content of a receipt, as opposed to only the consensus fields originally.

func (*ReceiptForStorage) DecodeRLP

func (r *ReceiptForStorage) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and loads both consensus and implementation fields of a receipt from an RLP stream.

func (*ReceiptForStorage) EncodeRLP

func (r *ReceiptForStorage) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder, and flattens all content fields of a receipt into an RLP stream.

type Receipts

type Receipts []*Receipt

Receipts is a wrapper around a Receipt array to implement DerivableList.

func (Receipts) GetRlp

func (r Receipts) GetRlp(i int) []byte

GetRlp returns the RLP encoding of one receipt from the list.

func (Receipts) Len

func (r Receipts) Len() int

Len returns the number of receipts in this list.

type RemovedLogsEvent

type RemovedLogsEvent struct{ Logs []*Log }

RemovedLogsEvent is posted when a reorg happens

type RewardInfo

type RewardInfo struct {
	Address common.Address `json:"Address"`
	Amount  *big.Int       `json:"Amount"`
	Staking *big.Int       `json:"Staking"`
}

func FetchOne

func FetchOne(sas []*SARewardInfos, addr common.Address) []*RewardInfo

func ToRewardInfos1

func ToRewardInfos1(items map[common.Address]*big.Int) []*RewardInfo

func (*RewardInfo) String

func (e *RewardInfo) String() string

func (*RewardInfo) ToJson

func (e *RewardInfo) ToJson() map[string]interface{}

type SARewardInfos

type SARewardInfos struct {
	Items []*RewardInfo `json:"Items"`
}

func ToRewardInfos2

func ToRewardInfos2(items map[common.Address]*big.Int) []*SARewardInfos

func (*SARewardInfos) String

func (s *SARewardInfos) String() string

func (*SARewardInfos) StringToAbey

func (s *SARewardInfos) StringToAbey() map[string]interface{}

type Sign

type Sign []byte

type Signer

type Signer interface {
	// Sender returns the sender address of the transaction.
	Sender(tx *Transaction) (common.Address, error)
	// PSender returns the paid address of the transaction.
	Payer(tx *Transaction) (common.Address, error)
	// SignatureValues returns the raw R, S, V values corresponding to the
	// given signature.
	SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error)
	// Hash returns the hash to be signed.
	Hash(tx *Transaction) common.Hash

	Hash_Payment(tx *Transaction) common.Hash
	// Equal returns true if the given signer is the same as the receiver.
	Equal(Signer) bool
}

Signer encapsulates transaction signature handling. Note that this interface is not a stable API and may change at any time to accommodate new protocol rules.

func MakeSigner

func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer

MakeSigner returns a Signer based on the given chain config and block number.

type SnailBlock

type SnailBlock struct {

	// These fields are used by package abey to track
	// inter-peer block relay.
	ReceivedAt   time.Time
	ReceivedFrom interface{}
	// contains filtered or unexported fields
}

SnailBlock represents an entire snail block in the AbeyChain snail chain.

func CopyFruit

func CopyFruit(f *SnailBlock) *SnailBlock

func NewSnailBlock

func NewSnailBlock(header *SnailHeader, fruits []*SnailBlock, signs []*PbftSign, uncles []*SnailHeader, config *params.ChainConfig) *SnailBlock

NewSnailBlock creates a new block. The input data is copied, changes to header and to the field values will not affect the block.

func NewSnailBlockWithHeader

func NewSnailBlockWithHeader(header *SnailHeader) *SnailBlock

NewSnailBlockWithHeader 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 (*SnailBlock) BlockDifficulty

func (b *SnailBlock) BlockDifficulty() *big.Int

func (*SnailBlock) Body

func (b *SnailBlock) Body() *SnailBody

Body returns the non-header content of the snailblock. func (b *SnailBlock) Body() *SnailBody { return b.body }

func (*SnailBlock) Coinbase

func (b *SnailBlock) Coinbase() common.Address

func (*SnailBlock) DecodeRLP

func (b *SnailBlock) DecodeRLP(s *rlp.Stream) error

DecodeRLP decodes the SnailBlock

func (*SnailBlock) DeprecatedTd

func (b *SnailBlock) DeprecatedTd() *big.Int

DeprecatedTd is an old relic for extracting the TD of a block. It is in the code solely to facilitate upgrading the database from the old format to the new, after which it should be deleted. Do not use!

func (*SnailBlock) Difficulty

func (b *SnailBlock) Difficulty() *big.Int

func (*SnailBlock) EncodeRLP

func (b *SnailBlock) EncodeRLP(w io.Writer) error

EncodeRLP serializes b into the AbeyChain RLP block format.

func (*SnailBlock) Extra

func (b *SnailBlock) Extra() []byte

func (*SnailBlock) FastHash

func (b *SnailBlock) FastHash() common.Hash

func (*SnailBlock) FastNumber

func (b *SnailBlock) FastNumber() *big.Int

func (*SnailBlock) FruitDifficulty

func (b *SnailBlock) FruitDifficulty() *big.Int

func (*SnailBlock) Fruits

func (b *SnailBlock) Fruits() []*SnailBlock

func (*SnailBlock) FruitsHash

func (b *SnailBlock) FruitsHash() common.Hash

func (*SnailBlock) GetPubKey

func (b *SnailBlock) GetPubKey() (*ecdsa.PublicKey, error)

func (*SnailBlock) Hash

func (b *SnailBlock) Hash() common.Hash

Hash returns the keccak256 hash of b's header. The hash is computed on the first call and cached thereafter.

func (*SnailBlock) HashNoNonce

func (b *SnailBlock) HashNoNonce() common.Hash

func (*SnailBlock) Header

func (b *SnailBlock) Header() *SnailHeader

func (*SnailBlock) IsFruit

func (b *SnailBlock) IsFruit() bool

func (*SnailBlock) MaxFruitNumber

func (b *SnailBlock) MaxFruitNumber() *big.Int

func (*SnailBlock) MinFruitNumber

func (b *SnailBlock) MinFruitNumber() *big.Int

func (*SnailBlock) MixDigest

func (b *SnailBlock) MixDigest() common.Hash

func (*SnailBlock) Nonce

func (b *SnailBlock) Nonce() uint64

func (*SnailBlock) Number

func (b *SnailBlock) Number() *big.Int

func (*SnailBlock) NumberU64

func (b *SnailBlock) NumberU64() uint64

func (*SnailBlock) ParentHash

func (b *SnailBlock) ParentHash() common.Hash

func (*SnailBlock) PointNumber

func (b *SnailBlock) PointNumber() *big.Int

func (*SnailBlock) PointerHash

func (b *SnailBlock) PointerHash() common.Hash

func (*SnailBlock) PublicKey

func (b *SnailBlock) PublicKey() []byte

func (*SnailBlock) SetSnailBlockFruits

func (b *SnailBlock) SetSnailBlockFruits(fruits Fruits)

func (*SnailBlock) SetSnailBlockSigns

func (b *SnailBlock) SetSnailBlockSigns(signs []*PbftSign)

func (*SnailBlock) Signs

func (b *SnailBlock) Signs() PbftSigns

func (*SnailBlock) Size

func (b *SnailBlock) Size() common.StorageSize

Size returns the true RLP encoded storage size of the block, either by encoding and returning it, or returning a previsouly cached value.

func (*SnailBlock) Time

func (b *SnailBlock) Time() *big.Int

func (*SnailBlock) ToElect

func (b *SnailBlock) ToElect() bool

func (*SnailBlock) WithBody

func (b *SnailBlock) WithBody(fruits []*SnailBlock, uncles []*SnailHeader) *SnailBlock

WithBody returns a new snailblock with the given transaction and uncle contents.

func (*SnailBlock) WithSeal

func (b *SnailBlock) WithSeal(header *SnailHeader) *SnailBlock

WithSeal returns a new snailblock with the data from b but the header replaced with the sealed one.

type SnailBlockBy

type SnailBlockBy func(b1, b2 *SnailBlock) bool

func (SnailBlockBy) Sort

func (self SnailBlockBy) Sort(snailBlocks SnailBlocks)

type SnailBlocks

type SnailBlocks []*SnailBlock

type SnailBody

type SnailBody struct {
	Fruits []*SnailBlock
	Signs  []*PbftSign
}

func (*SnailBody) FruitsHeaders

func (b *SnailBody) FruitsHeaders() []*SnailHeader

type SnailChainEvent

type SnailChainEvent struct {
	Block *SnailBlock
	Hash  common.Hash
}

type SnailChainHeadEvent

type SnailChainHeadEvent struct{ Block *SnailBlock }

type SnailChainSideEvent

type SnailChainSideEvent struct {
	Block *SnailBlock
}

SnailChainSideEvent is posted when a block in SideStatTy

type SnailHeader

type SnailHeader struct {
	ParentHash      common.Hash    `json:"parentHash"       gencodec:"required"`
	Coinbase        common.Address `json:"miner"            gencodec:"required"`
	PointerHash     common.Hash    `json:"pointerHash"      gencodec:"required"`
	PointerNumber   *big.Int       `json:"pointerNumber"    gencodec:"required"`
	FruitsHash      common.Hash    `json:"fruitsHash"       gencodec:"required"`
	FastHash        common.Hash    `json:"fastHash"         gencodec:"required"`
	FastNumber      *big.Int       `json:"fastNumber"       gencodec:"required"`
	SignHash        common.Hash    `json:"signHash"         gencodec:"required"`
	Difficulty      *big.Int       `json:"difficulty"       gencodec:"required"`
	FruitDifficulty *big.Int       `json:"fruitDifficulty"  gencodec:"required"`
	Number          *big.Int       `json:"number"           gencodec:"required"`
	Publickey       []byte         `json:"publicKey"        gencodec:"required"`
	Time            *big.Int       `json:"timestamp"        gencodec:"required"`
	Extra           []byte         `json:"extraData"        gencodec:"required"`
	MixDigest       common.Hash    `json:"mixHash"          gencodec:"required"`
	Nonce           BlockNonce     `json:"nonce"            gencodec:"required"`
}

SnailHeader represents a block header in the abeychain.

func CopySnailHeader

func CopySnailHeader(h *SnailHeader) *SnailHeader

CopySnailHeader creates a deep copy of a snail block header to prevent side effects from modifying a header variable.

func (*SnailHeader) GetDifficulty

func (h *SnailHeader) GetDifficulty(isFruit bool) (*big.Int, *big.Int)

GetDifficulty get difficulty by header

func (*SnailHeader) Hash

func (h *SnailHeader) Hash() common.Hash

Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding.

func (*SnailHeader) HashNoNonce

func (h *SnailHeader) HashNoNonce() common.Hash

HashNoNonce returns the hash which is used as input for the proof-of-work search.

func (*SnailHeader) Size

func (h *SnailHeader) Size() common.StorageSize

Size returns the approximate memory used by all internal contents. It is used to approximate and limit the memory consumption of various caches.

type SnailRewardContenet

type SnailRewardContenet struct {
	BlockMinerReward map[common.Address]*big.Int
	FruitMinerReward []map[common.Address]*big.Int
	CommitteeReward  map[common.Address]*big.Int
}

func (*SnailRewardContenet) RewardInfo

func (s *SnailRewardContenet) RewardInfo() map[string]interface{}

type StakingValue

type StakingValue struct {
	Value map[uint64]*big.Int
}

the key is epochid if StakingValue as a locked asset,otherwise key is block height if StakingValue as a staking asset

func (*StakingValue) ToLockedValue

func (s *StakingValue) ToLockedValue(height uint64) *LockedValue

type SummayEpochInfo

type SummayEpochInfo struct {
	EpochID     uint64
	SaCount     uint64
	DaCount     uint64
	BeginHeight uint64
	EndHeight   uint64
	AllAmount   *big.Int
}

type SwitchEnter

type SwitchEnter struct {
	CommitteeBase common.Address
	Flag          uint32
}

SwitchEnter is the enter inserted in block when committee member changed

func (*SwitchEnter) Equal

func (s *SwitchEnter) Equal(other *SwitchEnter) bool

func (*SwitchEnter) String

func (s *SwitchEnter) String() string

type SwitchEnters

type SwitchEnters []*SwitchEnter

func (SwitchEnters) Equal

func (s SwitchEnters) Equal(other SwitchEnters) bool

Equal will equal not require item index

type SwitchInfos

type SwitchInfos struct {
	CID         *big.Int
	Members     []*CommitteeMember
	BackMembers []*CommitteeMember
	Vals        []*SwitchEnter
}

SwitchInfos is the infos inserted in block when committee member changed

func (*SwitchInfos) Equal

func (s *SwitchInfos) Equal(other *SwitchInfos) bool

func (*SwitchInfos) Hash

func (s *SwitchInfos) Hash() common.Hash

Hash return SwitchInfos hash bytes

func (*SwitchInfos) String

func (s *SwitchInfos) String() string

func (*SwitchInfos) ToHash

func (s *SwitchInfos) ToHash() common.Hash

type TIP1Signer

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

func NewTIP1Signer

func NewTIP1Signer(chainId *big.Int) TIP1Signer

func (TIP1Signer) Equal

func (s TIP1Signer) Equal(s2 Signer) bool

func (TIP1Signer) Hash

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

Hash returns the hash to be signed by the sender. It does not uniquely identify the transaction.

func (TIP1Signer) Hash_Payment

func (s TIP1Signer) Hash_Payment(tx *Transaction) common.Hash

func (TIP1Signer) Payer

func (s TIP1Signer) Payer(tx *Transaction) (common.Address, error)

func (TIP1Signer) Sender

func (s TIP1Signer) Sender(tx *Transaction) (common.Address, error)

func (TIP1Signer) SignatureValues

func (s TIP1Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error)

WithSignature returns a new transaction with the given signature. This signature needs to be in the [R || S || V] format where V is 0 or 1.

type TimedChainReward

type TimedChainReward struct {
	St     uint64
	Number uint64
	Reward *ChainReward
}

type Transaction

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

func NewContractCreation

func NewContractCreation(nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *Transaction

func NewContractCreation_Payment

func NewContractCreation_Payment(nonce uint64, amount *big.Int, fee *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, payer common.Address) *Transaction

func NewTransaction

func NewTransaction(nonce uint64, to common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *Transaction

func NewTransaction_Payment

func NewTransaction_Payment(nonce uint64, to common.Address, amount *big.Int, fee *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, payer common.Address) *Transaction

func SignTx

func SignTx(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, error)

SignTx signs the transaction using the given signer and private key

func SignTx_Payment

func SignTx_Payment(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, error)

func (*Transaction) AmountCost

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

AmountCost returns amount+Fee.

func (*Transaction) AsMessage

func (tx *Transaction) AsMessage(s Signer) (Message, error)

AsMessage returns the transaction as a core.Message.

AsMessage requires a signer to derive the sender.

XXX Rename message to something less arbitrary?

func (*Transaction) ChainId

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

ChainId returns which chain id this transaction was signed for (if at all)

func (*Transaction) CheckNonce

func (tx *Transaction) CheckNonce() bool

func (*Transaction) ConvertRawTransaction

func (tx *Transaction) ConvertRawTransaction() *RawTransaction

func (*Transaction) Cost

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

Cost returns amount + gasprice * gaslimit.

func (*Transaction) Data

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

func (*Transaction) DecodeRLP

func (tx *Transaction) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder

func (*Transaction) EncodeRLP

func (tx *Transaction) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder

func (*Transaction) Fee

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

func (*Transaction) Gas

func (tx *Transaction) Gas() uint64

func (*Transaction) GasCost

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

GasCost returns gasprice * gaslimit.

func (*Transaction) GasPrice

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

func (*Transaction) Hash

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

Hash hashes the RLP encoding of tx. It uniquely identifies the transaction.

func (*Transaction) Info

func (tx *Transaction) Info() string

func (*Transaction) MarshalJSON

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

MarshalJSON encodes the web3 RPC transaction format.

func (*Transaction) Nonce

func (tx *Transaction) Nonce() uint64

func (*Transaction) Payer

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

func (*Transaction) Protected

func (tx *Transaction) Protected() bool

Protected returns whether the transaction is protected from replay protection.

func (*Transaction) Protected_Payment

func (tx *Transaction) Protected_Payment() bool

func (*Transaction) RawSignatureValues

func (tx *Transaction) RawSignatureValues() (*big.Int, *big.Int, *big.Int)

func (*Transaction) Size

func (tx *Transaction) Size() common.StorageSize

Size returns the true RLP encoded storage size of the transaction, either by encoding and returning it, or returning a previsouly cached value.

func (*Transaction) To

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

To returns the recipient address of the transaction. It returns nil if the transaction is a contract creation.

func (*Transaction) TrueRawSignatureValues

func (tx *Transaction) TrueRawSignatureValues() (*big.Int, *big.Int, *big.Int)

func (*Transaction) UnmarshalJSON

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

UnmarshalJSON decodes the web3 RPC transaction format.

func (*Transaction) Value

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

func (*Transaction) WithSignature

func (tx *Transaction) WithSignature(signer Signer, sig []byte) (*Transaction, error)

WithSignature returns a new transaction with the given signature. This signature needs to be formatted as described in the yellow paper (v+27).

func (*Transaction) WithSignature_Payment

func (tx *Transaction) WithSignature_Payment(signer Signer, sig []byte) (*Transaction, error)

type Transactions

type Transactions []*Transaction

Transactions is a Transaction slice type for basic sorting.

func TxDifference

func TxDifference(a, b Transactions) (keep Transactions)

TxDifference returns a new set t which is the difference between a to b.

func (Transactions) GetRlp

func (s Transactions) GetRlp(i int) []byte

GetRlp implements Rlpable and returns the i'th element of s in rlp.

func (Transactions) Len

func (s Transactions) Len() int

Len returns the length of s.

func (Transactions) Swap

func (s Transactions) Swap(i, j int)

Swap swaps the i'th and the j'th element in s.

type TransactionsByPriceAndNonce

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

TransactionsByPriceAndNonce represents a set of transactions that can return transactions in a profit-maximizing sorted order, while supporting removing entire batches of transactions for non-executable accounts.

func NewTransactionsByPriceAndNonce

func NewTransactionsByPriceAndNonce(signer Signer, txs map[common.Address]Transactions) *TransactionsByPriceAndNonce

NewTransactionsByPriceAndNonce creates a transaction set that can retrieve price sorted transactions in a nonce-honouring way.

Note, the input map is reowned so the caller should not interact any more with if after providing it to the constructor.

func (*TransactionsByPriceAndNonce) Peek

Peek returns the next transaction by price.

func (*TransactionsByPriceAndNonce) Pop

func (t *TransactionsByPriceAndNonce) Pop()

Pop removes the best transaction, *not* replacing it with the next one from the same account. This should be used when a transaction cannot be executed and hence all subsequent ones should be discarded from the same account.

func (*TransactionsByPriceAndNonce) Shift

func (t *TransactionsByPriceAndNonce) Shift()

Shift replaces the current best head with the next one from the same account.

type TransportCommitteeNode

type TransportCommitteeNode struct {
	IP    string
	Port  uint32
	Port2 uint32
	EXT   []byte
}

func (*TransportCommitteeNode) ConvertTransportToCommitteeNode

func (tcn *TransportCommitteeNode) ConvertTransportToCommitteeNode(pubKey *ecdsa.PublicKey) *CommitteeNode

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.

func (TxByNonce) Len

func (s TxByNonce) Len() int

func (TxByNonce) Less

func (s TxByNonce) Less(i, j int) bool

func (TxByNonce) Swap

func (s TxByNonce) Swap(i, j int)

type TxByPrice

type TxByPrice Transactions

TxByPrice implements both the sort and the heap interface, making it useful for all at once sorting as well as individually adding and removing elements.

func (TxByPrice) Len

func (s TxByPrice) Len() int

func (TxByPrice) Less

func (s TxByPrice) Less(i, j int) bool

func (*TxByPrice) Pop

func (s *TxByPrice) Pop() interface{}

func (*TxByPrice) Push

func (s *TxByPrice) Push(x interface{})

func (TxByPrice) Swap

func (s TxByPrice) Swap(i, j int)

Jump to

Keyboard shortcuts

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