Documentation ¶
Index ¶
- Constants
- Variables
- func BalHash(x interface{}) (h common.Hash)
- func CreateBloom(mreceipts Receipts) bloombits.Bloom
- func LogsBloom(logs []*Log) *big.Int
- func QueryForEvent(eventType string) tmpubsub.Query
- type EventBus
- func (b *EventBus) OnStart() error
- func (b *EventBus) OnStop()
- func (b *EventBus) Publish(eventType string, eventData THEventData) error
- func (b *EventBus) PublishEventLog(event EventDataLog) error
- func (b *EventBus) PublishEventNewBlock(event EventDataNewBlock) error
- func (b *EventBus) PublishEventNewBlockHeader(event EventDataNewBlockHeader) error
- func (b *EventBus) SetLogger(l log.Logger)
- func (b *EventBus) Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, ...) error
- func (b *EventBus) Unsubscribe(ctx context.Context, subscriber string, query tmpubsub.Query) error
- func (b *EventBus) UnsubscribeAll(ctx context.Context, subscriber string) error
- type EventDataLog
- type EventDataNewBlock
- type EventDataNewBlockHeader
- type GasPool
- type HashList
- type Log
- type Receipt
- type ReceiptList
- type Receipts
- type STDEIP155Signer
- func (s STDEIP155Signer) Equal(s2 STDSigner) bool
- func (s STDEIP155Signer) Hash(data SignerData) common.Hash
- func (s STDEIP155Signer) Sender(data SignerData) (common.Address, error)
- func (s STDEIP155Signer) SignParam() *big.Int
- func (s STDEIP155Signer) SignatureValues(sig []byte) (R, S, V *big.Int, err error)
- type STDFrontierSigner
- func (s STDFrontierSigner) Equal(s2 STDSigner) bool
- func (s STDFrontierSigner) Hash(data SignerData) common.Hash
- func (s STDFrontierSigner) Sender(data SignerData) (common.Address, error)
- func (s STDFrontierSigner) SignParam() *big.Int
- func (s STDFrontierSigner) SignatureValues(sig []byte) (R, S, V *big.Int, err error)
- type STDHomesteadSigner
- type STDSigner
- type SignerData
- type THEventData
Constants ¶
const ( EventNewBlock = "NewBlock" EventNewBlockHeader = "NewBlockHeader" EventLog = "Log" )
Reserved event types
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 (
// EventTypeKey is a reserved key, used to specify event type in tags.
EventTypeKey = "th.event"
)
Variables ¶
var ( EventQueryNewBlock = QueryForEvent(EventNewBlock) EventQueryNewBlockHeader = QueryForEvent(EventNewBlockHeader) EventQueryLog = QueryForEvent(EventLog) )
var ErrGasLimitReached = errors.New("gas limit reached")
var ( // ErrInvalidSignParam is returned if the transaction signed with error param. ErrInvalidSignParam = errors.New("invalid sign param for signer") )
Functions ¶
func CreateBloom ¶
func QueryForEvent ¶
Types ¶
type EventBus ¶
type EventBus struct { cmn.BaseService // contains filtered or unexported fields }
EventBus is a common bus for all events going through the system. All calls are proxied to underlying pubsub server. All events must be published using EventBus to ensure correct data types.
func NewEventBusWithBufferCapacity ¶
NewEventBusWithBufferCapacity returns a new event bus with the given buffer capacity.
func NewEventBusWithLogger ¶
func (*EventBus) Publish ¶
func (b *EventBus) Publish(eventType string, eventData THEventData) error
func (*EventBus) PublishEventLog ¶
func (b *EventBus) PublishEventLog(event EventDataLog) error
func (*EventBus) PublishEventNewBlock ¶
func (b *EventBus) PublishEventNewBlock(event EventDataNewBlock) error
func (*EventBus) PublishEventNewBlockHeader ¶
func (b *EventBus) PublishEventNewBlockHeader(event EventDataNewBlockHeader) error
func (*EventBus) Unsubscribe ¶
type EventDataLog ¶
type EventDataLog struct {
Logs []*Log `json:"logs"`
}
type EventDataNewBlock ¶
type EventDataNewBlock struct {
Block interface{} `json:"block"`
}
type EventDataNewBlockHeader ¶
type EventDataNewBlockHeader struct {
Header interface{} `json:"header"`
}
type GasPool ¶
type GasPool uint64
GasPool tracks the amount of gas available during execution of the transactions in a block. The zero value is a pool with zero gas available.
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" bal:"-"` BlockTime uint64 `json:"blockTime" gencodec:"required"` }
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 Receipt ¶
type Receipt struct { // Consensus fields PostState []byte `json:"root"` Status uint64 `json:"status"` VMErr string `json:"vmErr"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"` Bloom bloombits.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"` ZoneID int `json:"zoneid"` }
Receipt represents the results of a transaction.
func NewReceipt ¶
NewReceipt creates a barebone transaction receipt, copying the init fields.
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.
type ReceiptList ¶
type ReceiptList []*Receipt
Receipts is a wrapper around a Receipt array to implement DerivableList.
func (ReceiptList) Hash ¶
func (r ReceiptList) Hash() common.Hash
type Receipts ¶
type Receipts map[int]ReceiptList
type STDEIP155Signer ¶
type STDEIP155Signer struct {
// contains filtered or unexported fields
}
STDEIP155Signer implements STDSigner using the EIP155 rules.
func NewSTDEIP155Signer ¶
func NewSTDEIP155Signer(signParam *big.Int) STDEIP155Signer
NewSTDEIP155Signer return a STDEIP155Signer
func (STDEIP155Signer) Equal ¶
func (s STDEIP155Signer) Equal(s2 STDSigner) bool
Equal returns true if the given signer is the same as the receiver.
func (STDEIP155Signer) Hash ¶
func (s STDEIP155Signer) Hash(data SignerData) common.Hash
Hash returns the hash to be signed by the sender. It does not uniquely identify the signdata.
func (STDEIP155Signer) Sender ¶
func (s STDEIP155Signer) Sender(data SignerData) (common.Address, error)
Sender returns the sender address of the signdata.
func (STDEIP155Signer) SignParam ¶
func (s STDEIP155Signer) SignParam() *big.Int
SignParam return the field signParam
func (STDEIP155Signer) SignatureValues ¶
func (s STDEIP155Signer) SignatureValues(sig []byte) (R, S, V *big.Int, err error)
SignatureValues returns signature values. This signature needs to be in the [R || S || V] format where V is 0 or 1.
type STDFrontierSigner ¶
type STDFrontierSigner struct{}
STDFrontierSigner implements TransactionInterface using the homestead rules.
func (STDFrontierSigner) Equal ¶
func (s STDFrontierSigner) Equal(s2 STDSigner) bool
Equal returns true if the given signer is the same as the receiver.
func (STDFrontierSigner) Hash ¶
func (s STDFrontierSigner) Hash(data SignerData) common.Hash
Hash returns the hash to be signed by the sender. It does not uniquely identify the transaction.
func (STDFrontierSigner) Sender ¶
func (s STDFrontierSigner) Sender(data SignerData) (common.Address, error)
Sender returns the sender address of the signdata.
func (STDFrontierSigner) SignParam ¶
func (s STDFrontierSigner) SignParam() *big.Int
SignParam return the field signParam
func (STDFrontierSigner) SignatureValues ¶
func (s STDFrontierSigner) SignatureValues(sig []byte) (R, S, V *big.Int, err error)
SignatureValues returns signature values. This signature needs to be in the [R || S || V] format where V is 0 or 1.
type STDHomesteadSigner ¶
type STDHomesteadSigner struct{ STDFrontierSigner }
STDHomesteadSigner implements TransactionInterface using the homestead rules.
func (STDHomesteadSigner) Equal ¶
func (s STDHomesteadSigner) Equal(s2 STDSigner) bool
Equal returns true if the given signer is the same as the receiver.
func (STDHomesteadSigner) Sender ¶
func (s STDHomesteadSigner) Sender(data SignerData) (common.Address, error)
Sender returns the sender address of the signdata.
func (STDHomesteadSigner) SignParam ¶
func (s STDHomesteadSigner) SignParam() *big.Int
SignParam return the field signParam
type STDSigner ¶
type STDSigner interface { // Sender returns the sender address of the signdata. Sender(data SignerData) (common.Address, error) // SignatureValues returns the raw R, S, V values corresponding to the // given signature. SignatureValues(sig []byte) (r, s, v *big.Int, err error) // Hash returns the hash to be signed. Hash(data SignerData) common.Hash // Equal returns true if the given signer is the same as the receiver. Equal(STDSigner) bool // SignParam return the field signParam SignParam() *big.Int }
STDSigner encapsulates signdata signature handling. Note that this interface is not a stable API and may change at any time to accommodate new protocol rules.
type SignerData ¶
type THEventData ¶
type THEventData interface { }