Documentation ¶
Overview ¶
Package ethereum defines interfaces for interacting with Ethereum.
Index ¶
- Constants
- Variables
- func AmountCommit(amount *big.Int, cf types.Key) types.Key
- func BigInt2Hash(amount *big.Int) (types.Key, error)
- func BloomLookup(bin Bloom, topic bytesBacked) bool
- func CalNewAmountGas(value *big.Int, feeRule int64) uint64
- func CalSweepBalanceFee(balance *big.Int) (amount *big.Int, changeAmount *big.Int, fee uint64, err error)
- func CanonicalTime(t time.Time) string
- func D2h(amount *big.Int) types.Key
- func DeriveSignParam(v *big.Int) *big.Int
- func EventQueryTxFor(tx Tx) tmpubsub.Query
- func GenMultiSignBytes(signInfo MultiSignMainInfo) ([]byte, error)
- func GenerateAdditionalKeys(seckey types.Key, dests []*UTXODestEntry) ([]types.PublicKey, error)
- func GenerateAllAdditionalKeys(seckey types.Key, dests []DestEntry) ([]types.PublicKey, error)
- func GetAllocAccounts() map[string]GenesisAccount
- func GetLogger() log.Logger
- func GetTestAllocAccounts() map[string]GenesisAccount
- func GetUtxoCommitmentChangeRate(addr common.Address) (int64, error)
- func Hash2BigInt(key types.Key) *big.Int
- func InitSignParam(TestNet bool)
- func IntrinsicGas(data []byte, contractCreation bool, gasRate uint64) (uint64, error)
- func IsContract(data []byte) bool
- func IsNormalTx(tx Tx) bool
- func IsOutputBelongToAccount(acc *types.AccountKey, keyIndex map[types.PublicKey]uint64, otaddr types.Key, ...) (types.KeyDerivation, uint64, error)
- func IsVoteTypeValid(type_ byte) bool
- func IsWasmContract(code []byte) bool
- func LogsBloom(logs []*Log) *big.Int
- func NewMockError(errCode int, msg string) *mockError
- func NewUinTokenTransaction(acc *types.AccountKey, keyIndex map[types.PublicKey]uint64, ...) (*UTXOTransaction, []*UTXOInputEphemeral, types.KeyV, *types.Key, error)
- func NewUinTransaction(acc *types.AccountKey, keyIndex map[types.PublicKey]uint64, ...) (*UTXOTransaction, []*UTXOInputEphemeral, types.KeyV, *types.Key, error)
- func QueryForEvent(eventType string) tmpubsub.Query
- func RandValidator(randPower bool, minPower int64) (*Validator, PrivValidator)
- func RandValidatorSet(numValidators int, votingPower int64) (*ValidatorSet, []PrivValidator)
- func RegisterBlockAmino()
- func RegisterEventDatas()
- func RegisterEvidences()
- func RegisterTxData()
- func RegisterUTXORateGetter(getter *UTXOChangeRateGetter)
- func RegisterUTXOTxData()
- func RlpHash(x interface{}) (h common.Hash)
- func SetLogger(l log.Logger)
- func SignContractUpgradeTx(prv *ecdsa.PrivateKey, mainInfo *ContractUpgradeMainInfo) ([]byte, error)
- func UInTransWithRctSig(utxoTrans *UTXOTransaction, sources []*UTXOSourceEntry, ...) error
- func UTXOChangeRateDataEVM() []byte
- func UTXOChangeRateDataWASM() []byte
- func UTXOChangeRateFromUint8(raw uint8) (int64, error)
- func UTXOChangeRateResultDecodeEVM(data []byte) (uint8, error)
- func UTXOChangeRateResultDecodeWASM(data []byte) (uint8, error)
- func UpdateBlockHeightZero(height uint64)
- type AccountDestEntry
- type AccountInput
- type AccountOutput
- type AccountSourceEntry
- type BalanceRecord
- type Block
- func (b *Block) AddEvidence(evidence []Evidence)
- func (b *Block) Bloom() Bloom
- func (b *Block) Coinbase() common.Address
- func (b *Block) GasLimit() uint64
- func (b *Block) GasUsed() uint64
- func (b *Block) Hash() common.Hash
- func (b *Block) HashesTo(hash []byte) bool
- func (b *Block) Head() *Header
- func (b *Block) HeightBigInt() *big.Int
- func (b *Block) HeightU64() uint64
- func (b *Block) MakePartSet(partSize int) *PartSet
- func (b *Block) Parenthash() common.Hash
- func (b *Block) Receipthash() common.Hash
- func (b *Block) Size() int
- func (b *Block) Statehash() common.Hash
- func (b *Block) String() string
- func (b *Block) StringIndented(indent string) string
- func (b *Block) StringShort() string
- func (b *Block) Time() uint64
- func (b *Block) TxHash() common.Hash
- func (b *Block) ValidateBasic() error
- type BlockBalanceRecords
- type BlockChain
- type BlockEventPublisher
- type BlockGossip
- type BlockID
- type BlockMeta
- type BlockSize
- type Bloom
- func (b *Bloom) Add(d *big.Int)
- func (b Bloom) Big() *big.Int
- func (b Bloom) Bytes() []byte
- func (b Bloom) MarshalText() ([]byte, error)
- func (b *Bloom) SetBytes(d []byte)
- func (b Bloom) Test(test *big.Int) bool
- func (b Bloom) TestBytes(test []byte) bool
- func (b *Bloom) UnmarshalText(input []byte) error
- type CalRate
- type CallMsg
- type Candidate
- type CandidateInOrder
- type CandidateInOrderList
- type CandidateState
- type CandidatesByAddress
- type CandidatesList
- type CanonicalJSONBlockID
- type CanonicalJSONHeartbeat
- type CanonicalJSONPartSetHeader
- type CanonicalJSONProposal
- type CanonicalJSONVote
- type ChainContext
- type ChainReader
- type ChainStateReader
- type ChainSyncReader
- type Coefficient
- type Commit
- func (commit *Commit) BitArray() *cmn.BitArray
- func (commit *Commit) FirstPrecommit() *Vote
- func (commit *Commit) GetByIndex(index int) *Vote
- func (commit *Commit) Hash() common.Hash
- func (commit *Commit) Height() uint64
- func (commit *Commit) IsCommit() bool
- func (commit *Commit) Round() int
- func (commit *Commit) Size() int
- func (commit *Commit) StringIndented(indent string) string
- func (commit *Commit) Type() byte
- func (commit *Commit) ValidateBasic() error
- type ConsensusParams
- type Context
- type Contract
- type ContractCaller
- type ContractRef
- type ContractUpgradeMainInfo
- type ContractUpgradeTx
- func (tx *ContractUpgradeTx) AsMessage() (Message, error)
- func (tx *ContractUpgradeTx) CheckBasic(censor TxCensor) error
- func (tx *ContractUpgradeTx) CheckState(censor TxCensor) error
- func (tx *ContractUpgradeTx) Cost() *big.Int
- func (tx *ContractUpgradeTx) Data() []byte
- func (tx *ContractUpgradeTx) From() (common.Address, error)
- func (tx *ContractUpgradeTx) Gas() uint64
- func (tx *ContractUpgradeTx) GasPrice() *big.Int
- func (tx *ContractUpgradeTx) Hash() common.Hash
- func (tx *ContractUpgradeTx) Nonce() uint64
- func (tx *ContractUpgradeTx) Senders() ([]common.Address, error)
- func (tx *ContractUpgradeTx) Sign(signer STDSigner, prv *ecdsa.PrivateKey) error
- func (tx *ContractUpgradeTx) String() string
- func (tx *ContractUpgradeTx) To() *common.Address
- func (tx *ContractUpgradeTx) TokenAddress() common.Address
- func (tx *ContractUpgradeTx) TypeName() string
- func (tx *ContractUpgradeTx) Value() *big.Int
- func (tx *ContractUpgradeTx) VerifySign(signersInfo *SignersInfo) (err error)
- type Data
- type DestEntry
- type DuplicateVoteEvidence
- func (dve *DuplicateVoteEvidence) Address() []byte
- func (dve *DuplicateVoteEvidence) Equal(ev Evidence) bool
- func (dve *DuplicateVoteEvidence) Hash() []byte
- func (dve *DuplicateVoteEvidence) Height() uint64
- func (dve *DuplicateVoteEvidence) String() string
- func (dve *DuplicateVoteEvidence) Verify(chainID string, pubKey crypto.PubKey) error
- type ErrEvidenceInvalid
- type ErrVoteConflictingVotes
- type EventBus
- func (b *EventBus) OnStart() error
- func (b *EventBus) OnStop()
- func (b *EventBus) Publish(eventType string, eventData TMEventData) error
- func (b *EventBus) PublishEventCompleteProposal(event EventDataRoundState) error
- func (b *EventBus) PublishEventLock(event EventDataRoundState) 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) PublishEventNewRound(event EventDataRoundState) error
- func (b *EventBus) PublishEventNewRoundStep(event EventDataRoundState) error
- func (b *EventBus) PublishEventPolka(event EventDataRoundState) error
- func (b *EventBus) PublishEventProposalHeartbeat(event EventDataProposalHeartbeat) error
- func (b *EventBus) PublishEventRelock(event EventDataRoundState) error
- func (b *EventBus) PublishEventTimeoutPropose(event EventDataRoundState) error
- func (b *EventBus) PublishEventTimeoutWait(event EventDataRoundState) error
- func (b *EventBus) PublishEventUnlock(event EventDataRoundState) error
- func (b *EventBus) PublishEventVote(event EventDataVote) 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 EventBusSubscriber
- type EventDataLog
- type EventDataNewBlock
- type EventDataNewBlockHeader
- type EventDataProposalHeartbeat
- type EventDataRoundState
- type EventDataString
- type EventDataVote
- type Evidence
- type EvidenceData
- type EvidenceList
- type EvidenceParams
- type FaultValidatorsEvidence
- func (fve *FaultValidatorsEvidence) Address() []byte
- func (fve *FaultValidatorsEvidence) Equal(ev Evidence) bool
- func (fve *FaultValidatorsEvidence) Hash() []byte
- func (fve *FaultValidatorsEvidence) Height() uint64
- func (fve *FaultValidatorsEvidence) String() string
- func (fve *FaultValidatorsEvidence) Verify(chainID string, pubKey crypto.PubKey) error
- type FilePV
- func (pv *FilePV) Copy() *FilePV
- func (pv *FilePV) GetAddress() crypto.Address
- func (pv *FilePV) GetPrikey() crypto.PrivKey
- func (pv *FilePV) GetPubKey() crypto.PubKey
- func (pv *FilePV) Reset()
- func (pv *FilePV) Save()
- func (pv *FilePV) SignData(data []byte) ([]byte, error)
- func (pv *FilePV) SignHeartbeat(chainID string, heartbeat *Heartbeat) error
- func (pv *FilePV) SignProposal(chainID string, proposal *Proposal) error
- func (pv *FilePV) SignVote(chainID string, vote *Vote) error
- func (pv *FilePV) SignVoteWithoutSave(chainID string, vote *Vote) error
- func (pv *FilePV) String() string
- func (pv *FilePV) UpdatePrikey(priv crypto.PrivKey)
- type FilterQuery
- type GasEstimator
- type GasPricer
- type GenesisAccount
- type GenesisDoc
- type GenesisValidator
- type Header
- type Heartbeat
- type IMessage
- type Input
- type Interpreter
- type Log
- type LogFilterer
- type LogForStorage
- type LogId
- type Mempool
- type Message
- func (m Message) AsMessage() (Message, error)
- func (m Message) Data() []byte
- func (m *Message) From(tx Tx, state State) (common.Address, error)
- func (m Message) Gas() uint64
- func (m Message) GasCost() *big.Int
- func (m Message) GasPrice() *big.Int
- func (m Message) MsgFrom() common.Address
- func (m Message) Nonce() uint64
- func (m *Message) OutputData() []OutputData
- func (m *Message) SetOutputData(outputs []OutputData)
- func (m *Message) SetTxType(txType string)
- func (m *Message) SetUTXOKind(kind UTXOKind)
- func (m Message) String() string
- func (m Message) To() *common.Address
- func (m Message) TokenAddress() common.Address
- func (m Message) TxType() string
- func (m *Message) UTXOKind() UTXOKind
- func (m Message) Value() *big.Int
- type MineInput
- type MockBadEvidence
- type MockGoodEvidence
- type MockPV
- func (pv *MockPV) DisableChecks()
- func (pv *MockPV) GetAddress() crypto.Address
- func (pv *MockPV) GetPrikey() crypto.PrivKey
- func (pv *MockPV) GetPubKey() crypto.PubKey
- func (pv *MockPV) SignData(data []byte) ([]byte, error)
- func (pv *MockPV) SignHeartbeat(chainID string, heartbeat *Heartbeat) error
- func (pv *MockPV) SignProposal(chainID string, proposal *Proposal) error
- func (pv *MockPV) SignVote(chainID string, vote *Vote) error
- func (pv *MockPV) SignVoteWithoutSave(chainID string, vote *Vote) error
- func (pv *MockPV) String() string
- func (pv *MockPV) UpdatePrikey(priv crypto.PrivKey)
- type MockState
- func (_m *MockState) Exist(addr common.Address) bool
- func (_m *MockState) GetBalance(addr common.Address) *big.Int
- func (_m *MockState) GetNonce(addr common.Address) uint64
- func (_m *MockState) GetTokenBalance(addr common.Address, token common.Address) *big.Int
- func (_m *MockState) IsContract(addr common.Address) bool
- func (_m *MockState) SetNonce(addr common.Address, nonce uint64)
- func (_m *MockState) SubBalance(addr common.Address, amount *big.Int)
- func (_m *MockState) SubTokenBalance(addr common.Address, token common.Address, amount *big.Int)
- type MockTxCensor
- func (_m *MockTxCensor) Block() *Block
- func (_m *MockTxCensor) BlockChain() BlockChain
- func (_m *MockTxCensor) GetLastChangedVals() (uint64, []*Validator)
- func (_m *MockTxCensor) GetUTXOGas() uint64
- func (_m *MockTxCensor) IsWasmContract(data []byte) bool
- func (_m *MockTxCensor) LockState()
- func (_m *MockTxCensor) Mempool() Mempool
- func (_m *MockTxCensor) State() State
- func (_m *MockTxCensor) TxMgr() TxMgr
- func (_m *MockTxCensor) UTXOStore() UTXOStore
- func (_m *MockTxCensor) UnlockState()
- type MockTxMgr
- type MultiSignAccountTx
- func (tx *MultiSignAccountTx) CheckBasic(censor TxCensor) error
- func (tx *MultiSignAccountTx) CheckState(censor TxCensor) error
- func (tx *MultiSignAccountTx) From() (common.Address, error)
- func (tx *MultiSignAccountTx) Hash() common.Hash
- func (tx *MultiSignAccountTx) Nonce() uint64
- func (tx *MultiSignAccountTx) Sign(prv PrivValidator) error
- func (tx *MultiSignAccountTx) String() string
- func (tx *MultiSignAccountTx) To() *common.Address
- func (tx *MultiSignAccountTx) TokenAddress() common.Address
- func (tx *MultiSignAccountTx) TypeName() string
- func (tx *MultiSignAccountTx) VerifySign(validators *ValidatorSet) (err error)
- type MultiSignMainInfo
- type NodeType
- type NopEventBus
- func (NopEventBus) PublishEventCompleteProposal(rs EventDataRoundState) error
- func (NopEventBus) PublishEventLock(rs EventDataRoundState) error
- func (NopEventBus) PublishEventLog(log EventDataLog) error
- func (NopEventBus) PublishEventNewBlock(block EventDataNewBlock) error
- func (NopEventBus) PublishEventNewBlockHeader(header EventDataNewBlockHeader) error
- func (NopEventBus) PublishEventNewRound(rs EventDataRoundState) error
- func (NopEventBus) PublishEventNewRoundStep(rs EventDataRoundState) error
- func (NopEventBus) PublishEventPolka(rs EventDataRoundState) error
- func (NopEventBus) PublishEventRelock(rs EventDataRoundState) error
- func (NopEventBus) PublishEventTimeoutPropose(rs EventDataRoundState) error
- func (NopEventBus) PublishEventTimeoutWait(rs EventDataRoundState) error
- func (NopEventBus) PublishEventUnlock(rs EventDataRoundState) error
- func (NopEventBus) PublishEventVote(vote EventDataVote) error
- func (NopEventBus) Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, ...) error
- func (NopEventBus) Unsubscribe(ctx context.Context, subscriber string, query tmpubsub.Query) error
- func (NopEventBus) UnsubscribeAll(ctx context.Context, subscriber string) error
- type Output
- type OutputData
- type Part
- type PartSet
- func (ps *PartSet) AddPart(part *Part) (bool, error)
- func (ps *PartSet) BitArray() *cmn.BitArray
- func (ps *PartSet) Count() int
- func (ps *PartSet) GetPart(index int) *Part
- func (ps *PartSet) GetReader() io.Reader
- func (ps *PartSet) HasHeader(header PartSetHeader) bool
- func (ps *PartSet) Hash() []byte
- func (ps *PartSet) HashesTo(hash []byte) bool
- func (ps *PartSet) Header() PartSetHeader
- func (ps *PartSet) IsComplete() bool
- func (ps *PartSet) MarshalJSON() ([]byte, error)
- func (ps *PartSet) StringShort() string
- func (ps *PartSet) Total() int
- type PartSetHeader
- type PartSetReader
- type Payload
- type PendingContractCaller
- type PendingStateEventer
- type PendingStateReader
- type PrivValidator
- type PrivValidatorsByAddress
- type Proposal
- type Receipt
- type ReceiptForStorage
- type Receipts
- type RegularTx
- 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 Signable
- type SignedHeader
- type SignerEntry
- type SignersInfo
- type State
- type StateDB
- type Subscription
- type SupportType
- type SweepGas
- type SyncProgress
- type TMEventData
- type TestAccount
- type TokenTransaction
- func (tx *TokenTransaction) AsMessage() (Message, error)
- func (tx *TokenTransaction) CheckBasic(censor TxCensor) error
- func (tx *TokenTransaction) CheckBasicWithState(censor TxCensor, state State) error
- func (tx *TokenTransaction) CheckState(censor TxCensor) error
- func (tx *TokenTransaction) Cost() *big.Int
- func (tx *TokenTransaction) Data() []byte
- func (tx *TokenTransaction) DecodeSER(s *ser.Stream) error
- func (tx *TokenTransaction) EncodeSER(w io.Writer) error
- func (tx *TokenTransaction) From() (common.Address, error)
- func (tx *TokenTransaction) Gas() uint64
- func (tx *TokenTransaction) GasCost() *big.Int
- func (tx *TokenTransaction) GasPrice() *big.Int
- func (tx *TokenTransaction) Hash() (h common.Hash)
- func (tx *TokenTransaction) IllegalGasLimitOrGasPrice(hascode bool) bool
- func (tx TokenTransaction) MarshalJSON() ([]byte, error)
- func (tx *TokenTransaction) Nonce() uint64
- func (tx *TokenTransaction) Protected() bool
- func (tx *TokenTransaction) RawSignatureValues() (*big.Int, *big.Int, *big.Int)
- func (tx *TokenTransaction) RawString() string
- func (tx *TokenTransaction) Sender(signer STDSigner) (common.Address, error)
- func (tx *TokenTransaction) Sign(signer STDSigner, prv *ecdsa.PrivateKey) error
- func (tx *TokenTransaction) SignHash() common.Hash
- func (tx *TokenTransaction) SignParam() *big.Int
- func (tx *TokenTransaction) Size() common.StorageSize
- func (tx *TokenTransaction) StoreFrom(addr common.Address)
- func (tx *TokenTransaction) String() string
- func (tx *TokenTransaction) To() *common.Address
- func (tx *TokenTransaction) TokenAddress() common.Address
- func (tx *TokenTransaction) TypeName() string
- func (tx *TokenTransaction) UnmarshalJSON(input []byte) error
- func (tx *TokenTransaction) Value() *big.Int
- type TokenValue
- type TokenValues
- type Transaction
- func (tx *Transaction) AsMessage() (Message, error)
- func (tx *Transaction) CheckBasic(censor TxCensor) error
- func (tx *Transaction) CheckBasicWithState(censor TxCensor, state State) error
- func (tx *Transaction) CheckState(censor TxCensor) error
- func (tx *Transaction) Cost() *big.Int
- func (tx *Transaction) Data() []byte
- func (tx *Transaction) DecodeSER(s *ser.Stream) error
- func (tx *Transaction) EncodeSER(w io.Writer) error
- func (tx *Transaction) From() (common.Address, error)
- func (tx *Transaction) Gas() uint64
- func (tx *Transaction) GasPrice() *big.Int
- func (tx Transaction) GetTxData() txdata
- func (tx *Transaction) Hash() common.Hash
- func (tx *Transaction) IllegalGasLimitOrGasPrice(hascode bool) bool
- func (tx Transaction) MarshalJSON() ([]byte, error)
- func (tx *Transaction) Nonce() uint64
- func (tx *Transaction) Protected() bool
- func (tx *Transaction) RawSignatureValues() (*big.Int, *big.Int, *big.Int)
- func (tx *Transaction) RawString() string
- func (tx *Transaction) Sender(signer STDSigner) (common.Address, error)
- func (tx *Transaction) Sign(signer STDSigner, prv *ecdsa.PrivateKey) error
- func (tx *Transaction) SignHash() common.Hash
- func (tx *Transaction) SignParam() *big.Int
- func (tx *Transaction) Size() common.StorageSize
- func (tx *Transaction) StoreFrom(addr common.Address)
- func (tx *Transaction) String() string
- func (tx *Transaction) To() *common.Address
- func (tx *Transaction) TokenAddress() common.Address
- func (tx *Transaction) TypeName() string
- func (tx *Transaction) UnmarshalJSON(input []byte) error
- func (tx *Transaction) Value() *big.Int
- func (tx *Transaction) WithSignature(signer STDSigner, sig []byte) (*Transaction, error)
- type TransactionReader
- type TransactionSender
- type Transactions
- type Tx
- type TxBalanceRecords
- type TxByNonce
- type TxCensor
- type TxEntry
- type TxMgr
- type TxProof
- type TxSize
- type Txs
- type TxsResult
- func (txresult *TxsResult) KeyImages() []*types.Key
- func (txResult *TxsResult) SetCandidates(candidates []*CandidateInOrder)
- func (txresult *TxsResult) SetKeyImages(keyImages []*types.Key)
- func (txResult *TxsResult) SetSpecialTxs(txs []Tx)
- func (txresult *TxsResult) SetUTXOOutputs(utxoOutputData []*UTXOOutputData)
- func (txResult *TxsResult) SpecialTxs() []Tx
- func (txresult *TxsResult) UTXOOutputs() []*UTXOOutputData
- func (txResult *TxsResult) UpdateCandidates(candidates []*CandidateInOrder)
- type UTXOChangeRateGetter
- type UTXODest
- type UTXODestEntry
- type UTXOInput
- type UTXOInputEphemeral
- type UTXOKind
- type UTXOOutput
- type UTXOOutputData
- type UTXOOutputDetail
- type UTXORingEntry
- type UTXOSourceEntry
- type UTXOStore
- type UTXOTransaction
- func (tx *UTXOTransaction) AsMessage() (Message, error)
- func (tx *UTXOTransaction) CheckBasic(censor TxCensor) error
- func (tx UTXOTransaction) CheckState(censor TxCensor) error
- func (tx *UTXOTransaction) CheckStoreState(censor TxCensor, state State) error
- func (tx *UTXOTransaction) Data() []byte
- func (tx *UTXOTransaction) From() (common.Address, error)
- func (tx *UTXOTransaction) Gas() uint64
- func (tx *UTXOTransaction) GasPrice() *big.Int
- func (tx *UTXOTransaction) GetInputKeyImages() []*types.Key
- func (tx UTXOTransaction) GetOutputData(blockHeight uint64) []*UTXOOutputData
- func (tx *UTXOTransaction) Hash() common.Hash
- func (tx *UTXOTransaction) Nonce() uint64
- func (tx UTXOTransaction) PrefixHash() types.Key
- func (tx *UTXOTransaction) Sender(signer STDSigner) (common.Address, error)
- func (tx *UTXOTransaction) SetSize(size uint64)
- func (tx *UTXOTransaction) Sign(signer STDSigner, prv *ecdsa.PrivateKey) error
- func (tx *UTXOTransaction) Size() common.StorageSize
- func (tx *UTXOTransaction) StoreFrom(addr common.Address)
- func (tx UTXOTransaction) String() string
- func (tx UTXOTransaction) To() *common.Address
- func (tx UTXOTransaction) ToAddrs() []common.Address
- func (tx UTXOTransaction) TokenAddress() common.Address
- func (tx *UTXOTransaction) TxType() string
- func (tx UTXOTransaction) TypeName() string
- func (tx *UTXOTransaction) UTXOKind() UTXOKind
- func (tx *UTXOTransaction) Value() *big.Int
- func (tx *UTXOTransaction) VerifyProofSemantic() error
- type Validator
- type ValidatorSet
- func (valSet *ValidatorSet) Add(val *Validator) (added bool)
- func (valSet *ValidatorSet) Copy() *ValidatorSet
- func (valSet *ValidatorSet) FindAddress(address []byte) *Validator
- func (valSet *ValidatorSet) GetByAddress(address []byte) (index int, val *Validator)
- func (valSet *ValidatorSet) GetByIndex(index int) (address []byte, val *Validator)
- func (valSet *ValidatorSet) GetProposer() (proposer *Validator)
- func (valSet *ValidatorSet) HasAddress(address []byte) bool
- func (valSet *ValidatorSet) Hash() []byte
- func (valSet *ValidatorSet) IncrementAccum(times int)
- func (valSet *ValidatorSet) Iterate(fn func(index int, val *Validator) bool)
- func (valSet *ValidatorSet) Remove(address []byte) (val *Validator, removed bool)
- func (valSet *ValidatorSet) Size() int
- func (valSet *ValidatorSet) String() string
- func (valSet *ValidatorSet) StringIndented(indent string) string
- func (valSet *ValidatorSet) TotalVotingPower() int64
- func (valSet *ValidatorSet) Update(val *Validator) (updated bool)
- func (valSet *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height uint64, commit *Commit) error
- func (valSet *ValidatorSet) VerifyCommitAny(chainID string, blockID BlockID, height uint64, commit *Commit) error
- type ValidatorSign
- type ValidatorsByAddress
- type VmConfig
- type Vote
- type VoteRate
- type VoteSet
- func (voteSet *VoteSet) AddVote(vote *Vote) (added bool, err error)
- func (voteSet *VoteSet) BitArray() *cmn.BitArray
- func (voteSet *VoteSet) BitArrayByBlockID(blockID BlockID) *cmn.BitArray
- func (voteSet *VoteSet) BitArrayString() string
- func (voteSet *VoteSet) ChainID() string
- func (voteSet *VoteSet) GetByAddress(address []byte) *Vote
- func (voteSet *VoteSet) GetByIndex(valIndex int) *Vote
- func (voteSet *VoteSet) HasAll() bool
- func (voteSet *VoteSet) HasTwoThirdsAny() bool
- func (voteSet *VoteSet) HasTwoThirdsMajority() bool
- func (voteSet *VoteSet) Height() uint64
- func (voteSet *VoteSet) IsCommit() bool
- func (voteSet *VoteSet) MakeCommit() *Commit
- func (voteSet *VoteSet) MarshalJSON() ([]byte, error)
- func (voteSet *VoteSet) Round() int
- func (voteSet *VoteSet) SetPeerMaj23(peerID string, blockID BlockID) error
- func (voteSet *VoteSet) Size() int
- func (voteSet *VoteSet) String() string
- func (voteSet *VoteSet) StringIndented(indent string) string
- func (voteSet *VoteSet) StringShort() string
- func (voteSet *VoteSet) TwoThirdsMajority() (blockID BlockID, ok bool)
- func (voteSet *VoteSet) Type() byte
- func (voteSet *VoteSet) VoteStrings() []string
- type VoteSetJSON
- type VoteSetReader
Constants ¶
const ( AccountAddress uint32 = 0 PrivateAddress uint32 = 1 NoAddress uint32 = 2 )
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 ( //-----normal tx type TxNormal = "tx" TxToken = "txt" TxMultiSignAccount = "mst" TxContractUpgrade = "cut" TxUTXO = "utx" // balance record TxTransfer = "transfer" TxContract = "contract" TxCreateContract = "create_contract" TxSuicide = "suicide" TxFee = "fee" //----UTXO input/output type InUTXO = "utin" InAc = "acin" InMine = "minein" OutUTXO = "utout" OutAc = "acout" TypeUTXODest = "utxodest" TypeAcDest = "acdest" )
All transaction type used
const ( PubNetSignParam int64 = 29153 TestNetSignParam int64 = 29154 )
const ( EventBond = "Bond" EventCompleteProposal = "CompleteProposal" EventDupeout = "Dupeout" EventFork = "Fork" EventLock = "Lock" EventNewBlock = "NewBlock" EventNewBlockHeader = "NewBlockHeader" EventNewRound = "NewRound" EventNewRoundStep = "NewRoundStep" EventPolka = "Polka" EventRebond = "Rebond" EventRelock = "Relock" EventTimeoutPropose = "TimeoutPropose" EventTimeoutWait = "TimeoutWait" EventTx = "Tx" EventLog = "Log" EventUnbond = "Unbond" EventUnlock = "Unlock" EventVote = "Vote" EventProposalHeartbeat = "ProposalHeartbeat" )
Reserved event types
const ( // EventTypeKey is a reserved key, used to specify event type in tags. EventTypeKey = "tm.event" // TxHashKey is a reserved key, used to specify transaction's hash. // see EventBus#PublishEventTx TxHashKey = "tx.hash" // TxHeightKey is a reserved key, used to specify transaction block's height. // see EventBus#PublishEventTx TxHeightKey = "tx.height" )
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 ( ParGasPrice int64 = 1e11 ParGasLimit uint64 = 1e5 MaxTransactionSize = 256 * 1024 MaxWasmTransactionSize = 256 * 1024 MaxPureTransactionSize = 32 * 1024 )
const ( DBupdateValidatorsKey = "multisign_updatevalidators" DBcontractCreateKey = "multisign_contractcreate" )
const ( MaxGasLimit int64 = 5e9 // max gas limit MinGasLimit int64 = 5e5 // min gas limit MaxFeeCounts int64 = 1024000 EverLiankeFee int64 = 5e4 // ever poundage fee unit(gas) EverContractLiankeFee int64 = 25e3 // ever poundate contract fee uint(gas) GasPrice int64 = 1e11 )
const ( BULLETPROOF_MAX_OUTPUTS int = 16 CRYPTONOTE_MAX_TX_SIZE int = 1000000 SHORT_RING_MEMBER_NUM int = 1 UTXO_COMMITMENT_CHANGE_RATE int64 = 1e10 )
const ( VoteTypePrevote = byte(0x01) VoteTypePrecommit = byte(0x02) )
Types of votes TODO Make a new type "VoteType"
const ( ProposalTypeNormal = byte(0x20) ProposalTypeRecover = byte(0x21) )
const ( // BloomBitsBlocks is the number of blocks a single bloom bit section vector // contains. BloomBitsBlocks uint64 = 4096 )
const ( // MaxBlockSizeBytes is the maximum permitted size of the blocks. MaxBlockSizeBytes = 104857600 // 100MB )
const TimeFormat = "2006-01-02T15:04:05.000Z"
TimeFormat is used for generating the sigs
Variables ¶
var ( SaveBalanceRecord bool = false BlockBalanceRecordsInstance *BlockBalanceRecords )
var ( SignParam = big.NewInt(PubNetSignParam) GlobalSTDSigner = MakeSTDSigner(nil) )
SignParam is const param which used to check transaction's sign is correct or not
var ( // ErrInvalidSignParam is returned if the transaction signed with error param. ErrInvalidSignParam = errors.New("invalid sign param for signer") ErrVtxEmptyPubkey = NewMockError(-40003, "validator pubkey empty") ErrVtxAddressPubkeyNotMatched = NewMockError(-40004, "validator pubkey and address not matched") ErrVtxNegativePower = NewMockError(-40005, "validator negative power") ErrParams = NewMockError(-3001, "invalid params") ErrTxEmpty = NewMockError(-3002, "tx is empty") ErrTxSign = NewMockError(-3003, "tx sign error") ErrTxDuplicate = NewMockError(-3013, "tx duplicate cached") ErrMempoolIsFull = NewMockError(-3014, "temporary unavailable") // ErrInvalidSender is returned if the transaction contains an invalid signature. ErrInvalidSender = NewMockError(-3020, "invalid sender") // ErrNonceTooHigh is returned if the nonce of a transaction is higher than the // next one expected based on the local chain. ErrNonceTooHigh = NewMockError(-3011, "nonce too high") // ErrNonceTooLow is returned if the nonce of a transaction is lower than the // one present in the local chain. ErrNonceTooLow = NewMockError(-3010, "nonce too low") // ErrUnderpriced is returned if a transaction's gas price is below the minimum // configured for the transaction pool. ErrUnderpriced = NewMockError(-3023, "transaction underpriced") // ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced // with a different one without the required price bump. ErrReplaceUnderpriced = NewMockError(-3024, "replacement transaction underpriced") // ErrInsufficientFunds is returned if the total cost of executing a transaction // is higher than the balance of the user's account. ErrInsufficientFunds = NewMockError(-3012, "insufficient funds for gas * price + value") // ErrIntrinsicGas is returned if the transaction is specified to use less gas // than required to start the invocation. ErrIntrinsicGas = NewMockError(-3025, "intrinsic gas too low") // ErrGasLimit is returned if a transaction's requested gas limit exceeds the // maximum allowance of the current block. ErrGasLimit = NewMockError(-3026, "exceeds block gas limit") ErrOutOfGas = NewMockError(-3026, "out of gas") // ErrNegativeValue is a sanity error to ensure noone is able to specify a // transaction with a negative value. ErrNegativeValue = NewMockError(-3027, "negative value") // ErrOversizedData is returned if the input data of a transaction is greater // than some meaningful limit a user might use. This is not a consensus error // making the transaction invalid, rather a DOS protection. ErrOversizedData = NewMockError(-3039, "oversized data") ErrGasLimitOrGasPrice = NewMockError(-3040, "illegal gasLimit or gasPrice") ErrTxNotSupport = NewMockError(-3039, "tx not support") ErrGasUsedMismatch = errors.New("block gas used mismatched") ErrHashMismatch = errors.New("block root hash mismatched") // ErrGasLimitReached is returned by the gas pool if the amount of gas required // by a transaction is higher than what's left in the block. ErrGasLimitReached = errors.New("gas limit reached") ErrUnknownBlock = errors.New("unknown Block") ErrGetTxsResult = errors.New("get TxsResult failed") ErrInvalidReceiver = errors.New("invalid receiver") ErrLoadValidators = errors.New("load validators failed") ErrNotFound = errors.New("not found") ExecutionReverted = errors.New("vm: execution reverted") ErrUtxoTxFeeTooLow = errors.New("fee too low") ErrUtxoTxFeeIllegal = errors.New("fee illegal") ErrUtxoTxInvalidInput = errors.New("invalid input") ErrUtxoTxInvalidOutput = errors.New("invalid output") ErrUtxoTxDoubleSpend = errors.New("double spend") ErrBlacklistAddress = errors.New("blacklist address") ErrGenerateProcessTransaction = errors.New("generate process transaction") ErrInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas") ErrIntrinsicGasOverflow = errors.New("intrinsic gas overflow") ErrUTXOChangeRateTooLarge = errors.New("utxo change rate too large") ErrForbiddenDecimalsChanged = errors.New("decimals change is forbidden") )
var ( EventQueryBond = QueryForEvent(EventBond) EventQueryUnbond = QueryForEvent(EventUnbond) EventQueryRebond = QueryForEvent(EventRebond) EventQueryDupeout = QueryForEvent(EventDupeout) EventQueryFork = QueryForEvent(EventFork) EventQueryNewBlock = QueryForEvent(EventNewBlock) EventQueryNewBlockHeader = QueryForEvent(EventNewBlockHeader) EventQueryNewRound = QueryForEvent(EventNewRound) EventQueryNewRoundStep = QueryForEvent(EventNewRoundStep) EventQueryTimeoutPropose = QueryForEvent(EventTimeoutPropose) EventQueryCompleteProposal = QueryForEvent(EventCompleteProposal) EventQueryPolka = QueryForEvent(EventPolka) EventQueryUnlock = QueryForEvent(EventUnlock) EventQueryLock = QueryForEvent(EventLock) EventQueryRelock = QueryForEvent(EventRelock) EventQueryTimeoutWait = QueryForEvent(EventTimeoutWait) EventQueryVote = QueryForEvent(EventVote) EventQueryProposalHeartbeat = QueryForEvent(EventProposalHeartbeat) EventQueryTx = QueryForEvent(EventTx) EventQueryLog = QueryForEvent(EventLog) )
var ( // BlockHeightZero is the genesis block height BlockHeightZero = uint64(0) BlockHeightOne = BlockHeightZero + 1 )
var ( ErrPartSetUnexpectedIndex = errors.New("Error part set unexpected index") ErrPartSetInvalidProof = errors.New("Error part set invalid proof") )
var ( ErrInvalidBlockPartSignature = errors.New("Error invalid block part signature") ErrInvalidBlockPartHash = errors.New("Error invalid block part hash") )
var ( ErrInvalidSig = errors.New("invalid transaction v, r, s values") ErrAccountOutputTooMore = errors.New("account output too more") )
var ( TNormal = [4]byte{0x0, 0x0, 0x0, 0x0} TUtxo = [4]byte{0x0, 0x0, 0x0, 0x1} )
var ( ErrDerivationKey = errors.New("derivaion key fail") ErrDerivationSecretKey = errors.New("derivaion secret key fail") ErrDerivationPublicKey = errors.New("derivaion public key fail") ErrDerivationSubaddrPublicKey = errors.New("derivaion subaddr public key fail") ErrDerivationScalar = errors.New("derivaion scalar fail") ErrGenerateKeyImage = errors.New("generate key image fail") ErrOutputNotBelongToAccount = errors.New("output not belong to account") ErrInMoneyLessThanOutMoney = errors.New("input money less than output money") ErrMoneyNotEqual = errors.New("input money is not equal to output money") ErrOutSkSizeNotMatch = errors.New("outSk size does not match outputs") ErrUtxoOutSizeNotExpect = errors.New("utxo output size not expect") ErrMoneyInvalid = errors.New("money invalid") ErrOutsAndMkeysNotMatch = errors.New("utxoOuts and mkeys does not match") ErrProveRangeBulletproof = errors.New("prove range bulletproof err") ErrVerRangeBulletproofFailed = errors.New("verify range bulletproof failed") ErrEcdhEncode = errors.New("ecdh encode err") ErrAccountInputSizeNotExpect = errors.New("account input size not expect") ErrInputTypeNotExpect = errors.New("input type not expect") ErrOutputTypeNotExpect = errors.New("output type not expect") ErrGetInputFromDB = errors.New("input index not exists") ErrCheckNoInput = errors.New("no inputs") ErrCheckDupKeyImage = errors.New("input KeyImage duplicated") ErrCheckDupRingMember = errors.New("duplicate ring members") ErrCheckKeyImageInvalid = errors.New("image not in valid domain") ErrCheckSecAddr = errors.New("secret address illegal") ErrCheckAmountCommit = errors.New("amount commit not equal(c!=aG+bH)") ErrCheckBadMGsSize = errors.New("bad MGs size") ErrVerRingCTSignatures = errors.New("verify rct signature failed") ERRCheckInvalidMixRing = errors.New("invalid mixRing size") ErrCheckBadBulletproofSize = errors.New("bad bullet proof size") ErrCheckBadBulletproofLSize = errors.New("bad bullet proof L size") ErrCheckEmptyInputCommits = errors.New("inputCommits Empty") ErrCheckInOutCommitNotEqual = errors.New("sum of inputs commits not equal sum of output commits") ErrCheckAccountOutputsIllegal = errors.New("account outputs illegal") ErrMixRingMemberNotSupport = errors.New("mix ring member not support") ErrRingCTSignaturesInvalid = errors.New("rct signature invalid") )
var ( ErrVoteUnexpectedStep = errors.New("Unexpected step") ErrVoteInvalidValidatorIndex = errors.New("Invalid validator index") ErrVoteInvalidValidatorSize = errors.New("Invalid validator size") ErrVoteInvalidValidatorAddress = errors.New("Invalid validator address") ErrVoteInvalidSignature = errors.New("Invalid signature") ErrVoteInvalidBlockHash = errors.New("Invalid block hash") ErrVoteNonDeterministicSignature = errors.New("Non-deterministic signature") ErrVoteNil = errors.New("Nil vote") )
var (
BlacklistInstance *blacklist
)
var Bloom9 = bloom9
var IsTestMode = false
var MultiSignNonceAddr = common.BytesToAddress([]byte("mst"))
var NotFound = errors.New("not found")
NotFound is returned by API methods if the requested item does not exist.
var (
PeerStateKey = "ConsensusReactor.peerState"
)
UNSTABLE
var TestAccounts = []TestAccount{}/* 1024 elements not displayed */
Tips: init accounts balance for test
Functions ¶
func AmountCommit ¶
AmountCommit calc c = aG + bH
func BloomLookup ¶
func CalSweepBalanceFee ¶ added in v0.1.2
func CanonicalTime ¶
func DeriveSignParam ¶
DeriveSignParam derives the sign param from the given v parameter
func EventQueryTxFor ¶
func GenMultiSignBytes ¶
func GenMultiSignBytes(signInfo MultiSignMainInfo) ([]byte, error)
func GenerateAdditionalKeys ¶
GenerateAdditionalKeys return random keys for subaddr
func GenerateAllAdditionalKeys ¶ added in v0.1.1
GenerateAllAdditionalKeys return random keys for all dests
func GetAllocAccounts ¶
func GetAllocAccounts() map[string]GenesisAccount
GetAllocAccounts return alloc accounts for reward chain
func GetTestAllocAccounts ¶
func GetTestAllocAccounts() map[string]GenesisAccount
GetTestAllocAccounts return alloc accounts for test
func GetUtxoCommitmentChangeRate ¶ added in v0.1.3
func InitSignParam ¶
func InitSignParam(TestNet bool)
func IntrinsicGas ¶ added in v0.1.2
IntrinsicGas computes the 'intrinsic gas' for a message with the given data.
func IsContract ¶
func IsNormalTx ¶
func IsOutputBelongToAccount ¶
func IsOutputBelongToAccount(acc *types.AccountKey, keyIndex map[types.PublicKey]uint64, otaddr types.Key, deriKeys []types.KeyDerivation, index uint64) (types.KeyDerivation, uint64, error)
IsOutputBelongToAccount check if output belong to account
func IsVoteTypeValid ¶
func NewMockError ¶
func NewUinTokenTransaction ¶ added in v0.1.3
func NewUinTokenTransaction(acc *types.AccountKey, keyIndex map[types.PublicKey]uint64, utxoSources []*UTXOSourceEntry, dests []DestEntry, tokenID common.Address, refundAddr common.Address, fee *big.Int, extra []byte) (*UTXOTransaction, []*UTXOInputEphemeral, types.KeyV, *types.Key, error)
NewUinTokenTransaction return a UTXOTransaction for utxo input only 1 generate random key 2 compute input secret key and key_image 3 compute one-time address 4 construct UTXOTransaction, erase input and output money 5 compute RangeBulletproof, utxo commitment, account commitment, ring signature
func NewUinTransaction ¶
func NewUinTransaction(acc *types.AccountKey, keyIndex map[types.PublicKey]uint64, utxoSources []*UTXOSourceEntry, dests []DestEntry, tokenID common.Address, refundAddr common.Address, extra []byte) (*UTXOTransaction, []*UTXOInputEphemeral, types.KeyV, *types.Key, error)
DEPRECATED
func QueryForEvent ¶
func RandValidator ¶
func RandValidator(randPower bool, minPower int64) (*Validator, PrivValidator)
RandValidator returns a randomized validator, useful for testing. UNSTABLE
func RandValidatorSet ¶
func RandValidatorSet(numValidators int, votingPower int64) (*ValidatorSet, []PrivValidator)
RandValidatorSet returns a randomized validator set, useful for testing. NOTE: PrivValidator are in order. UNSTABLE
func RegisterBlockAmino ¶
func RegisterBlockAmino()
func RegisterEventDatas ¶
func RegisterEventDatas()
func RegisterEvidences ¶
func RegisterEvidences()
func RegisterTxData ¶
func RegisterTxData()
func RegisterUTXORateGetter ¶ added in v0.1.3
func RegisterUTXORateGetter(getter *UTXOChangeRateGetter)
func RegisterUTXOTxData ¶
func RegisterUTXOTxData()
func SignContractUpgradeTx ¶
func SignContractUpgradeTx(prv *ecdsa.PrivateKey, mainInfo *ContractUpgradeMainInfo) ([]byte, error)
func UInTransWithRctSig ¶
func UInTransWithRctSig(utxoTrans *UTXOTransaction, sources []*UTXOSourceEntry, utxoIns []*UTXOInputEphemeral, dests []DestEntry, mkeys types.KeyV) error
func UTXOChangeRateDataEVM ¶ added in v0.1.3
func UTXOChangeRateDataEVM() []byte
UTXOChangeRateDataEVM returns data in getting rate from evm contract
func UTXOChangeRateDataWASM ¶ added in v0.1.3
func UTXOChangeRateDataWASM() []byte
UTXOChangeRateDataWASM returns data in getting rate from wasm contract
func UTXOChangeRateFromUint8 ¶ added in v0.1.3
UTXOChangeRateFromUint8 calculates UTXO change rate from contract decimal value raw > 26 => err 8 <= raw <= 26 => 10exp(raw - 8) raw < 8 => 10exp0=1
func UTXOChangeRateResultDecodeEVM ¶ added in v0.1.3
UTXOChangeRateResultDecodeEVM decodes returned decimals from evm contract
func UTXOChangeRateResultDecodeWASM ¶ added in v0.1.3
UTXOChangeRateResultDecodeWASM decodes returned decimals from wasm contract
func UpdateBlockHeightZero ¶ added in v0.1.1
func UpdateBlockHeightZero(height uint64)
Types ¶
type AccountDestEntry ¶
type AccountDestEntry struct { To common.Address `json:"to"` Amount *big.Int `json:"amount"` Data []byte `json:"data"` }
AccountDestEntry represents a output entry for account
func (*AccountDestEntry) GetAmount ¶
func (a *AccountDestEntry) GetAmount() *big.Int
func (*AccountDestEntry) Type ¶
func (a *AccountDestEntry) Type() string
type AccountInput ¶
type AccountInput struct { //From common.Address `json:"from"` Nonce uint64 `json:"nonce"` Amount *big.Int `json:"amount"` //Amount = user set amount + Fee, b in c = aG + bH CF types.Key `json:"cf"` //confusion factor, a in c = aG + bH Commit types.Key `json:"commit"` //Amount's commitment, c in c = aG + bH }
AccountInput represents a account input
func (*AccountInput) String ¶
func (ai *AccountInput) String() string
type AccountOutput ¶
type AccountOutput struct { To common.Address `json:"to"` Amount *big.Int `json:"amount"` Data []byte `json:"data"` //contract data Commit types.Key `json:"commit"` //Amount's commitment }
AccountOutput represents a account output
func (*AccountOutput) String ¶
func (ai *AccountOutput) String() string
type AccountSourceEntry ¶
AccountSourceEntry represents a input entry for account
type BalanceRecord ¶
type Block ¶
type Block struct { *Header `json:"header"` *Data `json:"data"` Evidence EvidenceData `json:"evidence"` LastCommit *Commit `json:"last_commit"` // contains filtered or unexported fields }
Block defines the atomic unit of a blockchain. TODO: add Version byte
func MakeBlock ¶
MakeBlock returns a new block with an empty header, except what can be computed from itself. It populates the same set of fields validated by ValidateBasic
func (*Block) AddEvidence ¶
AddEvidence appends the given evidence to the block
func (*Block) Hash ¶
Hash computes and returns the block hash. If the block is incomplete, block hash is nil for safety.
func (*Block) HashesTo ¶
HashesTo is a convenience function that checks if a block hashes to the given argument. Returns false if the block is nil or the hash is empty.
func (*Block) HeightBigInt ¶
func (*Block) MakePartSet ¶
MakePartSet returns a PartSet containing parts of a serialized block. This is the form in which the block is gossipped to peers.
func (*Block) Parenthash ¶
func (*Block) Receipthash ¶
func (*Block) StringIndented ¶
StringIndented returns a string representation of the block
func (*Block) StringShort ¶
StringShort returns a shortened string representation of the block
func (*Block) ValidateBasic ¶
ValidateBasic performs basic validation that doesn't involve state data. It checks the internal consistency of the block.
type BlockBalanceRecords ¶
type BlockBalanceRecords struct { TxRecords []*TxBalanceRecords `json:"tx_records"` BlockHash common.Hash `json:"block_hash"` BlockTime uint64 `json:"block_time"` // contains filtered or unexported fields }
func NewBlockBalanceRecords ¶
func NewBlockBalanceRecords() *BlockBalanceRecords
func (*BlockBalanceRecords) AddTxBalanceRecord ¶
func (b *BlockBalanceRecords) AddTxBalanceRecord(t *TxBalanceRecords)
func (*BlockBalanceRecords) Json ¶
func (b *BlockBalanceRecords) Json() []byte
func (*BlockBalanceRecords) Reset ¶ added in v0.1.1
func (b *BlockBalanceRecords) Reset()
func (*BlockBalanceRecords) SetBlockHash ¶
func (b *BlockBalanceRecords) SetBlockHash(blockHash common.Hash)
func (*BlockBalanceRecords) SetBlockTime ¶
func (b *BlockBalanceRecords) SetBlockTime(blockTime uint64)
type BlockChain ¶
type BlockEventPublisher ¶
type BlockEventPublisher interface { PublishEventNewBlock(block EventDataNewBlock) error PublishEventNewBlockHeader(header EventDataNewBlockHeader) error PublishEventLog(EventDataLog) error }
BlockEventPublisher publishes all block related events
type BlockGossip ¶
type BlockGossip struct {
BlockPartSizeBytes int `json:"block_part_size_bytes"` // NOTE: must not be 0
}
BlockGossip determine consensus critical elements of how blocks are gossiped
func DefaultBlockGossip ¶
func DefaultBlockGossip() BlockGossip
DefaultBlockGossip returns a default BlockGossip.
type BlockID ¶
type BlockID struct { Hash common.Hash `json:"hash"` PartsHeader PartSetHeader `json:"parts"` }
BlockID defines the unique ID of a block as its Hash and its PartSetHeader
type BlockMeta ¶
type BlockMeta struct { BlockID BlockID `json:"block_id"` // the block hash and partsethash Header *Header `json:"header"` // The block's Header }
BlockMeta contains meta information about a block - namely, it's ID and Header.
func NewBlockMeta ¶
NewBlockMeta returns a new BlockMeta from the block and its blockParts.
type BlockSize ¶
type BlockSize struct { MaxBytes int `json:"max_bytes"` // NOTE: must not be 0 nor greater than 100MB MaxTxs int `json:"max_txs"` MaxGas uint64 `json:"max_gas"` }
BlockSize contain limits on the block size.
func DefaultBlockSize ¶
func DefaultBlockSize() BlockSize
DefaultBlockSize returns a default BlockSize.
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) 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 CalRate ¶
type CalRate struct { Srate int64 `json:"Srate"` //score rate Drate int64 `json:"Drate"` //deposit rate Rrate int64 `json:"Rrate"` //randnum rate }
CalRate decide the rate when calculate the candidate's rankresult
type CallMsg ¶
type CallMsg struct { From common.Address // the sender of the 'transaction' To *common.Address // the destination contract (nil for contract creation) Gas uint64 // if 0, the call executes with near-infinite gas GasPrice *big.Int // wei <-> gas exchange ratio Value *big.Int // amount of wei sent along with the call Data []byte // input data, usually an ABI-encoded contract method invocation }
CallMsg contains parameters for contract calls.
type Candidate ¶
type Candidate struct { Address crypto.Address `json:"address"` PubKey crypto.PubKey `json:"pub_key"` VotingPower int64 `json:"voting_power"` CoinBase common.Address `json:"coinbase"` }
Candidate the base info about candidate
type CandidateInOrder ¶
type CandidateInOrder struct { Candidate `json:"candidate"` ProduceInfo int `json:"prodece_info"` Deposit int64 `json:"deposit"` //value/wei Score int64 `json:"score"` Rand int64 `json:"rand_num"` Rank int `json:"rank"` RankResult *big.Rat `json:"-" rlp:"-"` }
CandidateInOrder used to store the candidates sorted by rankInfo in app
func (*CandidateInOrder) CalRank ¶
func (v *CandidateInOrder) CalRank(a, b, c, maxDeposit, subScore int64)
CalRank Calculate the rank Result,abc is the rank parameters
0.3*(score/500)+0.4*(deposit/Maxdeposit)+0.3*(rand/sub)
func (*CandidateInOrder) Copy ¶
func (v *CandidateInOrder) Copy() *CandidateInOrder
Copy to deep copy CandidateInOrder
func (CandidateInOrder) String ¶
func (v CandidateInOrder) String() string
type CandidateInOrderList ¶
type CandidateInOrderList []*CandidateInOrder
CandidateInOrderList for sort CandidateState List
func (CandidateInOrderList) Len ¶
func (cl CandidateInOrderList) Len() int
func (CandidateInOrderList) Less ¶
func (cl CandidateInOrderList) Less(i, j int) bool
func (CandidateInOrderList) RandomSort ¶ added in v0.1.1
func (cl CandidateInOrderList) RandomSort(salt int64)
RandomSort re-sort candidateList by random chose based on RankResult
func (CandidateInOrderList) Swap ¶
func (cl CandidateInOrderList) Swap(i, j int)
type CandidateState ¶
type CandidateState struct { Candidate `json:"candidate"` Score int64 `json:"score"` PunishHeight uint64 `json:"punish_height"` }
CandidateState used to store candidates List in stateDB
func (*CandidateState) Copy ¶
func (v *CandidateState) Copy() *CandidateState
Copy to deep copy CandidateState
func (*CandidateState) String ¶
func (v *CandidateState) String() string
type CandidatesByAddress ¶
type CandidatesByAddress []*CandidateState
CandidatesByAddress for sort CandidateState List
func (CandidatesByAddress) Len ¶
func (cs CandidatesByAddress) Len() int
func (CandidatesByAddress) Less ¶
func (cs CandidatesByAddress) Less(i, j int) bool
func (CandidatesByAddress) Swap ¶
func (cs CandidatesByAddress) Swap(i, j int)
type CandidatesList ¶
type CandidatesList map[string]*CandidateState
CandidatesList used to map CandidateState in stateDB
func (CandidatesList) Copy ¶
func (cls CandidatesList) Copy() CandidatesList
Copy to deep copy CandidatesList
type CanonicalJSONBlockID ¶
type CanonicalJSONBlockID struct { Hash common.Hash `json:"hash,omitempty"` PartsHeader CanonicalJSONPartSetHeader `json:"parts,omitempty"` }
func CanonicalBlockID ¶
func CanonicalBlockID(blockID BlockID) CanonicalJSONBlockID
type CanonicalJSONHeartbeat ¶
type CanonicalJSONHeartbeat struct { ChainID string `json:"@chain_id"` Type string `json:"@type"` Height uint64 `json:"height"` Round int `json:"round"` Sequence int `json:"sequence"` ValidatorAddress crypto.Address `json:"validator_address"` ValidatorIndex int `json:"validator_index"` }
func CanonicalHeartbeat ¶
func CanonicalHeartbeat(chainID string, heartbeat *Heartbeat) CanonicalJSONHeartbeat
type CanonicalJSONPartSetHeader ¶
type CanonicalJSONPartSetHeader struct { Hash cmn.HexBytes `json:"hash,omitempty"` Total int `json:"total,omitempty"` }
func CanonicalPartSetHeader ¶
func CanonicalPartSetHeader(psh PartSetHeader) CanonicalJSONPartSetHeader
type CanonicalJSONProposal ¶
type CanonicalJSONProposal struct { ChainID string `json:"@chain_id"` Type string `json:"@type"` BlockPartsHeader CanonicalJSONPartSetHeader `json:"block_parts_header"` Height uint64 `json:"height"` POLBlockID CanonicalJSONBlockID `json:"pol_block_id"` POLRound int `json:"pol_round"` Round int `json:"round"` Timestamp string `json:"timestamp"` }
func CanonicalProposal ¶
func CanonicalProposal(chainID string, proposal *Proposal) CanonicalJSONProposal
type CanonicalJSONVote ¶
type CanonicalJSONVote struct { ChainID string `json:"@chain_id"` Type string `json:"@type"` BlockID CanonicalJSONBlockID `json:"block_id"` Height uint64 `json:"height"` Round int `json:"round"` Timestamp string `json:"timestamp"` VoteType byte `json:"type"` }
func CanonicalVote ¶
func CanonicalVote(chainID string, vote *Vote) CanonicalJSONVote
type ChainContext ¶
type ChainContext interface { }
type ChainReader ¶
type ChainReader interface { BlockByHash(ctx context.Context, hash common.Hash) (*Block, error) BlockByNumber(ctx context.Context, number *big.Int) (*Block, error) HeaderByHash(ctx context.Context, hash common.Hash) (*Header, error) HeaderByNumber(ctx context.Context, number *big.Int) (*Header, error) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*Transaction, error) // This method subscribes to notifications about changes of the head block of // the canonical chain. SubscribeNewHead(ctx context.Context, ch chan<- *Header) (Subscription, error) }
ChainReader provides access to the blockchain. The methods in this interface access raw data from either the canonical chain (when requesting by block number) or any blockchain fork that was previously downloaded and processed by the node. The block number argument can be nil to select the latest canonical block. Reading block headers should be preferred over full blocks whenever possible.
The returned error is NotFound if the requested item does not exist.
type ChainStateReader ¶
type ChainStateReader interface { BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) }
ChainStateReader wraps access to the state trie of the canonical blockchain. Note that implementations of the interface may be unable to return state values for old blocks. In many cases, using CallContract can be preferable to reading raw contract storage.
type ChainSyncReader ¶
type ChainSyncReader interface {
SyncProgress(ctx context.Context) (*SyncProgress, error)
}
ChainSyncReader wraps access to the node's current sync status. If there's no sync currently running, it returns nil.
type Coefficient ¶
type Coefficient struct { VotePeriod uint64 `json:"VotePeriod"` //voting per VotePeriod blocks VoteRate `json:"VoteRate"` CalRate `json:"CalRate"` MaxScore int64 `json:"MaxScore"` UTXOFee *big.Int `json:"UTXOFee"` }
Coefficient some coefficient which may be changed
func DefaultCoefficient ¶
func DefaultCoefficient() *Coefficient
DefaultCoefficient returns a default Coefficient.
type Commit ¶
type Commit struct { // NOTE: The Precommits are in order of address to preserve the bonded ValidatorSet order. // Any peer with a block can gossip precommits by index with a peer without recalculating the // active ValidatorSet. BlockID BlockID `json:"block_id"` Precommits []*Vote `json:"precommits"` // contains filtered or unexported fields }
Commit contains the evidence that a block was committed by a set of validators. NOTE: Commit is empty for height 1, but never nil.
func MakeCommit ¶
func (*Commit) FirstPrecommit ¶
FirstPrecommit returns the first non-nil precommit in the commit. If all precommits are nil, it returns an empty precommit with height 0.
func (*Commit) GetByIndex ¶
GetByIndex returns the vote corresponding to a given validator index
func (*Commit) StringIndented ¶
StringIndented returns a string representation of the commit
func (*Commit) ValidateBasic ¶
ValidateBasic performs basic validation that doesn't involve state data.
type ConsensusParams ¶
type ConsensusParams struct { BlockSize `json:"block_size_params"` TxSize `json:"tx_size_params"` BlockGossip `json:"block_gossip_params"` EvidenceParams `json:"evidence_params"` }
ConsensusParams contains consensus critical parameters that determine the validity of blocks.
func DefaultConsensusParams ¶
func DefaultConsensusParams() *ConsensusParams
DefaultConsensusParams returns a default ConsensusParams.
func (*ConsensusParams) Hash ¶
func (params *ConsensusParams) Hash() []byte
Hash returns a merkle hash of the parameters to store in the block header
func (*ConsensusParams) Validate ¶
func (params *ConsensusParams) Validate() error
Validate validates the ConsensusParams to ensure all values are within their allowed limits, and returns an error if they are not.
type Context ¶
type Context interface { }
Context provides the EVM with auxiliary information. Once provided it shouldn't be modified.
type ContractCaller ¶
type ContractCaller interface {
CallContract(ctx context.Context, call CallMsg, blockNumber *big.Int) ([]byte, error)
}
A ContractCaller provides contract calls, essentially transactions that are executed by the EVM but not mined into the blockchain. ContractCall is a low-level method to execute such calls. For applications which are structured around specific contracts, the abigen tool provides a nicer, properly typed way to perform calls.
type ContractRef ¶
type ContractRef interface { }
type ContractUpgradeMainInfo ¶
type ContractUpgradeMainInfo struct { FromAddr common.Address `json:"from" gencodec:"required"` // the Addr's signdata must be include in Signatures Recipient common.Address `json:"contract" gencodec:"required" rlp:"nil"` AccountNonce uint64 `json:"nonce" gencodec:"required"` Payload []byte `json:"input" gencodec:"required"` }
type ContractUpgradeTx ¶
type ContractUpgradeTx struct { ContractUpgradeMainInfo `json:"mainInfo"` Signatures []*signdata `json:"signs"` // contains filtered or unexported fields }
func UpgradeContractTx ¶
func UpgradeContractTx(mainInfo *ContractUpgradeMainInfo, sigData [][]byte) *ContractUpgradeTx
func (*ContractUpgradeTx) AsMessage ¶
func (tx *ContractUpgradeTx) AsMessage() (Message, error)
func (*ContractUpgradeTx) CheckBasic ¶
func (tx *ContractUpgradeTx) CheckBasic(censor TxCensor) error
func (*ContractUpgradeTx) CheckState ¶
func (tx *ContractUpgradeTx) CheckState(censor TxCensor) error
func (*ContractUpgradeTx) Cost ¶
func (tx *ContractUpgradeTx) Cost() *big.Int
func (*ContractUpgradeTx) Data ¶
func (tx *ContractUpgradeTx) Data() []byte
func (*ContractUpgradeTx) Gas ¶
func (tx *ContractUpgradeTx) Gas() uint64
func (*ContractUpgradeTx) GasPrice ¶
func (tx *ContractUpgradeTx) GasPrice() *big.Int
func (*ContractUpgradeTx) Hash ¶
func (tx *ContractUpgradeTx) Hash() common.Hash
func (*ContractUpgradeTx) Nonce ¶
func (tx *ContractUpgradeTx) Nonce() uint64
func (*ContractUpgradeTx) Senders ¶
func (tx *ContractUpgradeTx) Senders() ([]common.Address, error)
func (*ContractUpgradeTx) Sign ¶
func (tx *ContractUpgradeTx) Sign(signer STDSigner, prv *ecdsa.PrivateKey) error
func (*ContractUpgradeTx) String ¶
func (tx *ContractUpgradeTx) String() string
func (*ContractUpgradeTx) To ¶
func (tx *ContractUpgradeTx) To() *common.Address
func (*ContractUpgradeTx) TokenAddress ¶
func (tx *ContractUpgradeTx) TokenAddress() common.Address
IMessage
func (*ContractUpgradeTx) TypeName ¶
func (tx *ContractUpgradeTx) TypeName() string
func (*ContractUpgradeTx) Value ¶
func (tx *ContractUpgradeTx) Value() *big.Int
func (*ContractUpgradeTx) VerifySign ¶
func (tx *ContractUpgradeTx) VerifySign(signersInfo *SignersInfo) (err error)
type Data ¶
type Data struct { // Txs that included in the block Txs Txs `json:"txs"` // contains filtered or unexported fields }
Data contains the set of transactions included in the block
func (*Data) StringIndented ¶
StringIndented returns a string representation of the transactions
type DuplicateVoteEvidence ¶
DuplicateVoteEvidence contains evidence a validator signed two conflicting votes.
func (*DuplicateVoteEvidence) Address ¶
func (dve *DuplicateVoteEvidence) Address() []byte
Address returns the address of the validator.
func (*DuplicateVoteEvidence) Equal ¶
func (dve *DuplicateVoteEvidence) Equal(ev Evidence) bool
Equal checks if two pieces of evidence are equal.
func (*DuplicateVoteEvidence) Hash ¶
func (dve *DuplicateVoteEvidence) Hash() []byte
Hash returns the hash of the evidence.
func (*DuplicateVoteEvidence) Height ¶
func (dve *DuplicateVoteEvidence) Height() uint64
Height returns the height this evidence refers to.
func (*DuplicateVoteEvidence) String ¶
func (dve *DuplicateVoteEvidence) String() string
String returns a string representation of the evidence.
type ErrEvidenceInvalid ¶
ErrEvidenceInvalid wraps a piece of evidence and the error denoting how or why it is invalid.
func NewEvidenceInvalidErr ¶
func NewEvidenceInvalidErr(ev Evidence, err error) *ErrEvidenceInvalid
func (*ErrEvidenceInvalid) Error ¶
func (err *ErrEvidenceInvalid) Error() string
Error returns a string representation of the error.
type ErrVoteConflictingVotes ¶
type ErrVoteConflictingVotes struct {
*DuplicateVoteEvidence
}
func NewConflictingVoteError ¶
func NewConflictingVoteError(val *Validator, voteA, voteB *Vote) *ErrVoteConflictingVotes
func (*ErrVoteConflictingVotes) Error ¶
func (err *ErrVoteConflictingVotes) Error() string
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 (*EventBus) Publish ¶
func (b *EventBus) Publish(eventType string, eventData TMEventData) error
func (*EventBus) PublishEventCompleteProposal ¶
func (b *EventBus) PublishEventCompleteProposal(event EventDataRoundState) error
func (*EventBus) PublishEventLock ¶
func (b *EventBus) PublishEventLock(event EventDataRoundState) 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) PublishEventNewRound ¶
func (b *EventBus) PublishEventNewRound(event EventDataRoundState) error
func (*EventBus) PublishEventNewRoundStep ¶
func (b *EventBus) PublishEventNewRoundStep(event EventDataRoundState) error
func (*EventBus) PublishEventPolka ¶
func (b *EventBus) PublishEventPolka(event EventDataRoundState) error
func (*EventBus) PublishEventProposalHeartbeat ¶
func (b *EventBus) PublishEventProposalHeartbeat(event EventDataProposalHeartbeat) error
func (*EventBus) PublishEventRelock ¶
func (b *EventBus) PublishEventRelock(event EventDataRoundState) error
func (*EventBus) PublishEventTimeoutPropose ¶
func (b *EventBus) PublishEventTimeoutPropose(event EventDataRoundState) error
func (*EventBus) PublishEventTimeoutWait ¶
func (b *EventBus) PublishEventTimeoutWait(event EventDataRoundState) error
func (*EventBus) PublishEventUnlock ¶
func (b *EventBus) PublishEventUnlock(event EventDataRoundState) error
func (*EventBus) PublishEventVote ¶
func (b *EventBus) PublishEventVote(event EventDataVote) error
func (*EventBus) Unsubscribe ¶
type EventBusSubscriber ¶
type EventDataLog ¶
type EventDataLog struct {
Logs []*Log `json:"logs"`
}
func (EventDataLog) AssertIsTMEventData ¶
func (_ EventDataLog) AssertIsTMEventData()
type EventDataNewBlock ¶
type EventDataNewBlock struct {
Block *Block `json:"block"`
}
func (EventDataNewBlock) AssertIsTMEventData ¶
func (_ EventDataNewBlock) AssertIsTMEventData()
type EventDataNewBlockHeader ¶
type EventDataNewBlockHeader struct {
Header *Header `json:"header"`
}
light weight event for benchmarking
func (EventDataNewBlockHeader) AssertIsTMEventData ¶
func (_ EventDataNewBlockHeader) AssertIsTMEventData()
type EventDataProposalHeartbeat ¶
type EventDataProposalHeartbeat struct {
Heartbeat *Heartbeat
}
func (EventDataProposalHeartbeat) AssertIsTMEventData ¶
func (_ EventDataProposalHeartbeat) AssertIsTMEventData()
type EventDataRoundState ¶
type EventDataRoundState struct { Height uint64 `json:"height"` Round int `json:"round"` Step string `json:"step"` // private, not exposed to websockets RoundState interface{} `json:"-" rlp:"-"` }
NOTE: This goes into the replay WAL
func (EventDataRoundState) AssertIsTMEventData ¶
func (_ EventDataRoundState) AssertIsTMEventData()
type EventDataString ¶
type EventDataString string
func (EventDataString) AssertIsTMEventData ¶
func (_ EventDataString) AssertIsTMEventData()
type EventDataVote ¶
type EventDataVote struct {
Vote *Vote
}
func (EventDataVote) AssertIsTMEventData ¶
func (_ EventDataVote) AssertIsTMEventData()
type Evidence ¶
type Evidence interface { Height() uint64 // height of the equivocation Address() []byte // address of the equivocating validator Hash() []byte // hash of the evidence Verify(chainID string, pubKey crypto.PubKey) error // verify the evidence Equal(Evidence) bool // check equality of evidence String() string }
Evidence represents any provable malicious activity by a validator
type EvidenceData ¶
type EvidenceData struct { Evidence EvidenceList `json:"evidence"` // contains filtered or unexported fields }
EvidenceData contains any evidence of malicious wrong-doing by validators
func (*EvidenceData) Hash ¶
func (data *EvidenceData) Hash() common.Hash
Hash returns the hash of the data.
func (*EvidenceData) StringIndented ¶
func (data *EvidenceData) StringIndented(indent string) string
StringIndented returns a string representation of the evidence.
type EvidenceList ¶
type EvidenceList []Evidence
EvidenceList is a list of Evidence. Evidences is not a word.
func (EvidenceList) Has ¶
func (evl EvidenceList) Has(evidence Evidence) bool
Has returns true if the evidence is in the EvidenceList.
func (EvidenceList) Hash ¶
func (evl EvidenceList) Hash() []byte
Hash returns the simple merkle root hash of the EvidenceList.
func (EvidenceList) String ¶
func (evl EvidenceList) String() string
type EvidenceParams ¶
type EvidenceParams struct {
MaxAge uint64 `json:"max_age"` // only accept new evidence more recent than this
}
EvidenceParams determine how we handle evidence of malfeasance
func DefaultEvidenceParams ¶
func DefaultEvidenceParams() EvidenceParams
DefaultEvidence Params returns a default EvidenceParams.
type FaultValidatorsEvidence ¶
type FaultValidatorsEvidence struct { BlockHeight uint64 Round int Proposer crypto.PubKey FaultVal crypto.PubKey }
func (*FaultValidatorsEvidence) Address ¶
func (fve *FaultValidatorsEvidence) Address() []byte
func (*FaultValidatorsEvidence) Equal ¶
func (fve *FaultValidatorsEvidence) Equal(ev Evidence) bool
func (*FaultValidatorsEvidence) Hash ¶
func (fve *FaultValidatorsEvidence) Hash() []byte
func (*FaultValidatorsEvidence) Height ¶
func (fve *FaultValidatorsEvidence) Height() uint64
func (*FaultValidatorsEvidence) String ¶
func (fve *FaultValidatorsEvidence) String() string
type FilePV ¶
type FilePV struct { Address crypto.Address `json:"address"` PubKey crypto.PubKey `json:"pub_key"` LastHeight uint64 `json:"last_height"` LastRound int `json:"last_round"` LastStep int8 `json:"last_step"` LastSignature crypto.Signature `json:"last_signature,omitempty"` // so we dont lose signatures XXX Why would we lose signatures? LastSignBytes cmn.HexBytes `json:"last_signbytes,omitempty"` // so we dont lose signatures XXX Why would we lose signatures? PrivKey crypto.PrivKey `json:"priv_key"` // contains filtered or unexported fields }
---------------------------------------- FilePV
FilePV implements PrivValidator using data persisted to disk to prevent double signing. NOTE: the directory containing the pv.filePath must already exist.
func GenFilePV ¶
GenFilePV generates a new validator with randomly generated private key and sets the filePath, but does not call Save().
func LoadFilePV ¶
LoadFilePV loads a FilePV from the filePath. The FilePV handles double signing prevention by persisting data to the filePath. If the filePath does not exist, the FilePV must be created manually and saved.
func LoadOrGenFilePV ¶
LoadOrGenFilePV loads a FilePV from the given filePath or else generates a new one and saves it to the filePath.
func LoadPVFromBytes ¶
func (*FilePV) GetAddress ¶
GetAddress returns the address of the validator. Implements PrivValidator.
func (*FilePV) GetPubKey ¶
GetPubKey returns the public key of the validator. Implements PrivValidator.
func (*FilePV) Reset ¶
func (pv *FilePV) Reset()
Reset resets all fields in the FilePV. NOTE: Unsafe!
func (*FilePV) SignHeartbeat ¶
SignHeartbeat signs a canonical representation of the heartbeat, along with the chainID. Implements PrivValidator.
func (*FilePV) SignProposal ¶
SignProposal signs a canonical representation of the proposal, along with the chainID. Implements PrivValidator.
func (*FilePV) SignVote ¶
SignVote signs a canonical representation of the vote, along with the chainID. Implements PrivValidator.
func (*FilePV) SignVoteWithoutSave ¶
SignVote signs a canonical representation of the vote, along with the chainID. Implements PrivValidator.
func (*FilePV) UpdatePrikey ¶
UpdatePrikey update PrivKey with the given privkey
type FilterQuery ¶
type FilterQuery struct { FromBlock *big.Int // beginning of the queried range, nil means genesis block ToBlock *big.Int // end of the range, nil means latest block Addresses []common.Address // restricts matches to events created by specific contracts // The Topic list restricts matches to particular event topics. Each event has a list // of topics. Topics matches a prefix of that list. An empty element slice matches any // topic. Non-empty elements represent an alternative that matches any of the // contained topics. // // Examples: // {} or nil matches any topic list // {{A}} matches topic A in first position // {{}, {B}} matches any topic in first position, B in second position // {{A}, {B}} matches topic A in first position, B in second position // {{A, B}}, {C, D}} matches topic (A OR B) in first position, (C OR D) in second position Topics [][]common.Hash }
FilterQuery contains options for contract log filtering.
type GasEstimator ¶
GasEstimator wraps EstimateGas, which tries to estimate the gas needed to execute a specific transaction based on the pending state. There is no guarantee that this is the true gas limit requirement as other transactions may be added or removed by miners, but it should provide a basis for setting a reasonable default.
type GasPricer ¶
GasPricer wraps the gas price oracle, which monitors the blockchain to determine the optimal gas price given current fee market conditions.
type GenesisAccount ¶
GenesisAccount is an account in the state of the genesis block.
type GenesisDoc ¶
type GenesisDoc struct { GenesisTime string `json:"genesis_time"` ChainID string `json:"chain_id"` ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"` Validators []GenesisValidator `json:"validators"` AllocAccounts map[string]GenesisAccount `json:"accounts,omitempty"` }
GenesisDoc defines the initial conditions for a blockchain, in particular its validator set.
func GenesisDocFromFile ¶
func GenesisDocFromFile(genDocFile string) (*GenesisDoc, error)
GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc.
func GenesisDocFromJSON ¶
func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error)
GenesisDocFromJSON unmarshalls JSON data into a GenesisDoc.
func (*GenesisDoc) SaveAs ¶
func (genDoc *GenesisDoc) SaveAs(file string) error
SaveAs is a utility method for saving GenensisDoc as a JSON file.
func (*GenesisDoc) ValidateAndComplete ¶
func (genDoc *GenesisDoc) ValidateAndComplete() error
ValidateAndComplete checks that all necessary fields are present and fills in defaults for optional fields left empty
type GenesisValidator ¶
type GenesisValidator struct { PubKey crypto.PubKey `json:"pub_key"` CoinBase cmn.Address `json:"coinbase"` Power int64 `json:"power"` Name string `json:"name"` }
GenesisValidator is an initial validator.
type Header ¶
type Header struct { // basic block info ChainID string `json:"chain_id"` Height uint64 `json:"height"` Coinbase common.Address `json:"miner"` Time uint64 `json:"time"` NumTxs uint64 `json:"num_txs"` TotalTxs uint64 `json:"total_txs"` Recover uint32 `json:"recover"` // prev block info ParentHash common.Hash `json:"parent_hash"` // hash from the prev block LastBlockID BlockID `json:"last_block_id"` LastCommitHash common.Hash `json:"last_commit_hash"` // commit from validators from the last block // hashes from the current block ValidatorsHash common.Hash `json:"validators_hash"` // validators for the current block ConsensusHash common.Hash `json:"consensus_hash"` // consensus params for current block DataHash common.Hash `json:"data_hash"` // transactions StateHash common.Hash `json:"state_hash"` ReceiptHash common.Hash `json:"receipts_hash"` GasLimit uint64 `json:"gasLimit"` GasUsed uint64 `json:"gasUsed"` // consensus info EvidenceHash common.Hash `json:"evidence_hash"` // evidence included in the block./ // contains filtered or unexported fields }
Header defines the structure of a block header
func CopyHeader ¶
func (*Header) Hash ¶
Hash returns the hash of the header. Returns nil if ValidatorHash is missing, since a Header is not valid unless there is a ValidaotrsHash (corresponding to the validator set).
func (*Header) StringIndented ¶
StringIndented returns a string representation of the header
type Heartbeat ¶
type Heartbeat struct { ValidatorAddress crypto.Address `json:"validator_address"` ValidatorIndex int `json:"validator_index"` Height uint64 `json:"height"` Round int `json:"round"` Sequence int `json:"sequence"` Signature crypto.Signature `json:"signature"` }
Heartbeat is a simple vote-like structure so validators can alert others that they are alive and waiting for transactions. Note: We aren't adding ",omitempty" to Heartbeat's json field tags because we always want the JSON representation to be in its canonical form.
type Interpreter ¶
type Interpreter interface { }
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" rlp:"-"` 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 LogFilterer ¶
type LogFilterer interface { FilterLogs(ctx context.Context, q FilterQuery) ([]Log, error) SubscribeFilterLogs(ctx context.Context, q FilterQuery, ch chan<- Log) (Subscription, error) }
LogFilterer provides access to contract log events using a one-off query or continuous event subscription.
Logs received through a streaming query subscription may have Removed set to true, indicating that the log was reverted due to a chain reorganisation.
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 LogId ¶
type LogId uint64
const ( LogIdBlockTimeError LogId = 30003 LogIdIllegalValidator LogId = 30006 LogIdContractExecutionError LogId = 70000 LogIdHeight LogId = 70007 LogIdCommitBlockFail LogId = 70008 LogIdSyncBlockCheckError LogId = 70009 LogIdFastSyncBlockTimeOut LogId = 70010 //No need LogIdSpecTxCheckError LogId = 70019 LogIdTooManyRetransTx LogId = 70020 LogIdBootNodeFail LogId = 70021 LogIdSyncBlockFail LogId = 70022 )
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 (*Message) OutputData ¶
func (m *Message) OutputData() []OutputData
func (*Message) SetOutputData ¶
func (m *Message) SetOutputData(outputs []OutputData)
func (*Message) SetUTXOKind ¶
func (Message) TokenAddress ¶
type MockBadEvidence ¶
type MockBadEvidence struct {
MockGoodEvidence
}
UNSTABLE
func (MockBadEvidence) Equal ¶
func (e MockBadEvidence) Equal(ev Evidence) bool
func (MockBadEvidence) String ¶
func (e MockBadEvidence) String() string
type MockGoodEvidence ¶
UNSTABLE
func NewMockGoodEvidence ¶
func NewMockGoodEvidence(height uint64, idx int, address []byte) MockGoodEvidence
UNSTABLE
func (MockGoodEvidence) Address ¶
func (e MockGoodEvidence) Address() []byte
func (MockGoodEvidence) Equal ¶
func (e MockGoodEvidence) Equal(ev Evidence) bool
func (MockGoodEvidence) Hash ¶
func (e MockGoodEvidence) Hash() []byte
func (MockGoodEvidence) Height ¶
func (e MockGoodEvidence) Height() uint64
func (MockGoodEvidence) String ¶
func (e MockGoodEvidence) String() string
type MockPV ¶
type MockPV struct {
// contains filtered or unexported fields
}
MockPV implements PrivValidator without any safety or persistence. Only use it for testing.
func (*MockPV) SignHeartbeat ¶
signHeartbeat signs the heartbeat without any checking.
func (*MockPV) SignProposal ¶
Implements PrivValidator.
func (*MockPV) SignVoteWithoutSave ¶
Implements PrivValidator.
func (*MockPV) UpdatePrikey ¶
Implements PrivValidator.
type MockState ¶
MockState is an autogenerated mock type for the State type
func (*MockState) GetBalance ¶
GetBalance provides a mock function with given fields: addr
func (*MockState) GetTokenBalance ¶
GetTokenBalance provides a mock function with given fields: addr, token
func (*MockState) IsContract ¶
IsContract provides a mock function with given fields: addr
func (*MockState) SubBalance ¶
SubBalance provides a mock function with given fields: addr, amount
type MockTxCensor ¶
MockTxCensor is an autogenerated mock type for the TxCensor type
func (*MockTxCensor) Block ¶
func (_m *MockTxCensor) Block() *Block
Block provides a mock function with given fields:
func (*MockTxCensor) BlockChain ¶
func (_m *MockTxCensor) BlockChain() BlockChain
BlockChain provides a mock function with given fields:
func (*MockTxCensor) GetLastChangedVals ¶
func (_m *MockTxCensor) GetLastChangedVals() (uint64, []*Validator)
GetLastChangedVals provides a mock function with given fields:
func (*MockTxCensor) GetUTXOGas ¶
func (_m *MockTxCensor) GetUTXOGas() uint64
GetUTXOGas provides a mock function with given fields:
func (*MockTxCensor) IsWasmContract ¶
func (_m *MockTxCensor) IsWasmContract(data []byte) bool
IsWasmContract provides a mock function with given fields: data
func (*MockTxCensor) LockState ¶
func (_m *MockTxCensor) LockState()
LockState provides a mock function with given fields:
func (*MockTxCensor) Mempool ¶
func (_m *MockTxCensor) Mempool() Mempool
Mempool provides a mock function with given fields:
func (*MockTxCensor) State ¶
func (_m *MockTxCensor) State() State
State provides a mock function with given fields:
func (*MockTxCensor) TxMgr ¶
func (_m *MockTxCensor) TxMgr() TxMgr
TxMgr provides a mock function with given fields:
func (*MockTxCensor) UTXOStore ¶
func (_m *MockTxCensor) UTXOStore() UTXOStore
UTXOStore provides a mock function with given fields:
func (*MockTxCensor) UnlockState ¶
func (_m *MockTxCensor) UnlockState()
UnlockState provides a mock function with given fields:
type MockTxMgr ¶
MockTxMgr is an autogenerated mock type for the TxMgr type
func (*MockTxMgr) GetMultiSignersInfo ¶
func (_m *MockTxMgr) GetMultiSignersInfo(txType SupportType) *SignersInfo
GetMultiSignersInfo provides a mock function with given fields: txType
type MultiSignAccountTx ¶
type MultiSignAccountTx struct { MultiSignMainInfo `json: "mainInfo"` //the main info that every validator needs sign for Signatures []ValidatorSign `json: "signs"` //validators’ signs,at least 2/3 valid ValidatorSign // contains filtered or unexported fields }
func NewMultiSignAccountTx ¶
func NewMultiSignAccountTx(mainInfo *MultiSignMainInfo, Signatures []ValidatorSign) *MultiSignAccountTx
func (*MultiSignAccountTx) CheckBasic ¶
func (tx *MultiSignAccountTx) CheckBasic(censor TxCensor) error
func (*MultiSignAccountTx) CheckState ¶
func (tx *MultiSignAccountTx) CheckState(censor TxCensor) error
func (*MultiSignAccountTx) Hash ¶
func (tx *MultiSignAccountTx) Hash() common.Hash
func (*MultiSignAccountTx) Nonce ¶
func (tx *MultiSignAccountTx) Nonce() uint64
func (*MultiSignAccountTx) Sign ¶
func (tx *MultiSignAccountTx) Sign(prv PrivValidator) error
func (*MultiSignAccountTx) String ¶
func (tx *MultiSignAccountTx) String() string
func (*MultiSignAccountTx) To ¶
func (tx *MultiSignAccountTx) To() *common.Address
func (*MultiSignAccountTx) TokenAddress ¶ added in v0.1.2
func (tx *MultiSignAccountTx) TokenAddress() common.Address
func (*MultiSignAccountTx) TypeName ¶
func (tx *MultiSignAccountTx) TypeName() string
func (*MultiSignAccountTx) VerifySign ¶
func (tx *MultiSignAccountTx) VerifySign(validators *ValidatorSet) (err error)
verify whether Signatures is 2/3 valid and save the Signers
type MultiSignMainInfo ¶
type MultiSignMainInfo struct { AccountNonce uint64 `json:"nonce"` //the nonce of MultiSignNonceAddr SupportTxType SupportType `json:"txTypes"` SignersInfo `json:"signersInfo"` }
type NopEventBus ¶
type NopEventBus struct{}
func (NopEventBus) PublishEventCompleteProposal ¶
func (NopEventBus) PublishEventCompleteProposal(rs EventDataRoundState) error
func (NopEventBus) PublishEventLock ¶
func (NopEventBus) PublishEventLock(rs EventDataRoundState) error
func (NopEventBus) PublishEventLog ¶
func (NopEventBus) PublishEventLog(log EventDataLog) error
func (NopEventBus) PublishEventNewBlock ¶
func (NopEventBus) PublishEventNewBlock(block EventDataNewBlock) error
func (NopEventBus) PublishEventNewBlockHeader ¶
func (NopEventBus) PublishEventNewBlockHeader(header EventDataNewBlockHeader) error
func (NopEventBus) PublishEventNewRound ¶
func (NopEventBus) PublishEventNewRound(rs EventDataRoundState) error
func (NopEventBus) PublishEventNewRoundStep ¶
func (NopEventBus) PublishEventNewRoundStep(rs EventDataRoundState) error
func (NopEventBus) PublishEventPolka ¶
func (NopEventBus) PublishEventPolka(rs EventDataRoundState) error
func (NopEventBus) PublishEventRelock ¶
func (NopEventBus) PublishEventRelock(rs EventDataRoundState) error
func (NopEventBus) PublishEventTimeoutPropose ¶
func (NopEventBus) PublishEventTimeoutPropose(rs EventDataRoundState) error
func (NopEventBus) PublishEventTimeoutWait ¶
func (NopEventBus) PublishEventTimeoutWait(rs EventDataRoundState) error
func (NopEventBus) PublishEventUnlock ¶
func (NopEventBus) PublishEventUnlock(rs EventDataRoundState) error
func (NopEventBus) PublishEventVote ¶
func (NopEventBus) PublishEventVote(vote EventDataVote) error
func (NopEventBus) Unsubscribe ¶
func (NopEventBus) UnsubscribeAll ¶
func (NopEventBus) UnsubscribeAll(ctx context.Context, subscriber string) error
type OutputData ¶
func (OutputData) String ¶
func (od OutputData) String() string
type Part ¶
type Part struct { Index int `json:"index"` Bytes cmn.HexBytes `json:"bytes"` Proof merkle.SimpleProof `json:"proof"` // contains filtered or unexported fields }
func (*Part) StringIndented ¶
type PartSet ¶
type PartSet struct {
// contains filtered or unexported fields
}
func NewPartSetFromData ¶
Returns an immutable, full PartSet from the data bytes. The data bytes are split into "partSize" chunks, and merkle tree computed.
func NewPartSetFromHeader ¶
func NewPartSetFromHeader(header PartSetHeader) *PartSet
Returns an empty PartSet ready to be populated.
func (*PartSet) HasHeader ¶
func (ps *PartSet) HasHeader(header PartSetHeader) bool
func (*PartSet) Header ¶
func (ps *PartSet) Header() PartSetHeader
func (*PartSet) IsComplete ¶
func (*PartSet) MarshalJSON ¶
func (*PartSet) StringShort ¶
type PartSetHeader ¶
func (PartSetHeader) Equals ¶
func (psh PartSetHeader) Equals(other PartSetHeader) bool
func (PartSetHeader) IsZero ¶
func (psh PartSetHeader) IsZero() bool
func (PartSetHeader) String ¶
func (psh PartSetHeader) String() string
type PartSetReader ¶
type PartSetReader struct {
// contains filtered or unexported fields
}
func NewPartSetReader ¶
func NewPartSetReader(parts []*Part) *PartSetReader
type PendingContractCaller ¶
type PendingContractCaller interface {
PendingCallContract(ctx context.Context, call CallMsg) ([]byte, error)
}
PendingContractCaller can be used to perform calls against the pending state.
type PendingStateEventer ¶
type PendingStateEventer interface {
SubscribePendingTransactions(ctx context.Context, ch chan<- *Transaction) (Subscription, error)
}
A PendingStateEventer provides access to real time notifications about changes to the pending state.
type PendingStateReader ¶
type PendingStateReader interface { PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) PendingTransactionCount(ctx context.Context) (uint, error) }
A PendingStateReader provides access to the pending state, which is the result of all known executable transactions which have not yet been included in the blockchain. It is commonly used to display the result of ’unconfirmed’ actions (e.g. wallet value transfers) initiated by the user. The PendingNonceAt operation is a good way to retrieve the next available transaction nonce for a specific account.
type PrivValidator ¶
type PrivValidator interface { GetAddress() crypto.Address // redundant since .PubKey().Address() GetPubKey() crypto.PubKey UpdatePrikey(priv crypto.PrivKey) GetPrikey() crypto.PrivKey SignData(data []byte) ([]byte, error) SignVote(chainID string, vote *Vote) error SignVoteWithoutSave(chainID string, vote *Vote) error SignProposal(chainID string, proposal *Proposal) error SignHeartbeat(chainID string, heartbeat *Heartbeat) error }
PrivValidator defines the functionality of a local validator that signs votes, proposals, and heartbeats, and never double signs.
type PrivValidatorsByAddress ¶
type PrivValidatorsByAddress []PrivValidator
func (PrivValidatorsByAddress) Len ¶
func (pvs PrivValidatorsByAddress) Len() int
func (PrivValidatorsByAddress) Less ¶
func (pvs PrivValidatorsByAddress) Less(i, j int) bool
func (PrivValidatorsByAddress) Swap ¶
func (pvs PrivValidatorsByAddress) Swap(i, j int)
type Proposal ¶
type Proposal struct { Type byte `json:"type"` Height uint64 `json:"height"` Round int `json:"round"` Timestamp time.Time `json:"timestamp"` BlockPartsHeader PartSetHeader `json:"block_parts_header"` POLRound int `json:"pol_round"` // -1 if null. POLBlockID BlockID `json:"pol_block_id"` // zero if null. Signature crypto.Signature `json:"signature"` }
Proposal defines a block proposal for the consensus. It refers to the block only by its PartSetHeader. It must be signed by the correct proposer for the given Height/Round to be considered valid. It may depend on votes from a previous round, a so-called Proof-of-Lock (POL) round, as noted in the POLRound and POLBlockID.
func NewProposal ¶
func NewProposal(height uint64, round int, blockPartsHeader PartSetHeader, polRound int, polBlockID BlockID) *Proposal
NewProposal returns a new Proposal. If there is no POLRound, polRound should be -1.
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 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"` }
Receipt represents the results of a transaction.
func NewReceipt ¶
NewReceipt creates a barebone transaction receipt, copying the init fields.
func (*Receipt) ForStorage ¶
func (r *Receipt) ForStorage() *ReceiptForStorage
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 ReceiptForStorage ¶
type ReceiptForStorage struct { PostState []byte Status uint64 VMErr string CumulativeGasUsed uint64 Bloom Bloom Logs []*LogForStorage TxHash common.Hash ContractAddress common.Address GasUsed uint64 }
func (*ReceiptForStorage) ToReceipt ¶
func (s *ReceiptForStorage) ToReceipt() *Receipt
type Receipts ¶
type Receipts []*Receipt
Receipts is a wrapper around a Receipt array to implement DerivableList.
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.
func MakeSTDSigner ¶
MakeSTDSigner returns a STDSigner based on the given signparam or default param.
type Signable ¶
Signable is an interface for all signable things. It typically removes signatures before serializing. SignBytes returns the bytes to be signed NOTE: chainIDs are part of the SignBytes but not necessarily the object themselves. NOTE: Expected to panic if there is an error marshalling.
type SignedHeader ¶
SignedHeader is a header along with the commits that prove it
type SignerEntry ¶
type SignersInfo ¶
type SignersInfo struct { MinSignerPower int32 `json:"minSignerPower"` Signers []*SignerEntry `json:"signers"` }
type State ¶
type State interface { Exist(addr common.Address) bool GetNonce(addr common.Address) uint64 SetNonce(addr common.Address, nonce uint64) GetBalance(addr common.Address) *big.Int SubBalance(addr common.Address, amount *big.Int) GetTokenBalance(addr common.Address, token common.Address) *big.Int SubTokenBalance(addr common.Address, token common.Address, amount *big.Int) IsContract(addr common.Address) bool }
type StateDB ¶
type StateDB interface { CreateAccount(common.Address) SubBalance(common.Address, *big.Int) AddBalance(common.Address, *big.Int) GetBalance(common.Address) *big.Int GetNonce(common.Address) uint64 SetNonce(common.Address, uint64) GetCredits(common.Address) uint64 SetCredits(common.Address, uint64) GetCodeHash(common.Address) common.Hash GetContractCode([]byte) []byte GetCode(common.Address) []byte SetCode(common.Address, []byte) GetCodeSize(common.Address) int IsContract(common.Address) bool AddRefund(uint64) GetRefund() uint64 GetState(common.Address, common.Hash) []byte SetState(common.Address, common.Hash, []byte) Suicide(common.Address) bool HasSuicided(common.Address) bool // Exist reports whether the given account exists in state. // Notably this should also return true for suicided accounts. Exist(common.Address) bool // Empty returns whether the given account is empty. Empty // is defined according to EIP161 (balance = nonce = code = 0). Empty(common.Address) bool RevertToSnapshot(int) Snapshot() int AddLog(*Log) AddPreimage(common.Hash, []byte) ForEachStorage(common.Address, func(common.Hash, []byte) bool) TxHash() common.Hash Logs() []*Log SubTokenBalance(addr common.Address, token common.Address, amount *big.Int) AddTokenBalance(addr common.Address, token common.Address, amount *big.Int) GetTokenBalance(addr common.Address, token common.Address) *big.Int GetTokenBalances(addr common.Address) TokenValues GetCoefficient(logger log.Logger) *Coefficient }
StateDB is an VM database for full state querying.
type Subscription ¶
type Subscription interface { // Unsubscribe cancels the sending of events to the data channel // and closes the error channel. Unsubscribe() // Err returns the subscription error channel. The error channel receives // a value if there is an issue with the subscription (e.g. the network connection // delivering the events has been closed). Only one value will ever be sent. // The error channel is closed by Unsubscribe. Err() <-chan error }
Subscription represents an event subscription where events are delivered on a data channel.
type SupportType ¶
type SupportType int
const ( TxUpdateValidatorsType SupportType = iota TxContractCreateType )
func (SupportType) String ¶
func (txType SupportType) String() string
type SyncProgress ¶
type SyncProgress struct { StartingBlock uint64 // Block number where sync began CurrentBlock uint64 // Current block number where sync is at HighestBlock uint64 // Highest alleged block number in the chain PulledStates uint64 // Number of state trie entries already downloaded KnownStates uint64 // Total number of state trie entries known about }
SyncProgress gives progress indications when the node is synchronising with the Ethereum network.
type TestAccount ¶
type TokenTransaction ¶
type TokenTransaction struct {
// contains filtered or unexported fields
}
func NewTokenTransaction ¶
func (*TokenTransaction) AsMessage ¶
func (tx *TokenTransaction) AsMessage() (Message, error)
func (*TokenTransaction) CheckBasic ¶
func (tx *TokenTransaction) CheckBasic(censor TxCensor) error
func (*TokenTransaction) CheckBasicWithState ¶ added in v0.1.1
func (tx *TokenTransaction) CheckBasicWithState(censor TxCensor, state State) error
func (*TokenTransaction) CheckState ¶
func (tx *TokenTransaction) CheckState(censor TxCensor) error
func (*TokenTransaction) Cost ¶
func (tx *TokenTransaction) Cost() *big.Int
func (*TokenTransaction) Data ¶
func (tx *TokenTransaction) Data() []byte
func (*TokenTransaction) DecodeSER ¶
func (tx *TokenTransaction) DecodeSER(s *ser.Stream) error
DecodeSER implements ser.Decoder
func (*TokenTransaction) EncodeSER ¶
func (tx *TokenTransaction) EncodeSER(w io.Writer) error
EncodeSER implements ser.Encoder
func (*TokenTransaction) Gas ¶
func (tx *TokenTransaction) Gas() uint64
func (*TokenTransaction) GasCost ¶
func (tx *TokenTransaction) GasCost() *big.Int
Cost returns gasprice * gaslimit.
func (*TokenTransaction) GasPrice ¶
func (tx *TokenTransaction) GasPrice() *big.Int
func (*TokenTransaction) Hash ¶
func (tx *TokenTransaction) Hash() (h common.Hash)
Hash hashes the RLP encoding of tx. It uniquely identifies the transaction.
func (*TokenTransaction) IllegalGasLimitOrGasPrice ¶
func (tx *TokenTransaction) IllegalGasLimitOrGasPrice(hascode bool) bool
func (TokenTransaction) MarshalJSON ¶
func (tx TokenTransaction) MarshalJSON() ([]byte, error)
MarshalJSON encodes the web3 RPC transaction format.
func (*TokenTransaction) Nonce ¶
func (tx *TokenTransaction) Nonce() uint64
func (*TokenTransaction) Protected ¶
func (tx *TokenTransaction) Protected() bool
Protected returns whether the transaction is protected from replay protection.
func (*TokenTransaction) RawSignatureValues ¶
func (*TokenTransaction) RawString ¶
func (tx *TokenTransaction) RawString() string
func (*TokenTransaction) Sender ¶
func (tx *TokenTransaction) Sender(signer STDSigner) (common.Address, error)
func (*TokenTransaction) Sign ¶
func (tx *TokenTransaction) Sign(signer STDSigner, prv *ecdsa.PrivateKey) error
func (*TokenTransaction) SignHash ¶
func (tx *TokenTransaction) SignHash() common.Hash
func (*TokenTransaction) SignParam ¶
func (tx *TokenTransaction) SignParam() *big.Int
SignParam returns which sign param this transaction was signed with
func (*TokenTransaction) Size ¶
func (tx *TokenTransaction) Size() common.StorageSize
Size returns the true RLP encoded storage size of the TokenTransaction, either by encoding and returning it, or returning a previsouly cached value.
func (*TokenTransaction) StoreFrom ¶
func (tx *TokenTransaction) StoreFrom(addr common.Address)
func (*TokenTransaction) String ¶
func (tx *TokenTransaction) String() string
func (*TokenTransaction) To ¶
func (tx *TokenTransaction) To() *common.Address
To returns the recipient address of the transaction. It returns nil if the transaction is a contract creation.
func (*TokenTransaction) TokenAddress ¶
func (tx *TokenTransaction) TokenAddress() common.Address
func (*TokenTransaction) TypeName ¶
func (tx *TokenTransaction) TypeName() string
func (*TokenTransaction) UnmarshalJSON ¶
func (tx *TokenTransaction) UnmarshalJSON(input []byte) error
UnmarshalJSON decodes the web3 RPC transaction format.
func (*TokenTransaction) Value ¶
func (tx *TokenTransaction) Value() *big.Int
type TokenValue ¶
type TokenValues ¶
type TokenValues []TokenValue
func (TokenValues) Len ¶
func (t TokenValues) Len() int
func (TokenValues) Less ¶
func (t TokenValues) Less(i, j int) bool
func (TokenValues) Swap ¶
func (t TokenValues) Swap(i, j int)
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewContractCreation ¶
func NewTransaction ¶
func (*Transaction) AsMessage ¶
func (tx *Transaction) AsMessage() (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) CheckBasic ¶
func (tx *Transaction) CheckBasic(censor TxCensor) error
func (*Transaction) CheckBasicWithState ¶ added in v0.1.1
func (tx *Transaction) CheckBasicWithState(censor TxCensor, state State) error
func (*Transaction) CheckState ¶
func (tx *Transaction) CheckState(censor TxCensor) error
func (*Transaction) Cost ¶
func (tx *Transaction) Cost() *big.Int
Cost returns amount + gasprice * gaslimit.
func (*Transaction) Data ¶
func (tx *Transaction) Data() []byte
func (*Transaction) DecodeSER ¶
func (tx *Transaction) DecodeSER(s *ser.Stream) error
DecodeSER implements ser.Decoder
func (*Transaction) EncodeSER ¶
func (tx *Transaction) EncodeSER(w io.Writer) error
EncodeSER implements ser.Encoder
func (*Transaction) Gas ¶
func (tx *Transaction) Gas() uint64
func (*Transaction) GasPrice ¶
func (tx *Transaction) GasPrice() *big.Int
func (Transaction) GetTxData ¶
func (tx Transaction) GetTxData() txdata
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() common.Hash
Hash hashes the RLP encoding of tx. It uniquely identifies the transaction.
func (*Transaction) IllegalGasLimitOrGasPrice ¶
func (tx *Transaction) IllegalGasLimitOrGasPrice(hascode bool) bool
TODO: return err instead of bool
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) Protected ¶
func (tx *Transaction) Protected() bool
Protected returns whether the transaction is protected from replay protection.
func (*Transaction) RawSignatureValues ¶
func (*Transaction) RawString ¶
func (tx *Transaction) RawString() string
func (*Transaction) Sender ¶
func (tx *Transaction) Sender(signer STDSigner) (common.Address, error)
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(signer STDSigner, prv *ecdsa.PrivateKey) error
func (*Transaction) SignHash ¶
func (tx *Transaction) SignHash() common.Hash
func (*Transaction) SignParam ¶
func (tx *Transaction) SignParam() *big.Int
SignParam returns which sign param this transaction was signed with
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) StoreFrom ¶
func (tx *Transaction) StoreFrom(addr common.Address)
func (*Transaction) String ¶
func (tx *Transaction) String() string
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) TokenAddress ¶
func (tx *Transaction) TokenAddress() common.Address
func (*Transaction) TypeName ¶
func (tx *Transaction) TypeName() string
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 STDSigner, 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).
type TransactionReader ¶
type TransactionReader interface { // TransactionByHash checks the pool of pending transactions in addition to the // blockchain. The isPending return value indicates whether the transaction has been // mined yet. Note that the transaction may not be part of the canonical chain even if // it's not pending. TransactionByHash(ctx context.Context, txHash common.Hash) (tx *Transaction, isPending bool, err error) // TransactionReceipt returns the receipt of a mined transaction. Note that the // transaction may not be included in the current canonical chain even if a receipt // exists. TransactionReceipt(ctx context.Context, txHash common.Hash) (*Receipt, error) }
TransactionReader provides access to past transactions and their receipts. Implementations may impose arbitrary restrictions on the transactions and receipts that can be retrieved. Historic transactions may not be available.
Avoid relying on this interface if possible. Contract logs (through the LogFilterer interface) are more reliable and usually safer in the presence of chain reorganisations.
The returned error is NotFound if the requested item does not exist.
type TransactionSender ¶
type TransactionSender interface {
SendTransaction(ctx context.Context, tx *Transaction) error
}
TransactionSender wraps transaction sending. The SendTransaction method injects a signed transaction into the pending transaction pool for execution. If the transaction was a contract creation, the TransactionReceipt method can be used to retrieve the contract address after the transaction has been mined.
The transaction must be signed and have a valid nonce to be included. Consumers of the API can use package accounts to maintain local private keys and need can retrieve the next available nonce using PendingNonceAt.
type Transactions ¶
type Transactions []RegularTx
Transactions is a Transaction slice type for basic sorting.
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) Swap ¶
func (s Transactions) Swap(i, j int)
Swap swaps the i'th and the j'th element in s.
type Tx ¶
type Tx interface { Hash() common.Hash From() (common.Address, error) To() *common.Address TokenAddress() common.Address TypeName() string CheckBasic(censor TxCensor) error CheckState(censor TxCensor) error }
TxData represent a tx content
type TxBalanceRecords ¶
type TxBalanceRecords struct { Hash common.Hash `json:"hash"` Type string `json:"type"` Records []BalanceRecord `json:"records"` Payloads []Payload `json:"payloads"` Nonce uint64 `json:"nonce"` GasLimit uint64 `json:"gas_limit"` GasPrice *big.Int `json:"gas_price"` From common.Address `json:"from"` To common.Address `json:"to"` TokenId common.Address `json:"token_id"` }
func NewTxBalanceRecords ¶
func NewTxBalanceRecords() *TxBalanceRecords
func (*TxBalanceRecords) AddBalanceRecord ¶
func (t *TxBalanceRecords) AddBalanceRecord(br BalanceRecord)
func (*TxBalanceRecords) ClearBalanceRecord ¶
func (t *TxBalanceRecords) ClearBalanceRecord()
func (*TxBalanceRecords) IsBalanceRecordEmpty ¶ added in v0.1.1
func (t *TxBalanceRecords) IsBalanceRecordEmpty() bool
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 TxEntry ¶
type TxEntry struct { BlockHash common.Hash `json:"blockHash"` BlockHeight uint64 `json:"blockHeight"` Index uint64 `json:"txIndex"` }
TxEntry is a positional metadata to help looking up the data content of a transaction or receipt given only its hash.
type TxMgr ¶
type TxMgr interface {
GetMultiSignersInfo(txType SupportType) *SignersInfo
}
type TxProof ¶
TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree.
type Txs ¶
type Txs []Tx
Txs is a slice of Tx.
func (Txs) IndexByHash ¶
IndexByHash returns the index of this transaction hash in the list, or -1 if not found
func (*Txs) MarshalJSON ¶
MarshalJSON returns *m as the JSON encoding of m.
func (*Txs) UnmarshalJSON ¶
UnmarshalJSON sets *m to a copy of data.
type TxsResult ¶
type TxsResult struct { GasUsed uint64 `json:"gasUsed"` TrieRoot common.Hash `json:"trieRoot"` StateHash common.Hash `json:"state_hash"` ReceiptHash common.Hash `json:"receipts_hash"` LogsBloom Bloom `json:"logs_bloom"` Candidates []*CandidateInOrder `json:"candidates"` //candidates in order CandidatesMap map[string]*CandidateInOrder `json:"-" rlp:"-"` // contains filtered or unexported fields }
TxsResult contains results of executing the transactions.
func (*TxsResult) SetCandidates ¶
func (txResult *TxsResult) SetCandidates(candidates []*CandidateInOrder)
func (*TxsResult) SetKeyImages ¶
func (*TxsResult) SetSpecialTxs ¶
func (*TxsResult) SetUTXOOutputs ¶
func (txresult *TxsResult) SetUTXOOutputs(utxoOutputData []*UTXOOutputData)
func (*TxsResult) SpecialTxs ¶
func (*TxsResult) UTXOOutputs ¶
func (txresult *TxsResult) UTXOOutputs() []*UTXOOutputData
func (*TxsResult) UpdateCandidates ¶
func (txResult *TxsResult) UpdateCandidates(candidates []*CandidateInOrder)
type UTXOChangeRateGetter ¶ added in v0.1.3
type UTXOChangeRateGetter struct {
// contains filtered or unexported fields
}
UTXOChangeRateGetter provides getter for utxo commit change rate which is used in processing utxo tx
func NewUTXOChangeRateGetter ¶ added in v0.1.3
func NewUTXOChangeRateGetter(f func(addr common.Address) (int64, error)) *UTXOChangeRateGetter
NewUTXOChangeRateGetter create a UTXOChangeRateGetter object
type UTXODest ¶
type UTXODest struct { Addr string `json:"addr"` Amount *hexutil.Big `json:"amount"` Remark hexutil.Bytes `json:"remark"` Data hexutil.Bytes `json:"data"` }
UTXODest represents a output entry for utxo rpc
type UTXODestEntry ¶
type UTXODestEntry struct { Addr types.AccountAddress Amount *big.Int IsSubaddress bool IsChange bool Remark [32]byte }
UTXODestEntry represents a output entry for utxo
func (*UTXODestEntry) GetAmount ¶
func (u *UTXODestEntry) GetAmount() *big.Int
func (*UTXODestEntry) Type ¶
func (u *UTXODestEntry) Type() string
type UTXOInput ¶
type UTXOInput struct { //Amount *big.Int `json:"amount"` KeyOffset []uint64 `json:"key_offset"` KeyImage types.Key `json:"key_image"` }
UTXOInput represents a utxo input
type UTXOInputEphemeral ¶
UTXOInputEphemeral represents a ephemeral status of input
func GenerateKeyImage ¶
func GenerateKeyImage(acc *types.AccountKey, keyIndex map[types.PublicKey]uint64, sources []*UTXOSourceEntry) ([]*UTXOInputEphemeral, error)
GenerateKeyImage return key-image and secret key of the input utxo
type UTXOKind ¶
type UTXOKind byte
UTXOKind catagory UTXOTransaction kind by input and output.
const ( IllKind UTXOKind = 0x00 // 1 1 1 1 // uin ain uout aout Uin UTXOKind = 0x01 Ain UTXOKind = 0x02 Uout UTXOKind = 0x04 Aout UTXOKind = 0x08 AinAout UTXOKind = Ain | Aout UinUout UTXOKind = Uin | Uout AinUout UTXOKind = Ain | Uout UinAout UTXOKind = Uin | Aout MixinAout UTXOKind = Uin | Ain | Aout MixinUout UTXOKind = Uin | Ain | Uout MixinAll UTXOKind = Uin | Ain | Uout | Aout )
type UTXOOutput ¶
type UTXOOutput struct { OTAddr types.Key `json:"otaddr"` Amount *big.Int `json:"amount"` Remark [32]byte `json:"remark"` }
UTXOOutput represents a utxo output
func GenerateOneTimeAddress ¶
func GenerateOneTimeAddress(rSecKey types.Key, dests []*UTXODestEntry) ([]*UTXOOutput, types.KeyV, error)
GenerateOneTimeAddress return one-time addresses of outputs
func (*UTXOOutput) String ¶
func (u *UTXOOutput) String() string
type UTXOOutputData ¶
type UTXOOutputData struct { OTAddr types.Key `json:"out"` Height uint64 `json:"height"` Commit types.Key `json:"commit"` TokenID common.Address `json:"token"` Remark [32]byte `json:"remark"` }
UTXOOutputData represents utxo output entry in chain db
type UTXOOutputDetail ¶
type UTXOOutputDetail struct { BlockHeight uint64 TxID types.Hash OutIndex uint64 GlobalIndex uint64 Spent bool Frozen bool SpentHeight uint64 RKey types.PublicKey KeyImage types.Key Mask types.Key Amount *big.Int SubAddrIndex uint64 TokenID common.Address Remark [32]byte }
UTXOOutputDetail represents utxo output entry in local
func (*UTXOOutputDetail) String ¶
func (u *UTXOOutputDetail) String() string
type UTXORingEntry ¶
UTXORingEntry represents a ring entry for utxo
type UTXOSourceEntry ¶
type UTXOSourceEntry struct { Ring []UTXORingEntry RingIndex uint64 RKey types.PublicKey OutIndex uint64 Amount *big.Int Mask types.Key }
UTXOSourceEntry represents a input entry for utxo
type UTXOTransaction ¶
type UTXOTransaction struct { Inputs []Input `json:"inputs"` Outputs []Output `json:"outputs"` TokenID common.Address `json:"token_id"` //current version one Tx support only one token //RefundAddr common.Address `json:"refund_addr"` //RefundAddr only valid when there is only UTXOInput, and accountOutput(UTXOOutput) RKey types.PublicKey `json:"r_key"` //each tx with a random PKSK AddKeys []types.PublicKey `json:"add_keys"` //one key per subaddr Fee *big.Int `json:"fee"` //fee charge only LKC, without unit (different from gas) Extra []byte `json:"extra"` //reserve not used yet Sigs signdata `json:"signature"` //account signature RCTSig types.RctSig `json:"rct_signature"` //ringct signature // contains filtered or unexported fields }
UTXOTransaction represents a utxo transaction for UTXOs
func NewAinTokenTransaction ¶ added in v0.1.3
func NewAinTokenTransaction(accSource *AccountSourceEntry, dests []DestEntry, tokenID common.Address, fee *big.Int, extra []byte) (*UTXOTransaction, *types.Key, error)
NewAinTokenTransaction return a UTXOTransaction for account input only 1 generate random key 2 compute one-time address 3 construct UTXOTransaction, erase output money 4 compute RangeBulletproof, utxo commitment, account commitment 5 compute account sig
func NewAinTransaction ¶
func NewAinTransaction(accSource *AccountSourceEntry, dests []DestEntry, tokenID common.Address, extra []byte) (*UTXOTransaction, *types.Key, error)
DEPRECATED
func (*UTXOTransaction) AsMessage ¶
func (tx *UTXOTransaction) AsMessage() (Message, error)
func (*UTXOTransaction) CheckBasic ¶
func (tx *UTXOTransaction) CheckBasic(censor TxCensor) error
CheckBasic check tx's input, output, commit, bulletproof, and ringct.
func (UTXOTransaction) CheckState ¶
func (tx UTXOTransaction) CheckState(censor TxCensor) error
CheckState check account state and utxostore if tx has corresponding input type.
func (*UTXOTransaction) CheckStoreState ¶ added in v0.1.1
func (tx *UTXOTransaction) CheckStoreState(censor TxCensor, state State) error
CheckStoreState check an UTXOTransaction store state
func (*UTXOTransaction) Data ¶
func (tx *UTXOTransaction) Data() []byte
func (*UTXOTransaction) Gas ¶
func (tx *UTXOTransaction) Gas() uint64
func (*UTXOTransaction) GasPrice ¶
func (tx *UTXOTransaction) GasPrice() *big.Int
func (*UTXOTransaction) GetInputKeyImages ¶
func (tx *UTXOTransaction) GetInputKeyImages() []*types.Key
////////////////////////////
func (UTXOTransaction) GetOutputData ¶
func (tx UTXOTransaction) GetOutputData(blockHeight uint64) []*UTXOOutputData
func (*UTXOTransaction) Hash ¶
func (tx *UTXOTransaction) Hash() common.Hash
func (*UTXOTransaction) Nonce ¶
func (tx *UTXOTransaction) Nonce() uint64
func (UTXOTransaction) PrefixHash ¶
func (tx UTXOTransaction) PrefixHash() types.Key
PrefixHash - compute prefix hash for ring sig
func (*UTXOTransaction) Sender ¶
func (tx *UTXOTransaction) Sender(signer STDSigner) (common.Address, error)
func (*UTXOTransaction) SetSize ¶
func (tx *UTXOTransaction) SetSize(size uint64)
func (*UTXOTransaction) Sign ¶
func (tx *UTXOTransaction) Sign(signer STDSigner, prv *ecdsa.PrivateKey) error
func (*UTXOTransaction) Size ¶
func (tx *UTXOTransaction) Size() common.StorageSize
func (*UTXOTransaction) StoreFrom ¶
func (tx *UTXOTransaction) StoreFrom(addr common.Address)
func (UTXOTransaction) To ¶
func (tx UTXOTransaction) To() *common.Address
To return to address, here is none, just for interface
func (UTXOTransaction) ToAddrs ¶
func (tx UTXOTransaction) ToAddrs() []common.Address
ToAddrs return to addresses, for receipt use
func (UTXOTransaction) TokenAddress ¶
func (tx UTXOTransaction) TokenAddress() common.Address
TokenAddress returns to tokenaddress
func (*UTXOTransaction) TxType ¶
func (tx *UTXOTransaction) TxType() string
func (*UTXOTransaction) UTXOKind ¶
func (tx *UTXOTransaction) UTXOKind() UTXOKind
func (*UTXOTransaction) Value ¶
func (tx *UTXOTransaction) Value() *big.Int
func (*UTXOTransaction) VerifyProofSemantic ¶
func (tx *UTXOTransaction) VerifyProofSemantic() error
type Validator ¶
type Validator struct { Address crypto.Address `json:"address"` PubKey crypto.PubKey `json:"pub_key"` CoinBase cmn.Address `json:"coinbase"` VotingPower int64 `json:"voting_power"` Accum int64 `json:"accum"` }
Volatile state for each Validator NOTE: The Accum is not included in Validator.Hash(); make sure to update that method if changes are made here
func NewValidator ¶
func (*Validator) CompareAccum ¶
Returns the one with higher Accum.
func (*Validator) Copy ¶
Creates a new copy of the validator so we can mutate accum. Panics if the validator is nil.
type ValidatorSet ¶
type ValidatorSet struct { // NOTE: persisted via reflect, must be exported. Validators []*Validator `json:"validators"` Proposer *Validator `json:"proposer"` // contains filtered or unexported fields }
ValidatorSet represent a set of *Validator at a given height. The validators can be fetched by address or index. The index is in order of .Address, so the indices are fixed for all rounds of a given blockchain height. On the other hand, the .AccumPower of each validator and the designated .GetProposer() of a set changes every round, upon calling .IncrementAccum(). NOTE: Not goroutine-safe. NOTE: All get/set to validators should copy the value for safety.
func NewValidatorSet ¶
func NewValidatorSet(vals []*Validator) *ValidatorSet
func (*ValidatorSet) Add ¶
func (valSet *ValidatorSet) Add(val *Validator) (added bool)
Add adds val to the validator set and returns true. It returns false if val is already in the set.
func (*ValidatorSet) Copy ¶
func (valSet *ValidatorSet) Copy() *ValidatorSet
Copy each validator into a new ValidatorSet
func (*ValidatorSet) FindAddress ¶
func (valSet *ValidatorSet) FindAddress(address []byte) *Validator
func (*ValidatorSet) GetByAddress ¶
func (valSet *ValidatorSet) GetByAddress(address []byte) (index int, val *Validator)
GetByAddress returns an index of the validator with address and validator itself if found. Otherwise, -1 and nil are returned.
func (*ValidatorSet) GetByIndex ¶
func (valSet *ValidatorSet) GetByIndex(index int) (address []byte, val *Validator)
GetByIndex returns the validator's address and validator itself by index. It returns nil values if index is less than 0 or greater or equal to len(ValidatorSet.Validators).
func (*ValidatorSet) GetProposer ¶
func (valSet *ValidatorSet) GetProposer() (proposer *Validator)
GetProposer returns the current proposer. If the validator set is empty, nil is returned.
func (*ValidatorSet) HasAddress ¶
func (valSet *ValidatorSet) HasAddress(address []byte) bool
HasAddress returns true if address given is in the validator set, false - otherwise.
func (*ValidatorSet) Hash ¶
func (valSet *ValidatorSet) Hash() []byte
Hash returns the Merkle root hash build using validators (as leaves) in the set.
func (*ValidatorSet) IncrementAccum ¶
func (valSet *ValidatorSet) IncrementAccum(times int)
IncrementAccum increments accum of each validator and updates the proposer. Panics if validator set is empty.
func (*ValidatorSet) Iterate ¶
func (valSet *ValidatorSet) Iterate(fn func(index int, val *Validator) bool)
Iterate will run the given function over the set.
func (*ValidatorSet) Remove ¶
func (valSet *ValidatorSet) Remove(address []byte) (val *Validator, removed bool)
Remove deletes the validator with address. It returns the validator removed and true. If returns nil and false if validator is not present in the set.
func (*ValidatorSet) Size ¶
func (valSet *ValidatorSet) Size() int
Size returns the length of the validator set.
func (*ValidatorSet) String ¶
func (valSet *ValidatorSet) String() string
func (*ValidatorSet) StringIndented ¶
func (valSet *ValidatorSet) StringIndented(indent string) string
String
func (*ValidatorSet) TotalVotingPower ¶
func (valSet *ValidatorSet) TotalVotingPower() int64
TotalVotingPower returns the sum of the voting powers of all validators.
func (*ValidatorSet) Update ¶
func (valSet *ValidatorSet) Update(val *Validator) (updated bool)
Update updates val and returns true. It returns false if val is not present in the set.
func (*ValidatorSet) VerifyCommit ¶
func (valSet *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height uint64, commit *Commit) error
Verify that +2/3 of the set had signed the given signBytes
func (*ValidatorSet) VerifyCommitAny ¶
func (valSet *ValidatorSet) VerifyCommitAny(chainID string, blockID BlockID, height uint64, commit *Commit) error
VerifyCommitAny will check to see if the set would be valid with a different validator set
type ValidatorSign ¶
type ValidatorsByAddress ¶
type ValidatorsByAddress []*Validator
Sort validators by address
func (ValidatorsByAddress) Len ¶
func (vs ValidatorsByAddress) Len() int
func (ValidatorsByAddress) Less ¶
func (vs ValidatorsByAddress) Less(i, j int) bool
func (ValidatorsByAddress) Swap ¶
func (vs ValidatorsByAddress) Swap(i, j int)
type Vote ¶
type Vote struct { ValidatorAddress crypto.Address `json:"validator_address"` ValidatorIndex int `json:"validator_index"` ValidatorSize int `json:"validator_size"` Height uint64 `json:"height"` Round int `json:"round"` Timestamp time.Time `json:"timestamp"` Type byte `json:"type"` BlockID BlockID `json:"block_id"` // zero if vote is nil. Signature crypto.Signature `json:"signature"` }
Represents a prevote, precommit, or commit vote from validators for consensus.
func (*Vote) UnmarshalJSON ¶
type VoteRate ¶
type VoteRate struct { Deno int `json:"Deno"` //Denominator Nume int `json:"Nume"` //molecule UpperLimit int `json:"UpperLimit"` }
VoteRate decides how many candidates will be voted
type VoteSet ¶
type VoteSet struct {
// contains filtered or unexported fields
}
VoteSet helps collect signatures from validators at each height+round for a predefined vote type.
We need VoteSet to be able to keep track of conflicting votes when validators double-sign. Yet, we can't keep track of *all* the votes seen, as that could be a DoS attack vector.
There are two storage areas for votes. 1. voteSet.votes 2. voteSet.votesByBlock
`.votes` is the "canonical" list of votes. It always has at least one vote, if a vote from a validator had been seen at all. Usually it keeps track of the first vote seen, but when a 2/3 majority is found, votes for that get priority and are copied over from `.votesByBlock`.
`.votesByBlock` keeps track of a list of votes for a particular block. There are two ways a &blockVotes{} gets created in `.votesByBlock`. 1. the first vote seen by a validator was for the particular block. 2. a peer claims to have seen 2/3 majority for the particular block.
Since the first vote from a validator will always get added in `.votesByBlock` , all votes in `.votes` will have a corresponding entry in `.votesByBlock`.
When a &blockVotes{} in `.votesByBlock` reaches a 2/3 majority quorum, its votes are copied into `.votes`.
All this is memory bounded because conflicting votes only get added if a peer told us to track that block, each peer only gets to tell us 1 such block, and, there's only a limited number of peers.
NOTE: Assumes that the sum total of voting power does not exceed MaxUInt64.
func NewVoteSet ¶
func NewVoteSet(chainID string, height uint64, round int, type_ byte, valSet *ValidatorSet) *VoteSet
Constructs a new VoteSet struct used to accumulate votes for given height/round.
func (*VoteSet) AddVote ¶
Returns added=true if vote is valid and new. Otherwise returns err=ErrVote[
UnexpectedStep | InvalidIndex | InvalidAddress | InvalidSignature | InvalidBlockHash | ConflictingVotes ]
Duplicate votes return added=false, err=nil. Conflicting votes return added=*, err=ErrVoteConflictingVotes. NOTE: vote should not be mutated after adding. NOTE: VoteSet must not be nil NOTE: Vote must not be nil
func (*VoteSet) BitArrayByBlockID ¶
func (*VoteSet) BitArrayString ¶
Return the bit-array of votes including the fraction of power that has voted like: "BA{29:xx__x__x_x___x__x_______xxx__} 856/1304 = 0.66"
func (*VoteSet) GetByAddress ¶
func (*VoteSet) GetByIndex ¶
NOTE: if validator has conflicting votes, returns "canonical" vote
func (*VoteSet) HasTwoThirdsAny ¶
func (*VoteSet) HasTwoThirdsMajority ¶
func (*VoteSet) MakeCommit ¶
func (*VoteSet) MarshalJSON ¶
Marshal the VoteSet to JSON. Same as String(), just in JSON, and without the height/round/type_ (since its already included in the votes).
func (*VoteSet) SetPeerMaj23 ¶
If a peer claims that it has 2/3 majority for given blockKey, call this. NOTE: if there are too many peers, or too much peer churn, this can cause memory issues. TODO: implement ability to remove peers too NOTE: VoteSet must not be nil
func (*VoteSet) StringIndented ¶
func (*VoteSet) StringShort ¶
func (*VoteSet) TwoThirdsMajority ¶
If there was a +2/3 majority for blockID, return blockID and true. Else, return the empty BlockID{} and false.
func (*VoteSet) VoteStrings ¶
Returns a list of votes compressed to more readable strings.
type VoteSetJSON ¶
type VoteSetJSON struct { Votes []string `json:"votes"` VotesBitArray string `json:"votes_bit_array"` PeerMaj23s map[string]BlockID `json:"peer_maj_23s"` }
More human readable JSON of the vote set NOTE: insufficient for unmarshalling from (compressed votes) TODO: make the peerMaj23s nicer to read (eg just the block hash)
Source Files ¶
- balance_record.go
- blacklist.go
- block.go
- block_meta.go
- bloom9.go
- candidate.go
- canonical_json.go
- const.go
- error.go
- event_bus.go
- events.go
- evidence.go
- gen_log_json.go
- gen_tokentx_json.go
- gen_tx_json.go
- genesis.go
- heartbeat.go
- interfaces.go
- keys.go
- log.go
- mock_State.go
- mock_TxCensor.go
- mock_TxMgr.go
- nop_event_bus.go
- params.go
- part_set.go
- priv_validator.go
- proposal.go
- receipt.go
- sign.go
- signable.go
- test_util.go
- transaction.go
- tx.go
- tx_censor.go
- tx_cross.go
- tx_fee.go
- tx_type_cut.go
- tx_type_mst.go
- tx_type_txt.go
- tx_utxo.go
- txentry.go
- utxo_change_rate_getter.go
- validator.go
- validator_set.go
- vm.go
- vote.go
- vote_set.go
- wire.go